From 357391081d8a2d7ffc11296c5fd73c9fc4d11897 Mon Sep 17 00:00:00 2001 From: seven <786852516@qq.com> Date: Fri, 26 Apr 2024 21:15:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E8=83=BD=E7=9B=AE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/client/i18n/en_US.lua | 1 + lua/client/i18n/zh_CN.lua | 1 + lua/server/room.lua | 60 ++++++++++++++++++++++++++++----------- standard/init.lua | 15 +++++----- 4 files changed, 54 insertions(+), 23 deletions(-) diff --git a/lua/client/i18n/en_US.lua b/lua/client/i18n/en_US.lua index d83fd79..5d290b9 100644 --- a/lua/client/i18n/en_US.lua +++ b/lua/client/i18n/en_US.lua @@ -396,6 +396,7 @@ Fk:loadTranslationTable({ -- skill ["#InvokeSkill"] = '%from used skill "%arg"', + ["#InvokeSkillTo"] = '%from used skill "%arg" to %to', -- judge ["#StartJudgeReason"] = "%from started a judgement (%arg)", diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 369c60b..b09fdbe 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -468,6 +468,7 @@ Fk:loadTranslationTable{ -- skill ["#InvokeSkill"] = "%from 发动了 “%arg”", + ["#InvokeSkillTo"] = "%from 对 %to 发动了 “%arg”", -- judge ["#StartJudgeReason"] = "%from 开始了 %arg 的判定", diff --git a/lua/server/room.lua b/lua/server/room.lua index a79cc52..9754639 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -1078,24 +1078,39 @@ end ---@param skill_type? string @ 技能的动画效果,默认是那个技能的anim_type function Room:notifySkillInvoked(player, skill_name, skill_type) local bigAnim = false + local targets if not skill_type then local skill = Fk.skills[skill_name] - if not skill then skill_type = "" end - - if skill.frequency == Skill.Limited or skill.frequency == Skill.Wake then - bigAnim = true + if skill then + if skill.frequency == Skill.Limited or skill.frequency == Skill.Wake then + bigAnim = true + end + skill_type = skill.anim_type + if not skill.no_indicate and + type(skill.cost_data) == "table" and type(skill.cost_data.targets) == "table" and #skill.cost_data.targets > 0 then + targets = skill.cost_data.targets + end + else + skill_type = "" end - - skill_type = skill.anim_type end if skill_type == "big" then bigAnim = true end - self:sendLog{ - type = "#InvokeSkill", - from = player.id, - arg = skill_name, - } + if targets then + self:sendLog{ + type = "#InvokeSkillTo", + from = player.id, + to = targets, + arg = skill_name, + } + else + self:sendLog{ + type = "#InvokeSkill", + from = player.id, + arg = skill_name, + } + end if not bigAnim then self:doAnimate("InvokeSkill", { @@ -2106,6 +2121,10 @@ function Room:handleUseCardReply(player, data) if type(card) == "string" then local card_data = json.decode(card) local skill = Fk.skills[card_data.skill] + skill.cost_data = skill.cost_data or {} + if type(skill.cost_data) == "table" then + skill.cost_data.targets = targets + end local selected_cards = card_data.subcards if skill.interaction then skill.interaction.data = data.interaction_data end if skill:isInstanceOf(ActiveSkill) then @@ -3677,11 +3696,20 @@ function Room:useSkill(player, skill, effect_cb) local pkgPath = "./packages/" .. equip.package.extensionName local soundName = pkgPath .. "/audio/card/" .. equip.name self:broadcastPlaySound(soundName) - self:sendLog{ - type = "#InvokeSkill", - from = player.id, - arg = skill.name, - } + if type(skill.cost_data) == "table" and type(skill.cost_data.targets) == "table" and #skill.cost_data.targets > 0 then + self:sendLog{ + type = "#InvokeSkillTo", + from = player.id, + to = skill.cost_data.targets, + arg = skill.name, + } + else + self:sendLog{ + type = "#InvokeSkill", + from = player.id, + arg = skill.name, + } + end self:setEmotion(player, pkgPath .. "/image/anim/" .. equip.name) else player:broadcastSkillInvoke(skill.name) diff --git a/standard/init.lua b/standard/init.lua index 44aed8d..8f62730 100644 --- a/standard/init.lua +++ b/standard/init.lua @@ -164,21 +164,22 @@ local tuxi = fk.CreateTriggerSkill{ local targets = table.map(table.filter(room:getOtherPlayers(player), function(p) return not p:isKongcheng() end), Util.IdMapper) - local result = room:askForChoosePlayers(player, targets, 1, 2, "#tuxi-ask", self.name) - if #result > 0 then - self.cost_data = result + local tos = room:askForChoosePlayers(player, targets, 1, 2, "#tuxi-ask", self.name) + if #tos > 0 then + self.cost_data = {targets = tos} return true end end, on_use = function(self, event, target, player, data) local room = player.room - room:sortPlayersByAction(self.cost_data) - for _, id in ipairs(self.cost_data) do - if player.dead then return end + local tos = self.cost_data.targets + room:sortPlayersByAction(tos) + for _, id in ipairs(tos) do + if player.dead then break end local p = room:getPlayerById(id) if not p.dead and not p:isKongcheng() then local c = room:askForCardChosen(player, p, "h", self.name) - room:obtainCard(player.id, c, false, fk.ReasonPrey) + room:obtainCard(player.id, c, false, fk.ReasonPrey, player.id, self.name) end end return true -- Gitee