From 8df1985b99c1a12d81bef597bc352839d42e15af Mon Sep 17 00:00:00 2001 From: YoumuKon <38815081+YoumuKon@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=8F=82=E6=95=B0=E6=94=B9?= =?UTF-8?q?=E9=80=A0=E5=92=8Cbugfix=20(#287)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重做目标参数相关: - 重修`must_targets`参数,必须选择其中**全部**目标后才能选择其他目标/按确定 - 添加`include_targets`参数,必须选择其中**一个**目标后才能选择其他目标/按确定 - 修复expandPile指定牌堆无卡符合要求则收回的bug - 优化ex_choose_skill,添加扩展牌堆和包括装备功能 - 添加ReasonRecast理由,现在recastCard会返回该动作后摸的牌 - 移除了重复的DamageFinished时机触发 --- Fk/Pages/RoomLogic.js | 40 +++++++++++++++++++++++++++++--- Fk/RoomElement/Dashboard.qml | 6 ++--- lua/server/events/hp.lua | 1 - lua/server/room.lua | 5 ++-- lua/server/system_enum.lua | 1 + packages/standard/aux_skills.lua | 18 +++++++++++++- 6 files changed, 61 insertions(+), 10 deletions(-) diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index c1677e75..6e27cc18 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -574,10 +574,22 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] } )); photo.selectable = ret; if (roomScene.extra_data instanceof Object) { + const must = roomScene.extra_data.must_targets; + const included = roomScene.extra_data.include_targets; const exclusived = roomScene.extra_data.exclusive_targets; if (exclusived instanceof Array) { if (exclusived.indexOf(id) === -1) photo.selectable = false; } + if (must instanceof Array) { + if (must.filter((val) => { + return selected_targets.indexOf(val) === -1; + }).length !== 0 && must.indexOf(id) === -1) photo.selectable = false; + } + if (included instanceof Array) { + if (included.filter((val) => { + return selected_targets.indexOf(val) !== -1; + }).length === 0 && included.indexOf(id) === -1) photo.selectable = false; + } } }) @@ -596,8 +608,12 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] } if (okButton.enabled) { if (roomScene.extra_data instanceof Object) { const must = roomScene.extra_data.must_targets; + const included = roomScene.extra_data.include_targets; if (must instanceof Array) { - okButton.enabled = (must.length === 0); + if(must.length === 0) okButton.enabled = false; + } + if (included instanceof Array) { + if (included.length === 0) okButton.enabled = false; } } } @@ -636,10 +652,22 @@ function updateSelectedTargets(playerid, selected) { )); photo.selectable = ret; if (roomScene.extra_data instanceof Object) { + const must = roomScene.extra_data.must_targets; + const included = roomScene.extra_data.include_targets; const exclusived = roomScene.extra_data.exclusive_targets; if (exclusived instanceof Array) { if (exclusived.indexOf(id) === -1) photo.selectable = false; } + if (must instanceof Array) { + if (must.filter((val) => { + return selected_targets.indexOf(val) === -1; + }).length !== 0 && must.indexOf(id) === -1) photo.selectable = false; + } + if (included instanceof Array) { + if (included.filter((val) => { + return selected_targets.indexOf(val) !== -1; + }).length === 0 && included.indexOf(id) === -1) photo.selectable = false; + } } }) @@ -658,10 +686,16 @@ function updateSelectedTargets(playerid, selected) { if (okButton.enabled) { if (roomScene.extra_data instanceof Object) { const must = roomScene.extra_data.must_targets; + const included = roomScene.extra_data.include_targets; if (must instanceof Array) { - okButton.enabled = (must.filter((val) => { + if (must.filter((val) => { return selected_targets.indexOf(val) === -1; - }).length === 0); + }).length !== 0) okButton.enabled = false; + } + if (included instanceof Array) { + if (included.filter((val) => { + return selected_targets.indexOf(val) !== -1; + }).length === 0) okButton.enabled = false; } } } diff --git a/Fk/RoomElement/Dashboard.qml b/Fk/RoomElement/Dashboard.qml index 09faeb03..14b27b3e 100644 --- a/Fk/RoomElement/Dashboard.qml +++ b/Fk/RoomElement/Dashboard.qml @@ -365,9 +365,9 @@ RowLayout { [pending_skill, cid, pendings, targets] ))) { enabled_cards.push(cid); - if (!expanded_piles[pile]) { - expandPile(pile); - } + }; + if (!expanded_piles[pile]) { + expandPile(pile); } }); diff --git a/lua/server/events/hp.lua b/lua/server/events/hp.lua index e65dc334..31520d74 100644 --- a/lua/server/events/hp.lua +++ b/lua/server/events/hp.lua @@ -175,7 +175,6 @@ GameEvent.functions[GameEvent.Damage] = function(self) stages = { {fk.Damage, damageStruct.from}, {fk.Damaged, damageStruct.to}, - {fk.DamageFinished, damageStruct.to}, } for _, struct in ipairs(stages) do diff --git a/lua/server/room.lua b/lua/server/room.lua index b329375c..bd2a6816 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -3157,6 +3157,7 @@ end ---@param card_ids integer[] @ 被重铸的牌 ---@param who ServerPlayer @ 重铸的角色 ---@param skillName? string @ 技能名,默认为“重铸” +---@return integer[] @ 摸到的牌 function Room:recastCard(card_ids, who, skillName) if type(card_ids) == "number" then card_ids = {card_ids} @@ -3167,7 +3168,7 @@ function Room:recastCard(card_ids, who, skillName) from = who.id, toArea = Card.DiscardPile, skillName = skillName, - moveReason = fk.ReasonPutIntoDiscardPile, + moveReason = fk.ReasonRecast, proposer = who.id }) self:broadcastPlaySound("./audio/system/recast") @@ -3177,7 +3178,7 @@ function Room:recastCard(card_ids, who, skillName) card = card_ids, arg = skillName, } - self:drawCards(who, #card_ids, skillName) + return self:drawCards(who, #card_ids, skillName) end --- 根据拼点信息开始拼点。 diff --git a/lua/server/system_enum.lua b/lua/server/system_enum.lua index 3219e62c..e4f404ea 100644 --- a/lua/server/system_enum.lua +++ b/lua/server/system_enum.lua @@ -192,6 +192,7 @@ fk.ReasonExchange = 8 fk.ReasonUse = 9 fk.ReasonResonpse = 10 fk.ReasonJudge = 11 +fk.ReasonRecast = 12 ---@class PindianStruct ---@field public from ServerPlayer diff --git a/packages/standard/aux_skills.lua b/packages/standard/aux_skills.lua index 8d54d6c4..8a6c75bb 100644 --- a/packages/standard/aux_skills.lua +++ b/packages/standard/aux_skills.lua @@ -95,7 +95,23 @@ local choosePlayersSkill = fk.CreateActiveSkill{ local exChooseSkill = fk.CreateActiveSkill{ name = "ex__choose_skill", card_filter = function(self, to_select, selected) - return self.pattern ~= "" and Exppattern:Parse(self.pattern):match(Fk:getCardById(to_select)) and #selected < self.max_card_num + if #selected < self.max_card_num then return false end + + if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then + if not string.find(self.pattern or "", self.expand_pile or "") then return false end + end + + local checkpoint = true + local card = Fk:getCardById(to_select) + + if not self.include_equip then + checkpoint = checkpoint and (Fk:currentRoom():getCardArea(to_select) ~= Player.Equip) + end + + if self.pattern and self.pattern ~= "" then + checkpoint = checkpoint and (Exppattern:Parse(self.pattern):match(card)) + end + return checkpoint end, target_filter = function(self, to_select, selected, cards) if self.pattern ~= "" and #cards < self.min_card_num then return end