diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index bbf3708..fb4a39b 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -202,6 +202,13 @@ function _M.endBattleRpc(agent, data) return true end +local function checkLeader(heros, leader) + if not leader then return end + for slot, heroId in pairs(heros) do + if heroId == leader then return true end + end +end + function _M.roleFormatRpc(agent , data) local role = agent.role local msg = MsgPack.unpack(data) @@ -219,6 +226,7 @@ function _M.roleFormatRpc(agent , data) if level <= 0 then return end supports[slot] = support end + if not checkLeader(hangTeam.heros, hangTeam.leader) then return end table.clear(hangTeam) hangTeam.heros = {} @@ -377,7 +385,8 @@ function _M.bonusFormatRpc(agent , data) if level <= 0 then return end supports[slot] = support end - + if not checkLeader(msg.heros, msg.leader) then return end + table.clear(bTeam) bTeam.heros = {} for slot, heroId in pairs(msg.heros) do -- libgit2 0.21.2