Commit 7efe52757435c83b3d894bc2fb0daf94c133d97f

Authored by zhouhaihai
1 parent 43716efb

检查leader

Showing 1 changed file with 10 additions and 1 deletions   Show diff stats
src/actions/HangAction.lua
@@ -202,6 +202,13 @@ function _M.endBattleRpc(agent, data) @@ -202,6 +202,13 @@ function _M.endBattleRpc(agent, data)
202 return true 202 return true
203 end 203 end
204 204
  205 +local function checkLeader(heros, leader)
  206 + if not leader then return end
  207 + for slot, heroId in pairs(heros) do
  208 + if heroId == leader then return true end
  209 + end
  210 +end
  211 +
205 function _M.roleFormatRpc(agent , data) 212 function _M.roleFormatRpc(agent , data)
206 local role = agent.role 213 local role = agent.role
207 local msg = MsgPack.unpack(data) 214 local msg = MsgPack.unpack(data)
@@ -219,6 +226,7 @@ function _M.roleFormatRpc(agent , data) @@ -219,6 +226,7 @@ function _M.roleFormatRpc(agent , data)
219 if level <= 0 then return end 226 if level <= 0 then return end
220 supports[slot] = support 227 supports[slot] = support
221 end 228 end
  229 + if not checkLeader(hangTeam.heros, hangTeam.leader) then return end
222 230
223 table.clear(hangTeam) 231 table.clear(hangTeam)
224 hangTeam.heros = {} 232 hangTeam.heros = {}
@@ -377,7 +385,8 @@ function _M.bonusFormatRpc(agent , data) @@ -377,7 +385,8 @@ function _M.bonusFormatRpc(agent , data)
377 if level <= 0 then return end 385 if level <= 0 then return end
378 supports[slot] = support 386 supports[slot] = support
379 end 387 end
380 - 388 + if not checkLeader(msg.heros, msg.leader) then return end
  389 +
381 table.clear(bTeam) 390 table.clear(bTeam)
382 bTeam.heros = {} 391 bTeam.heros = {}
383 for slot, heroId in pairs(msg.heros) do 392 for slot, heroId in pairs(msg.heros) do