From 24a8020d1e72d452af7677c17752973e98c8f70d Mon Sep 17 00:00:00 2001 From: Nyutanislavsky Date: Thu, 3 Aug 2023 20:34:43 +0800 Subject: [PATCH] bugfix (#240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复旁观进入时的手牌无法查看 2. 修复武将牌上的牌 3. 主公选势力…… --- lua/server/gamelogic.lua | 18 +----------------- lua/server/request.lua | 2 +- lua/server/serverplayer.lua | 5 +++-- packages/standard/aux_skills.lua | 15 +++++++++++---- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/lua/server/gamelogic.lua b/lua/server/gamelogic.lua index b0f2207e..0ebdaead 100644 --- a/lua/server/gamelogic.lua +++ b/lua/server/gamelogic.lua @@ -122,23 +122,7 @@ function GameLogic:chooseGenerals() end room:setPlayerGeneral(lord, lord_general, true) - 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:askForChooseKingdom({lord}) room:broadcastProperty(lord, "general") room:setDeputyGeneral(lord, deputy) room:broadcastProperty(lord, "deputyGeneral") diff --git a/lua/server/request.lua b/lua/server/request.lua index 335d03ee..aa234d9f 100644 --- a/lua/server/request.lua +++ b/lua/server/request.lua @@ -30,7 +30,7 @@ local function tellRoomToObserver(self, player) for _, p in ipairs(self.players) do self:notifyProperty(player, p, "general") self:notifyProperty(player, p, "deputyGeneral") - p:marshal(player) + p:marshal(player, true) end player:doNotify("UpdateDrawPile", #self.draw_pile) diff --git a/lua/server/serverplayer.lua b/lua/server/serverplayer.lua index 3b04fde1..ac8dc28d 100644 --- a/lua/server/serverplayer.lua +++ b/lua/server/serverplayer.lua @@ -180,7 +180,8 @@ function ServerPlayer:waitForReply(timeout) end ---@param player ServerPlayer -function ServerPlayer:marshal(player) +---@param observe boolean|nil +function ServerPlayer:marshal(player, observe) local room = self.room if not room.game_started then -- If game does not starts, that mean we are entering room that @@ -269,7 +270,7 @@ function ServerPlayer:marshal(player) end if #card_moves > 0 then - room:notifyMoveCards({ player }, card_moves) + room:notifyMoveCards({ player }, card_moves, observe and self.seat == 1) end for k, v in pairs(self.mark) do diff --git a/packages/standard/aux_skills.lua b/packages/standard/aux_skills.lua index eafa4838..e125b1da 100644 --- a/packages/standard/aux_skills.lua +++ b/packages/standard/aux_skills.lua @@ -7,8 +7,15 @@ local discardSkill = fk.CreateActiveSkill{ return false end - if Fk:currentRoom():getCardArea(to_select) == Player.Special then - return false + if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then + local pile = "" + for p, t in pairs(Self.special_cards) do + if table.contains(t, to_select) then + pile = p + break + end + end + if not string.find(self.pattern or "", pile) then return false end end local checkpoint = true @@ -50,8 +57,8 @@ local chooseCardsSkill = fk.CreateActiveSkill{ return false end - if Fk:currentRoom():getCardArea(to_select) == Player.Special then - return false + if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then + if not string.find(self.pattern or "", self.expand_pile or "") then return false end end local checkpoint = true