Commit bfd33de587a2add46754097fe37d278c6afdbf1f

Authored by zhouhaihai
1 parent 8781e103

้˜Ÿ้•ฟๆŠ€

Showing 2 changed files with 20 additions and 5 deletions   Show diff stats
src/actions/AdvAction.lua
... ... @@ -37,7 +37,10 @@ local function checkFormat(role, format, checkAdvTeam)
37 37 end
38 38  
39 39 if not format.leader then return end
  40 + if format.leader2 == format.leader then return end
40 41 local hadLeader = false
  42 + local hadLeader2 = false
  43 + local heroCount = 0
41 44 for slot, heroId in pairs(format.heros) do
42 45 if not role.heros[heroId] or hadHero[heroId] then
43 46 return
... ... @@ -45,6 +48,13 @@ local function checkFormat(role, format, checkAdvTeam)
45 48 if heroId == format.leader then
46 49 hadLeader = true
47 50 end
  51 + if heroId == format.leader2 then
  52 + hadLeader2 = true
  53 + end
  54 + heroCount = heroCount + 1
  55 + end
  56 + if not hadLeader2 and heroCount >= 2 then
  57 + return
48 58 end
49 59 if not hadLeader then return end
50 60 return true
... ... @@ -104,6 +114,7 @@ function _M.startAdvRpc( agent, data )
104 114 advTeam.heros[slot] = heroId
105 115 end
106 116 advTeam.leader = format.leader
  117 + advTeam.leader2 = format.leader2
107 118 role:updateProperty({field = "advTeam", value = advTeam})
108 119 if AdvCommon.isEndless(chapterId) then
109 120 role.dailyData:updateProperty({field = "advElC", delta = 1})
... ... @@ -148,6 +159,7 @@ function _M.startHangRpc(agent, data)
148 159 local info = {}
149 160 info.format = {}
150 161 info.format.leader = format.leader
  162 + info.format.leader2 = format.leader2
151 163 info.format.heros = {}
152 164 for slot, heroId in pairs(format.heros) do
153 165 info.format.heros[slot] = heroId
... ...
src/adv/AdvBattle.lua
... ... @@ -38,6 +38,7 @@ end
38 38 function Battle:initPlayer()
39 39 local advTeam = self.adv.owner:getProperty("advTeam")
40 40 if not next(advTeam.heros) then return end
  41 + local leaderPassive = {}
41 42 local player = advTeam.player
42 43 if not player then
43 44 player = {}
... ... @@ -48,11 +49,13 @@ function Battle:initPlayer()
48 49 player.passives = {}
49 50  
50 51 for slot, heroId in pairs(advTeam.heros) do
51   - local hero = self.adv.owner.heros[heroId]
52   - if hero then
53   - local advSkillId = csvdb["unitCsv"][self.adv.owner.heros[heroId]:getProperty("type")]["adv"]
54   - if advSkillId > 1000 then
55   - table.insert(player.passives, {id = advSkillId, level = hero:getSkillLevel(4)})
  52 + if heroId == advTeam.leader or heroId == advTeam.leader2 then
  53 + local hero = self.adv.owner.heros[heroId]
  54 + if hero then
  55 + local unit = csvdb["unitCsv"][self.adv.owner.heros[heroId]:getProperty("type")]
  56 + if unit.advCaptain ~= 0 then
  57 + table.insert(player.passives, {id = unit.advCaptain, level = 1})
  58 + end
56 59 end
57 60 end
58 61 end
... ...