Commit c3d5fe54a439ce6e84daae41fa11e810016bfa24

Authored by zhouhaihai
1 parent 09be9059

无战斗状态挂机清掉战斗队伍

Showing 1 changed file with 9 additions and 5 deletions   Show diff stats
src/actions/AdvAction.lua
... ... @@ -17,7 +17,7 @@ local table_unpack = table.unpack
17 17 local _M = {}
18 18  
19 19  
20   -local function checkFormat(role, format, isHang)
  20 +local function checkFormat(role, format, checkAdvTeam)
21 21 local advHang = role:getProperty("advHang")
22 22 local hadHero = {}
23 23 for chapterId, info in pairs(advHang) do
... ... @@ -28,7 +28,7 @@ local function checkFormat(role, format, isHang)
28 28 end
29 29 end
30 30  
31   - if isHang then
  31 + if checkAdvTeam then
32 32 for _, heroId in pairs(role:getProperty("advTeam").heros or {}) do
33 33 hadHero[heroId] = true
34 34 end
... ... @@ -82,8 +82,7 @@ function _M.startAdvRpc( agent, data )
82 82 if not checkFormat(role, format) then return end
83 83  
84 84 --上一个关卡结束才可以开始新的关卡
85   - local advInfo = role:getProperty("advInfo")
86   - if next(advInfo) then return end
  85 + if next(role:getProperty("advInfo")) then return end
87 86  
88 87 local advTeam = role:getProperty("advTeam")
89 88 table.clear(advTeam)
... ... @@ -121,7 +120,7 @@ function _M.startHangRpc(agent, data)
121 120  
122 121 if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return end -- 是否有体力
123 122  
124   - if not checkFormat(role, format, true) then return end --编队是否正确
  123 + if not checkFormat(role, format, next(role:getProperty("advInfo"))) then return end --编队是否正确
125 124  
126 125 local battleV = 0
127 126 for _, heroId in pairs(format.heros) do
... ... @@ -139,6 +138,11 @@ function _M.startHangRpc(agent, data)
139 138 end
140 139 info.time = skynet.timex() + chapterData.idleTime --挂机时间
141 140  
  141 + -- 没有在战斗 用team来挂机了 把team清掉
  142 + if not next(role:getProperty("advInfo")) then
  143 + role:updateProperty({field = "advTeam", value = {}})
  144 + end
  145 +
142 146 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
143 147  
144 148 role.dailyData:updateProperty({field = "advC", delta = 1})
... ...