From 694deecdf159444acbcff9bd80461b3019bd444b Mon Sep 17 00:00:00 2001 From: notify Date: Mon, 13 Mar 2023 20:51:12 +0800 Subject: [PATCH] Fixbug (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复ak和咆哮失效 - 修复服务端调viewAs的时候缺个Self - 修复不能显示数字型标记 - 新函数player:gainAnExtraTurn,可用来进行额外回合 --- lua/client/i18n/zh_CN.lua | 1 + lua/core/skill.lua | 4 ++++ lua/server/room.lua | 1 + lua/server/serverplayer.lua | 13 +++++++++++++ packages/maneuvering/init.lua | 4 ++-- qml/Pages/RoomLogic.js | 2 +- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 838d7d60..63993f9c 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -150,6 +150,7 @@ Fk:loadTranslationTable{ -- phase ["#PhaseSkipped"] = "%from 跳过了 %arg", + ["#GainAnExtraTurn"] = "%from 开始进行一个额外的回合", -- useCard ["#UseCard"] = "%from 使用了牌 %card", diff --git a/lua/core/skill.lua b/lua/core/skill.lua index 5299c18f..d6f49dc5 100644 --- a/lua/core/skill.lua +++ b/lua/core/skill.lua @@ -1,5 +1,6 @@ ---@class Skill : Object ---@field name string +---@field trueName string ---@field package Package ---@field frequency Frequency ---@field visible boolean @@ -30,6 +31,9 @@ function Skill:initialize(name, frequency) self.anim_type = "" self.related_skills = {} + local name_splited = name:split("__") + self.trueName = name_splited[#name_splited] + if string.sub(name, 1, 1) == "#" then self.visible = false end diff --git a/lua/server/room.lua b/lua/server/room.lua index 04576f94..2d2ff6c9 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -994,6 +994,7 @@ function Room:handleUseCardReply(player, data) end) return nil elseif skill:isInstanceOf(ViewAsSkill) then + Self = player local c = skill:viewAs(selected_cards) if c then self:useSkill(player, skill) diff --git a/lua/server/serverplayer.lua b/lua/server/serverplayer.lua index 383573a5..365fc068 100644 --- a/lua/server/serverplayer.lua +++ b/lua/server/serverplayer.lua @@ -433,6 +433,19 @@ function ServerPlayer:skip(phase) end end +function ServerPlayer:gainAnExtraTurn() + local room = self.room + room:sendLog{ + type = "#GainAnExtraTurn", + from = self.id + } + + local current = room.current + room.current = self + GameEvent(GameEvent.Turn):exec() + room.current = current +end + function ServerPlayer:drawCards(num, skillName, fromPlace) return self.room:drawCards(self, num, skillName, fromPlace) end diff --git a/packages/maneuvering/init.lua b/packages/maneuvering/init.lua index 7f9b0e46..901b7304 100644 --- a/packages/maneuvering/init.lua +++ b/packages/maneuvering/init.lua @@ -3,7 +3,7 @@ local extension = Package:new("maneuvering", Package.CardPack) local slash = Fk:cloneCard("slash") local thunderSlashSkill = fk.CreateActiveSkill{ - name = "thunder_slash_skill", + name = "thunder__slash_skill", max_phase_use_time = 1, target_num = 1, can_use = slash.skill.canUse, @@ -40,7 +40,7 @@ extension:addCards{ } local fireSlashSkill = fk.CreateActiveSkill{ - name = "fire_slash_skill", + name = "fire__slash_skill", max_phase_use_time = 1, target_num = 1, can_use = slash.skill.canUse, diff --git a/qml/Pages/RoomLogic.js b/qml/Pages/RoomLogic.js index 3a19cdbe..0de2c752 100644 --- a/qml/Pages/RoomLogic.js +++ b/qml/Pages/RoomLogic.js @@ -843,7 +843,7 @@ callbacks["SetPlayerMark"] = function(jsonData) { let data = JSON.parse(jsonData); let player = getPhotoOrSelf(data[0]); let mark = data[1]; - let value = data[2]; + let value = data[2].toString(); if (value == 0) { player.markArea.removeMark(mark); } else {