From 1f1b6777689fb32e95d49bb18b8e4b2ddfe58920 Mon Sep 17 00:00:00 2001 From: Ho-spair <62695577+Ho-spair@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:06:07 +0800 Subject: [PATCH] fixup (#298) --- Fk/Pages/Room.qml | 11 ++++++++++ Fk/RoomElement/Photo.qml | 32 ++++++++++++++------------- lua/client/i18n/zh_CN.lua | 3 +++ lua/server/events/hp.lua | 1 + lua/server/events/pindian.lua | 2 +- lua/server/events/usecard.lua | 41 +++++++++++++++++++---------------- lua/server/room.lua | 4 ++-- 7 files changed, 57 insertions(+), 37 deletions(-) diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index 86adad99..6f717f1b 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -974,6 +974,17 @@ Item { } } + GlowText { + anchors.centerIn: dashboard + visible: Logic.getPhoto(Self.id).rest > 0 && !config.observing + text: Backend.translate("Resting, don't leave!") + color: "#DBCC69" + font.family: fontLibian.name + font.pixelSize: 28 + glow.color: "#2E200F" + glow.spread: 0.6 + } + Rectangle { anchors.fill: dashboard visible: config.observing && !config.replaying diff --git a/Fk/RoomElement/Photo.qml b/Fk/RoomElement/Photo.qml index e1ca95f9..641643f7 100644 --- a/Fk/RoomElement/Photo.qml +++ b/Fk/RoomElement/Photo.qml @@ -277,36 +277,38 @@ Item { anchors.leftMargin: 20 visible: root.rest > 0 - Text { + GlowText { Layout.alignment: Qt.AlignCenter - text: "休整中" + text: Backend.translate("resting...") font.family: fontLibian.name font.pixelSize: 40 - color: "white" - style: Text.Outline - textFormat: Text.RichText + font.bold: true + color: "#FEF7D6" + glow.color: "#845422" + glow.spread: 0.8 } - Text { + GlowText { Layout.alignment: Qt.AlignCenter visible: root.rest > 0 && root.rest < 999 text: root.rest font.family: fontLibian.name - font.pixelSize: 30 - color: "white" - style: Text.Outline - textFormat: Text.RichText + font.pixelSize: 34 + font.bold: true + color: "#DBCC69" + glow.color: "#2E200F" + glow.spread: 0.6 } - Text { + GlowText { Layout.alignment: Qt.AlignCenter visible: root.rest > 0 && root.rest < 999 - text: "轮次" + text: Backend.translate("rest round num") font.family: fontLibian.name font.pixelSize: 28 - color: "white" - style: Text.Outline - textFormat: Text.RichText + color: "#F0E5D6" + glow.color: "#2E200F" + glow.spread: 0.6 } } diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 672de826..09589736 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -283,6 +283,9 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下 ["Log"] = "战报", ["Trusting ..."] = "托管中 ...", ["Observing ..."] = "旁观中 ...", + ["Resting, don't leave!"] = "稍后你可返回战局,不要离开", + ["resting..."] = "休整中", + ["rest round num"] = "轮次", ["$GameOver"] = "游戏结束", ["$Winner"] = "%1 获胜", diff --git a/lua/server/events/hp.lua b/lua/server/events/hp.lua index b4745a32..9f7660fb 100644 --- a/lua/server/events/hp.lua +++ b/lua/server/events/hp.lua @@ -217,6 +217,7 @@ GameEvent.exit_funcs[GameEvent.Damage] = function(self) from = damageStruct.from, to = p, damage = damageStruct.damage, + damageType = damageStruct.damageType, card = damageStruct.card, skillName = damageStruct.skillName, chain = true, diff --git a/lua/server/events/pindian.lua b/lua/server/events/pindian.lua index bec09a77..c1c593a4 100644 --- a/lua/server/events/pindian.lua +++ b/lua/server/events/pindian.lua @@ -22,7 +22,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self) reason = pindianData.reason, } local prompt = "#askForPindian:::" .. pindianData.reason - local data = { "choose_cards_skill", prompt, false, json.encode(extraData) } + local data = { "choose_cards_skill", prompt, false, extraData } local targets = {} local moveInfos = {} diff --git a/lua/server/events/usecard.lua b/lua/server/events/usecard.lua index fa1a997f..b540c3bf 100644 --- a/lua/server/events/usecard.lua +++ b/lua/server/events/usecard.lua @@ -155,6 +155,8 @@ local sendCardEmotionAndLog = function(room, cardUseEvent) } end end + + return _card end GameEvent.functions[GameEvent.UseCard] = function(self) @@ -166,30 +168,31 @@ GameEvent.functions[GameEvent.UseCard] = function(self) cardUseEvent.card.skill:onUse(room, cardUseEvent) end - sendCardEmotionAndLog(room, cardUseEvent) + local _card = sendCardEmotionAndLog(room, cardUseEvent) room:moveCardTo(cardUseEvent.card, Card.Processing, nil, fk.ReasonUse) local card = cardUseEvent.card local useCardIds = card:isVirtual() and card.subcards or { card.id } - if #useCardIds == 0 then return end - if cardUseEvent.tos and #cardUseEvent.tos > 0 and #cardUseEvent.tos <= 2 then - local tos = table.map(cardUseEvent.tos, function(e) return e[1] end) - room:sendFootnote(useCardIds, { - type = "##UseCardTo", - from = cardUseEvent.from, - to = tos, - }) - if card:isVirtual() then - room:sendCardVirtName(useCardIds, card.name) - end - else - room:sendFootnote(useCardIds, { - type = "##UseCard", - from = cardUseEvent.from, - }) - if card:isVirtual() then - room:sendCardVirtName(useCardIds, card.name) + if #useCardIds > 0 then + if cardUseEvent.tos and #cardUseEvent.tos > 0 and #cardUseEvent.tos <= 2 then + local tos = table.map(cardUseEvent.tos, function(e) return e[1] end) + room:sendFootnote(useCardIds, { + type = "##UseCardTo", + from = cardUseEvent.from, + to = tos, + }) + if card:isVirtual() or card ~= _card then + room:sendCardVirtName(useCardIds, card.name) + end + else + room:sendFootnote(useCardIds, { + type = "##UseCard", + from = cardUseEvent.from, + }) + if card:isVirtual() or card ~= _card then + room:sendCardVirtName(useCardIds, card.name) + end end end diff --git a/lua/server/room.lua b/lua/server/room.lua index ec49f0aa..cbaaa3bb 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -635,8 +635,8 @@ function Room:changeHero(player, new_general, full, isDeputy, sendLog, maxHpChan execGameEvent(GameEvent.ChangeProperty, { from = player, - general = not isDeputy and new_general or "", - deputyGeneral = isDeputy and new_general or "", + general = not isDeputy and new_general or nil, + deputyGeneral = isDeputy and new_general or nil, gender = isDeputy and player.gender or new.gender, kingdom = kingdom, sendLog = sendLog,