diff --git a/lua/core/skill_type/usable_skill.lua b/lua/core/skill_type/usable_skill.lua index 86f1ca21..f3429296 100644 --- a/lua/core/skill_type/usable_skill.lua +++ b/lua/core/skill_type/usable_skill.lua @@ -43,10 +43,10 @@ function UsableSkill:withinTimesLimit(player, scope, card, card_name, to) table.find(temp_suf, function(s) return player:getMark(MarkEnum.BypassTimesLimit .. s) ~= 0 end)) or - (to:getMark(MarkEnum.BypassTimesLimitTo) ~= 0 or + (to and (to:getMark(MarkEnum.BypassTimesLimitTo) ~= 0 or table.find(temp_suf, function(s) return to:getMark(MarkEnum.BypassTimesLimitTo .. s) ~= 0 - end)) + end))) end function UsableSkill:withinDistanceLimit(player, isattack, card, to) @@ -66,10 +66,10 @@ function UsableSkill:withinDistanceLimit(player, isattack, card, to) table.find(temp_suf, function(s) return player:getMark(MarkEnum.BypassDistancesLimit .. s) ~= 0 end)) or - (to:getMark(MarkEnum.BypassDistancesLimitTo) ~= 0 or + (to and (to:getMark(MarkEnum.BypassDistancesLimitTo) ~= 0 or table.find(temp_suf, function(s) return to:getMark(MarkEnum.BypassDistancesLimitTo .. s) ~= 0 - end)) + end))) end return UsableSkill diff --git a/lua/server/events/hp.lua b/lua/server/events/hp.lua index 9f7660fb..037b8c89 100644 --- a/lua/server/events/hp.lua +++ b/lua/server/events/hp.lua @@ -169,7 +169,7 @@ GameEvent.functions[GameEvent.Damage] = function(self) end if damageStruct.damageType ~= fk.NormalDamage and damageStruct.to.chained then - damageStruct.beginnerOfTheDamage = true + if not damageStruct.chain then damageStruct.beginnerOfTheDamage = true end damageStruct.to:setChainState(false) end diff --git a/lua/server/room.lua b/lua/server/room.lua index de8e5e6d..ab836da6 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -1095,12 +1095,14 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra local targets = data.targets local card_data = json.decode(card) local selected_cards = card_data.subcards + local interaction if not no_indicate then self:doIndicate(player.id, targets) end if skill.interaction then - skill.interaction.data = data.interaction_data + interaction = data.interaction_data + skill.interaction.data = interaction end if skill:isInstanceOf(ActiveSkill) then @@ -1113,7 +1115,8 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra return true, { cards = selected_cards, - targets = targets + targets = targets, + interaction = interaction } end @@ -1331,7 +1334,7 @@ end --- 询问玩家选择X张牌和Y名角色。 --- ---- 返回两个值,第一个是选择的目标列表,第二个是选择的那张牌的id +--- 返回两个值,第一个是选择的目标列表,第二个是选择的牌id列表 ---@param player ServerPlayer @ 要询问的玩家 ---@param minCardNum integer @ 选卡牌最小值 ---@param maxCardNum integer @ 选卡牌最大值 @@ -1355,7 +1358,7 @@ function Room:askForChooseCardsAndPlayers(player, minCardNum, maxCardNum, target local c = Fk:getCardById(id) return c:matchPattern(pattern) end) - if #pcards < minCardNum and not cancelable then return table.unpack({}, {}) end + if #pcards < minCardNum and not cancelable then return {}, {} end local data = { targets = targets, @@ -1365,6 +1368,8 @@ function Room:askForChooseCardsAndPlayers(player, minCardNum, maxCardNum, target min_card_num = minCardNum, pattern = pattern, skillName = skillName, + -- include_equip = includeEquip, -- FIXME: 预定一个破坏性更新 + -- expand_pile = expandPile, } local _, ret = self:askForUseActiveSkill(player, "ex__choose_skill", prompt or "", cancelable, data, no_indicate) if ret then @@ -1682,7 +1687,7 @@ end ---@return string[] @ 选择的选项 function Room:askForChoices(player, choices, minNum, maxNum, skill_name, prompt, cancelable, detailed, all_choices) cancelable = (cancelable == nil) and true or cancelable - if #choices <= minNum and not all_choices then return choices end + if #choices <= minNum and not all_choices and not cancelable then return choices end assert(minNum <= maxNum) assert(not all_choices or table.every(choices, function(c) return table.contains(all_choices, c) end)) local command = "AskForChoices" @@ -1694,7 +1699,13 @@ function Room:askForChoices(player, choices, minNum, maxNum, skill_name, prompt, local result = self:doRequest(player, command, json.encode{ choices, all_choices, {minNum, maxNum}, cancelable, skill_name, prompt, detailed }) - if result == "" then return {} end + if result == "" then + if cancelable then + return {} + else + return table.random(choices, math.min(minNum, #choices)) + end + end return json.decode(result) end @@ -2032,7 +2043,8 @@ function Room:askForUseCard(player, card_name, pattern, prompt, cancelable, extr end end until type(useResult) ~= "string" - + player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit .. "-tmp", 0) -- FIXME: 缺少直接传入无限制的手段 + player.room:setPlayerMark(player, MarkEnum.BypassTimesLimit .. "-tmp", 0) -- FIXME: 缺少直接传入无限制的手段 return useResult end player.room:setPlayerMark(player, MarkEnum.BypassDistancesLimit .. "-tmp", 0) -- FIXME: 缺少直接传入无限制的手段 @@ -2609,6 +2621,13 @@ function Room:doCardUseEffect(cardUseEvent) -- If using card to other card (like jink or nullification), simply effect and return if cardUseEvent.toCard ~= nil then self:doCardEffect(cardEffectEvent) + + if cardEffectEvent.cardsResponded then + cardUseEvent.cardsResponded = cardUseEvent.cardsResponded or {} + for _, card in ipairs(cardEffectEvent.cardsResponded) do + table.insertIfNeed(cardUseEvent.cardsResponded, card) + end + end return end diff --git a/packages/standard/aux_skills.lua b/packages/standard/aux_skills.lua index 8a6c75bb..310a0b0c 100644 --- a/packages/standard/aux_skills.lua +++ b/packages/standard/aux_skills.lua @@ -95,7 +95,7 @@ local choosePlayersSkill = fk.CreateActiveSkill{ local exChooseSkill = fk.CreateActiveSkill{ name = "ex__choose_skill", card_filter = function(self, to_select, selected) - if #selected < self.max_card_num then return false end + 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 diff --git a/packages/test/init.lua b/packages/test/init.lua index f9151005..10c163fc 100644 --- a/packages/test/init.lua +++ b/packages/test/init.lua @@ -96,6 +96,9 @@ local control = fk.CreateActiveSkill{ to:control(to) end end + -- local targets, cards = room:askForChooseCardsAndPlayers(from, 1, 3, effect.tos, 1, 3, nil, "选一下吧", self.name, true) + -- p(targets) + -- p(cards) --local success, dat = room:askForUseViewAsSkill(from, "test_vs", nil, true) --if success then --local card = Fk.skills["test_vs"]:viewAs(dat.cards)