From d9c23745467f016ac65b13333ab3b76f7a1b24f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=A4=A7=E5=8C=97?= <786852516@qq.com> Date: Mon, 27 Nov 2023 14:37:56 +0000 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E7=89=8C=E9=94=80=E6=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张大北 <786852516@qq.com> --- utility.lua | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/utility.lua b/utility.lua index ef0c837..c402ea9 100644 --- a/utility.lua +++ b/utility.lua @@ -717,4 +717,68 @@ Utility.GetEnemies = function(room, player, include_dead) return enemies end + +--[[ + 给卡牌上标记,用全局触发技监测,在一定时机销毁被标记的卡牌 + DestructCardIntoDiscardPile 进入弃牌堆-基本牌影 + DestructCardFromMyEquipArea 离开自己的装备区-新服刘晔 + DestructCardFromEquipArea 进入非装备区(可在装备区/处理区移动)-OL冯方女 +--]] +local CardDestructSkill = fk.CreateTriggerSkill{ + name = "#card_destruct_skill", + global = true, + mute = true, + refresh_events = {fk.BeforeCardsMove}, + can_refresh = Util.TrueFunc, + on_refresh = function(self, event, target, player, data) + local room = player.room + local mirror_moves = {} + local ids = {} + for _, move in ipairs(data) do + if move.toArea ~= Card.Void then + local move_info = {} + local mirror_info = {} + for _, info in ipairs(move.moveInfo) do + local id = info.cardId + local card = Fk:getCardById(id) + local yes + if card:getMark("DestructCardIntoDiscardPile") > 0 and move.toArea == Card.DiscardPile then + yes = true + end + if card:getMark("DestructCardFromMyEquipArea") > 0 and info.fromArea == Card.PlayerEquip then + yes = info.fromArea == Card.PlayerEquip + end + if card:getMark("DestructCardFromEquipArea") > 0 and (info.fromArea == Card.PlayerEquip and move.toArea ~= Card.PlayerEquip and move.toArea ~= Card.Processing) then + yes = true + end + if yes then + table.insert(mirror_info, info) + table.insert(ids, id) + else + table.insert(move_info, info) + end + end + if #mirror_info > 0 then + move.moveInfo = move_info + local mirror_move = table.clone(move) + mirror_move.to = nil + mirror_move.toArea = Card.Void + mirror_move.moveInfo = mirror_info + table.insert(mirror_moves, mirror_move) + end + end + end + if #ids > 0 then + room:sendLog{ type = "#destructDerivedCards", card = ids, } + table.insertTable(data, mirror_moves) + end + end, +} +Fk:addSkill(CardDestructSkill) +Fk:loadTranslationTable{ + ["#card_destruct_skill"] = "卡牌销毁", + ["#destructDerivedCards"] = "%card 被销毁了", +} + + return Utility -- Gitee