From 8bfe087374cdd07fe0587dc0963890846d9ffa0c Mon Sep 17 00:00:00 2001 From: notify Date: Wed, 2 Aug 2023 21:39:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=97=E8=AE=A1=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BB=E5=85=AC=EF=BC=8C=E4=BF=AE=E5=90=8C=E5=90=8D=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/engine.lua | 2 +- lua/server/gamelogic.lua | 37 +++++++++++++++- packages/standard/i18n/en_US.lua | 2 + packages/standard/i18n/zh_CN.lua | 4 +- packages/standard/init.lua | 76 +++++++++++++++++++++++++++++--- 5 files changed, 112 insertions(+), 9 deletions(-) diff --git a/lua/core/engine.lua b/lua/core/engine.lua index a1e09ce9..92573408 100644 --- a/lua/core/engine.lua +++ b/lua/core/engine.lua @@ -244,7 +244,7 @@ end local function canUseGeneral(g) local r = Fk:currentRoom() return not table.contains(r.disabled_packs, Fk.generals[g].package.name) and - not table.contains(r.disabled_generals, g) + not table.contains(r.disabled_generals, g) and not g.hidden and not g.total_hidden end --- 根据武将名称,获取它的同名武将。 diff --git a/lua/server/gamelogic.lua b/lua/server/gamelogic.lua index 6b325e97..b0f2207e 100644 --- a/lua/server/gamelogic.lua +++ b/lua/server/gamelogic.lua @@ -90,7 +90,24 @@ function GameLogic:chooseGenerals() if lord ~= nil then room.current = lord - local generals = Fk:getGeneralsRandomly(generalNum) + local generals = {} + if room.settings.gameMode == "aaa_role_mode" then + for _, general in pairs(Fk:getAllGenerals()) do + if (not general.hidden and not general.total_hidden) and + table.find(general.skills, function(s) + return s.lordSkill + end) and + not table.find(generals, function(g) + return g.trueName == general.trueName + end) then + table.insert(generals, general) + end + end + generals = table.random(generals, 3) + end + table.insertTable(generals, Fk:getGeneralsRandomly(generalNum, Fk:getAllGenerals(), table.map(generals, function (g) + return g.name + end))) for i = 1, #generals do generals[i] = generals[i].name end @@ -105,7 +122,23 @@ function GameLogic:chooseGenerals() end room:setPlayerGeneral(lord, lord_general, true) - room:askForChooseKingdom({lord}) + if lord.kingdom == "god" or Fk.generals[lord_general].subkingdom then + local allKingdoms = {} + if lord.kingdom == "god" then + allKingdoms = table.simpleClone(Fk.kingdoms) + + local exceptedKingdoms = { "god", "qin" } + for _, kingdom in ipairs(exceptedKingdoms) do + table.removeOne(allKingdoms, kingdom) + end + else + local curGeneral = Fk.generals[lord_general] + allKingdoms = { curGeneral.kingdom, curGeneral.subkingdom } + end + + lord.kingdom = room:askForChoice(lord, allKingdoms, "AskForKingdom", "#ChooseInitialKingdom") + room:broadcastProperty(lord, "kingdom") + end room:broadcastProperty(lord, "general") room:setDeputyGeneral(lord, deputy) room:broadcastProperty(lord, "deputyGeneral") diff --git a/packages/standard/i18n/en_US.lua b/packages/standard/i18n/en_US.lua index 5c80ceb6..c70f048a 100644 --- a/packages/standard/i18n/en_US.lua +++ b/packages/standard/i18n/en_US.lua @@ -40,6 +40,8 @@ Fk:loadTranslationTable({ [":tiandu"] = "当你的判定牌生效后,你可以获得之。", ["yiji"] = "Bequeathed Strategy", [":yiji"] = "每当你受到1点伤害后,你可以观看牌堆顶的两张牌并任意分配它们。", + ["yiji_active"] = "Bequeathed Strategy", + ["#yiji-give"] = "Bequeathed Strategy: You may distribute these cards to any players, or click Cancel to reserve", ["zhenji"] = "Zhen Ji", ["luoshen"] = "Goddess Luo", diff --git a/packages/standard/i18n/zh_CN.lua b/packages/standard/i18n/zh_CN.lua index 0cfb6354..11a510c4 100644 --- a/packages/standard/i18n/zh_CN.lua +++ b/packages/standard/i18n/zh_CN.lua @@ -52,7 +52,7 @@ Fk:loadTranslationTable{ ["xuchu"] = "许褚", ["~xuchu"] = "冷,好冷啊……", - ["$luoyi1"] = "脱!", + ["$luoyi1"] = "破!", ["$luoyi2"] = "谁来与我大战三百回合?", ["luoyi"] = "裸衣", [":luoyi"] = "摸牌阶段,你可以少摸一张牌,若如此做,本回合你使用【杀】或【决斗】对目标角色造成伤害时,此伤害+1。", @@ -67,6 +67,8 @@ Fk:loadTranslationTable{ ["$yiji2"] = "罢了。", ["yiji"] = "遗计", [":yiji"] = "每当你受到1点伤害后,你可以观看牌堆顶的两张牌并任意分配它们。", + ["yiji_active"] = "遗计", + ["#yiji-give"] = "遗计:你可以将这些牌分配给任意角色,点“取消”自己保留", ["zhenji"] = "甄姬", ["~zhenji"] = "悼良会之永绝兮,哀一逝而异乡。", diff --git a/packages/standard/init.lua b/packages/standard/init.lua index 650de385..ad20ea53 100644 --- a/packages/standard/init.lua +++ b/packages/standard/init.lua @@ -276,11 +276,80 @@ local yiji = fk.CreateTriggerSkill{ self.cancel_cost = true end, on_use = function(self, event, target, player, data) - -- TODO: yiji logic - player:drawCards(2) + local room = player.room + local ids = room:getNCards(2) + local fakemove = { + toArea = Card.PlayerHand, + to = player.id, + moveInfo = table.map(ids, function(id) return {cardId = id, fromArea = Card.Void} end), + moveReason = fk.ReasonJustMove, + } + room:notifyMoveCards({player}, {fakemove}) + for _, id in ipairs(ids) do + room:setCardMark(Fk:getCardById(id), "yiji", 1) + end + while table.find(ids, function(id) return Fk:getCardById(id):getMark("yiji") > 0 end) do + if not room:askForUseActiveSkill(player, "yiji_active", "#yiji-give", true) then + for _, id in ipairs(ids) do + room:setCardMark(Fk:getCardById(id), "yiji", 0) + end + ids = table.filter(ids, function(id) return room:getCardArea(id) ~= Card.PlayerHand end) + fakemove = { + from = player.id, + toArea = Card.Void, + moveInfo = table.map(ids, function(id) return {cardId = id, fromArea = Card.PlayerHand} end), + moveReason = fk.ReasonGive, + } + room:notifyMoveCards({player}, {fakemove}) + room:moveCards({ + fromArea = Card.Void, + ids = ids, + to = player.id, + toArea = Card.PlayerHand, + moveReason = fk.ReasonGive, + skillName = self.name, + }) + end + end + end, +} +local yiji_active = fk.CreateActiveSkill{ + name = "yiji_active", + mute = true, + min_card_num = 1, + target_num = 1, + card_filter = function(self, to_select, selected, targets) + return Fk:getCardById(to_select):getMark("yiji") > 0 + end, + target_filter = function(self, to_select, selected, selected_cards) + return #selected == 0 + end, + on_use = function(self, room, effect) + local player = room:getPlayerById(effect.from) + local target = room:getPlayerById(effect.tos[1]) + room:doIndicate(player.id, {target.id}) + for _, id in ipairs(effect.cards) do + room:setCardMark(Fk:getCardById(id), "yiji", 0) + end + local fakemove = { + from = player.id, + toArea = Card.Void, + moveInfo = table.map(effect.cards, function(id) return {cardId = id, fromArea = Card.PlayerHand} end), + moveReason = fk.ReasonGive, + } + room:notifyMoveCards({player}, {fakemove}) + room:moveCards({ + fromArea = Card.Void, + ids = effect.cards, + to = target.id, + toArea = Card.PlayerHand, + moveReason = fk.ReasonGive, + skillName = self.name, + }) end, } local guojia = General:new(extension, "guojia", "wei", 3) +Fk:addSkill(yiji_active) guojia:addSkill(tiandu) guojia:addSkill(yiji) @@ -1075,9 +1144,6 @@ local role_mode = fk.CreateGameMode{ name = "aaa_role_mode", -- just to let it at the top of list minPlayer = 2, maxPlayer = 8, - countInFunc = function(self, room) - return #room.players >= 5 - end, surrender_func = function(self, playedTime) local roleCheck = false local roleText = ""