From 7452e81e2f9ec93885f6cd39a923630478174249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Wed, 3 Jul 2024 02:55:33 +0800 Subject: [PATCH 1/7] fix --- lua/server/room.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/server/room.lua b/lua/server/room.lua index df6a9f0..d62cb33 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -2137,8 +2137,6 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif local card_map = {} if max_top > 0 then table.insert(card_map, table.slice(cards, 1, max_top + 1)) - else - table.insert(card_map, {}) end if max_top < #cards then table.insert(card_map, table.slice(cards, max_top + 1)) -- Gitee From b3a2de790c0dbccfa49dfc1e8f7fd169d00fd9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Wed, 3 Jul 2024 17:25:51 +0800 Subject: [PATCH 2/7] fix --- lua/server/room.lua | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lua/server/room.lua b/lua/server/room.lua index d62cb33..7eb19ec 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -2115,8 +2115,9 @@ end ---@return table<"top"|"bottom", integer[]> function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotify, noPut, areaNames) -- 这一大堆都是来提前报错的 - top_limit = top_limit or Util.DummyTable - bottom_limit = bottom_limit or Util.DummyTable + local leng = #cards + top_limit = top_limit or { 0, leng } + bottom_limit = bottom_limit or { 0, leng } if #top_limit > 0 then assert(top_limit[1] >= 0 and top_limit[2] >= 0, "limits error: The lower limit should be greater than 0") assert(top_limit[1] <= top_limit[2], "limits error: The upper limit should be less than the lower limit") @@ -2126,38 +2127,40 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif assert(bottom_limit[1] <= bottom_limit[2], "limits error: The upper limit should be less than the lower limit") end if #top_limit > 0 and #bottom_limit > 0 then - assert(#cards >= top_limit[1] + bottom_limit[1] and #cards <= top_limit[2] + bottom_limit[2], "limits Error: No enough space") + assert(leng >= top_limit[1] + bottom_limit[1] and leng <= top_limit[2] + bottom_limit[2], "limits Error: No enough space") end if areaNames then assert(#areaNames == 2, "areaNames error: Should have 2 elements") + else + areaNames = { "Top", "Bottom" } end local command = "AskForGuanxing" self:notifyMoveFocus(player, customNotify or command) - local max_top = top_limit and top_limit[2] or #cards + local max_top = top_limit[2] local card_map = {} if max_top > 0 then table.insert(card_map, table.slice(cards, 1, max_top + 1)) end - if max_top < #cards then + if max_top < leng then table.insert(card_map, table.slice(cards, max_top + 1)) end local data = { prompt = "", is_free = true, cards = card_map, - min_top_cards = top_limit and top_limit[1] or 0, - max_top_cards = top_limit and top_limit[2] or #cards, - min_bottom_cards = bottom_limit and bottom_limit[1] or 0, - max_bottom_cards = bottom_limit and bottom_limit[2] or #cards, - top_area_name = areaNames and areaNames[1] or "Top", - bottom_area_name = areaNames and areaNames[2] or "Bottom", + min_top_cards = top_limit[1], + max_top_cards = top_limit[2], + min_bottom_cards = bottom_limit[1], + max_bottom_cards = bottom_limit[2], + top_area_name = areaNames[1], + bottom_area_name = areaNames[2], } local result = self:doRequest(player, command, json.encode(data)) local top, bottom if result ~= "" then local d = json.decode(result) - if #top_limit > 0 and top_limit[2] == 0 then + if top_limit[2] == 0 then top = Util.DummyTable bottom = d[1] else @@ -2165,8 +2168,9 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif bottom = d[2] or Util.DummyTable end else - top = table.random(cards, top_limit and top_limit[2] or #cards) or Util.DummyTable - bottom = table.shuffle(table.filter(cards, function(id) return not table.contains(top, id) end)) or Util.DummyTable + local pos = math.min(top_limit[2], leng - bottom_limit[1]) + top = table.slice(cards, 1, pos + 1) + bottom = table.slice(cards, pos + 1) end if not noPut then -- Gitee From d3f35a6ab8805b69e23fdccbd6c6afe5073b1866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Wed, 10 Jul 2024 16:59:09 +0800 Subject: [PATCH 3/7] fix --- lua/fk_ex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/fk_ex.lua b/lua/fk_ex.lua index 1c1e6b5..bb2a05f 100644 --- a/lua/fk_ex.lua +++ b/lua/fk_ex.lua @@ -237,7 +237,7 @@ end ---@field public enabled_at_response? fun(self: ViewAsSkill, player: Player, response: boolean): boolean? ---@field public before_use? fun(self: ViewAsSkill, player: ServerPlayer, use: CardUseStruct): string? ---@field public after_use? fun(self: ViewAsSkill, player: ServerPlayer, use: CardUseStruct): string? ----@field public prompt? string|fun(self: ActiveSkill, selected: integer[], selected_cards: integer[]): string +---@field public prompt? string|fun(self: ActiveSkill, selected_cards: integer[], selected: integer[]): string ---@param spec ViewAsSkillSpec ---@return ViewAsSkill -- Gitee From 188678e137986bcea6a9accfa7895767d6b725f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Wed, 10 Jul 2024 17:40:42 +0800 Subject: [PATCH 4/7] fix --- standard_cards/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standard_cards/init.lua b/standard_cards/init.lua index 72f6a8f..02a7b86 100644 --- a/standard_cards/init.lua +++ b/standard_cards/init.lua @@ -1174,7 +1174,9 @@ local eightDiagramSkill = fk.CreateTriggerSkill{ events = {fk.AskForCardUse, fk.AskForCardResponse}, can_trigger = function(self, event, target, player, data) if not (target == player and player:hasSkill(self) and - (data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then return end + (data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then + p(data.pattern) + p(Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")) return end if event == fk.AskForCardUse then return not player:prohibitUse(Fk:cloneCard("jink")) else -- Gitee From e64513ee7a77af7e981e9a140c7220c39aad3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Thu, 11 Jul 2024 13:32:41 +0800 Subject: [PATCH 5/7] lord fix --- lua/core/engine.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lua/core/engine.lua b/lua/core/engine.lua index 17044b4..e6356a3 100644 --- a/lua/core/engine.lua +++ b/lua/core/engine.lua @@ -75,6 +75,7 @@ function Engine:initialize() self.mini_games = {} self:loadPackages() + self:setLords() self:loadDisabled() self:addSkills(AuxSkills) end @@ -349,9 +350,9 @@ function Engine:addGeneral(general) table.insert(self.same_generals[tName], general.name) end - if table.find(general.skills, function(s) return s.lordSkill end) then - table.insert(self.lords, general.name) - end + -- if table.find(general.skills, function(s) return s.lordSkill end) then + -- table.insert(self.lords, general.name) + -- end end --- 加载一系列武将。 @@ -363,6 +364,15 @@ function Engine:addGenerals(generals) end end +--- 为所有武将加载主公技和主公判定 +function Engine:setLords() + for _, general in pairs(self.generals) do + if table.find(general.skills, function(s) return s.lordSkill end) then + table.insert(self.lords, general.name) + end + end +end + --- 为一个势力添加势力映射 --- --- 这意味着原势力登场时必须改变为添加的几个势力之一(须存在) -- Gitee From 38c7c26d0980f7d5f542a19f891e0e024fe269e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Thu, 11 Jul 2024 22:37:07 +0800 Subject: [PATCH 6/7] fix --- standard_cards/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/standard_cards/init.lua b/standard_cards/init.lua index 02a7b86..4b20d64 100644 --- a/standard_cards/init.lua +++ b/standard_cards/init.lua @@ -1175,8 +1175,6 @@ local eightDiagramSkill = fk.CreateTriggerSkill{ can_trigger = function(self, event, target, player, data) if not (target == player and player:hasSkill(self) and (data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then - p(data.pattern) - p(Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")) return end if event == fk.AskForCardUse then return not player:prohibitUse(Fk:cloneCard("jink")) else -- Gitee From 3f99c7b2795adfac593f5cbca6795a9c4d6d5db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E5=A6=96=E6=A2=A6=E5=8E=A8?= <12796194+youmuKon-supreme@user.noreply.gitee.com> Date: Fri, 12 Jul 2024 18:51:54 +0800 Subject: [PATCH 7/7] fix --- standard_cards/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard_cards/init.lua b/standard_cards/init.lua index 4b20d64..72f6a8f 100644 --- a/standard_cards/init.lua +++ b/standard_cards/init.lua @@ -1174,7 +1174,7 @@ local eightDiagramSkill = fk.CreateTriggerSkill{ events = {fk.AskForCardUse, fk.AskForCardResponse}, can_trigger = function(self, event, target, player, data) if not (target == player and player:hasSkill(self) and - (data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then + (data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none")))) then return end if event == fk.AskForCardUse then return not player:prohibitUse(Fk:cloneCard("jink")) else -- Gitee