From 63e4ee99aca0dea5b660dcb4644613e2b363b0ea Mon Sep 17 00:00:00 2001 From: seven <786852516@qq.com> Date: Mon, 28 Oct 2024 13:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=E5=A5=96=E6=83=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/game_mode.lua | 13 +++++++++++++ lua/fk_ex.lua | 4 ++++ lua/server/events/gameflow.lua | 2 +- lua/server/room.lua | 2 +- standard/game_rule.lua | 12 +----------- standard/i18n/en_US.lua | 2 +- standard/i18n/zh_CN.lua | 11 ++++++++++- standard_cards/i18n/zh_CN.lua | 2 ++ 8 files changed, 33 insertions(+), 15 deletions(-) diff --git a/lua/core/game_mode.lua b/lua/core/game_mode.lua index 4e64382..17b77d6 100644 --- a/lua/core/game_mode.lua +++ b/lua/core/game_mode.lua @@ -101,4 +101,17 @@ function GameMode:getAdjustedProperty (player) return list end + +-- 执行死亡奖惩 +---@param victim ServerPlayer @ 死亡角色 +---@param killer? ServerPlayer @ 击杀者 +function GameMode:deathRewardAndPunish (victim, killer) + if not killer or killer.dead then return end + if victim.role == "rebel" then + killer:drawCards(3, "kill") + elseif victim.role == "loyalist" and killer.role == "lord" then + killer:throwAllCards("he") + end +end + return GameMode diff --git a/lua/fk_ex.lua b/lua/fk_ex.lua index c842bd1..13c9f0c 100644 --- a/lua/fk_ex.lua +++ b/lua/fk_ex.lua @@ -666,6 +666,10 @@ function fk.CreateGameMode(spec) assert(type(spec.get_adjusted) == "function") ret.getAdjustedProperty = spec.get_adjusted end + if spec.reward_punish then + assert(type(spec.reward_punish) == "function") + ret.deathRewardAndPunish = spec.reward_punish + end return ret end diff --git a/lua/server/events/gameflow.lua b/lua/server/events/gameflow.lua index 3c4f935..3c36e6b 100644 --- a/lua/server/events/gameflow.lua +++ b/lua/server/events/gameflow.lua @@ -354,7 +354,7 @@ function Phase:main() ) - player:getMaxCards() room:broadcastProperty(player, "MaxCards") if discardNum > 0 then - room:askForDiscard(player, discardNum, discardNum, false, "game_rule", false) + room:askForDiscard(player, discardNum, discardNum, false, "phase_discard", false) end end, [Player.Finish] = function() diff --git a/lua/server/room.lua b/lua/server/room.lua index 1e33dd7..3a61e73 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -971,7 +971,7 @@ function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, can return false end end - if skillName == "game_rule" then + if skillName == "phase_discard" then status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable for _, skill in ipairs(status_skills) do if skill:excludeFrom(player, card) then diff --git a/standard/game_rule.lua b/standard/game_rule.lua index 6e8c57f..fc09c62 100644 --- a/standard/game_rule.lua +++ b/standard/game_rule.lua @@ -1,14 +1,5 @@ -- SPDX-License-Identifier: GPL-3.0-or-later ----@param killer ServerPlayer -local function rewardAndPunish(killer, victim) - if killer.dead then return end - if victim.role == "rebel" then - killer:drawCards(3, "kill") - elseif victim.role == "loyalist" and killer.role == "lord" then - killer:throwAllCards("he") - end -end GameRule = fk.CreateTriggerSkill{ name = "game_rule", @@ -95,8 +86,7 @@ GameRule = fk.CreateTriggerSkill{ end local damage = data.damage if damage and damage.from then - local killer = damage.from - rewardAndPunish(killer, player); + Fk.game_modes[room.settings.gameMode]:deathRewardAndPunish(player, damage.from) end end, default = function() diff --git a/standard/i18n/en_US.lua b/standard/i18n/en_US.lua index 64121e6..eae6756 100644 --- a/standard/i18n/en_US.lua +++ b/standard/i18n/en_US.lua @@ -222,7 +222,7 @@ Fk:loadTranslationTable({ ["revealMain"] = "Reveal main character %arg", ["revealDeputy"] = "Reveal deputy character %arg", - ["game_rule"] = "Discard", + ["game_rule"] = "GameRule", }, "en_US") -- init diff --git a/standard/i18n/zh_CN.lua b/standard/i18n/zh_CN.lua index eab672c..bf00b9d 100644 --- a/standard/i18n/zh_CN.lua +++ b/standard/i18n/zh_CN.lua @@ -529,13 +529,22 @@ Fk:loadTranslationTable{ ["ex__choose_skill"] = "选择", ["distribution_select_skill"] = "分配", ["choose_players_to_move_card_in_board"] = "选择角色", + + ["AskForUseActiveSkill"] = "使用技能", + ["AskForSkillInvoke"] = "发动技能", + ["AskForUseCard"] = "使用", + ["AskForResponseCard"] = "打出", + ["AskForDiscard"] = "弃牌", + ["AskForCardChosen"] = "选牌", + ["AskForCardsChosen"] = "选牌", + ["reveal_skill&"] = "亮将", ["#reveal_skill&"] = "选择一个武将亮将(点击左侧选择框展开)", [":reveal_skill&"] = "出牌阶段,你可明置一张有锁定技的武将。", ["revealMain"] = "明置主将 %arg", ["revealDeputy"] = "明置副将 %arg", - ["game_rule"] = "弃牌阶段", + ["game_rule"] = "游戏规则", ["replace_equip"] = "替换装备", ["#EquipmentChoice"] = "%arg", ["#GameRuleReplaceEquipment"] = "请选择要置入的区域", diff --git a/standard_cards/i18n/zh_CN.lua b/standard_cards/i18n/zh_CN.lua index 39d9045..39f9a43 100644 --- a/standard_cards/i18n/zh_CN.lua +++ b/standard_cards/i18n/zh_CN.lua @@ -26,10 +26,12 @@ Fk:loadTranslationTable{ ["basic_char"] = "基", ["trick_char"] = "锦", ["equip_char"] = "装", + ["non_basic_char"] = "非基", ["basic"] = "基本牌", ["trick"] = "锦囊牌", ["equip"] = "装备牌", + ["non_basic"] = "非基本牌", ["weapon"] = "武器牌", ["armor"] = "防具牌", ["defensive_horse"] = "防御坐骑牌", -- Gitee