Commit bfd33de587a2add46754097fe37d278c6afdbf1f
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,7 +37,10 @@ local function checkFormat(role, format, checkAdvTeam) | ||
37 | end | 37 | end |
38 | 38 | ||
39 | if not format.leader then return end | 39 | if not format.leader then return end |
40 | + if format.leader2 == format.leader then return end | ||
40 | local hadLeader = false | 41 | local hadLeader = false |
42 | + local hadLeader2 = false | ||
43 | + local heroCount = 0 | ||
41 | for slot, heroId in pairs(format.heros) do | 44 | for slot, heroId in pairs(format.heros) do |
42 | if not role.heros[heroId] or hadHero[heroId] then | 45 | if not role.heros[heroId] or hadHero[heroId] then |
43 | return | 46 | return |
@@ -45,6 +48,13 @@ local function checkFormat(role, format, checkAdvTeam) | @@ -45,6 +48,13 @@ local function checkFormat(role, format, checkAdvTeam) | ||
45 | if heroId == format.leader then | 48 | if heroId == format.leader then |
46 | hadLeader = true | 49 | hadLeader = true |
47 | end | 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 | end | 58 | end |
49 | if not hadLeader then return end | 59 | if not hadLeader then return end |
50 | return true | 60 | return true |
@@ -104,6 +114,7 @@ function _M.startAdvRpc( agent, data ) | @@ -104,6 +114,7 @@ function _M.startAdvRpc( agent, data ) | ||
104 | advTeam.heros[slot] = heroId | 114 | advTeam.heros[slot] = heroId |
105 | end | 115 | end |
106 | advTeam.leader = format.leader | 116 | advTeam.leader = format.leader |
117 | + advTeam.leader2 = format.leader2 | ||
107 | role:updateProperty({field = "advTeam", value = advTeam}) | 118 | role:updateProperty({field = "advTeam", value = advTeam}) |
108 | if AdvCommon.isEndless(chapterId) then | 119 | if AdvCommon.isEndless(chapterId) then |
109 | role.dailyData:updateProperty({field = "advElC", delta = 1}) | 120 | role.dailyData:updateProperty({field = "advElC", delta = 1}) |
@@ -148,6 +159,7 @@ function _M.startHangRpc(agent, data) | @@ -148,6 +159,7 @@ function _M.startHangRpc(agent, data) | ||
148 | local info = {} | 159 | local info = {} |
149 | info.format = {} | 160 | info.format = {} |
150 | info.format.leader = format.leader | 161 | info.format.leader = format.leader |
162 | + info.format.leader2 = format.leader2 | ||
151 | info.format.heros = {} | 163 | info.format.heros = {} |
152 | for slot, heroId in pairs(format.heros) do | 164 | for slot, heroId in pairs(format.heros) do |
153 | info.format.heros[slot] = heroId | 165 | info.format.heros[slot] = heroId |
src/adv/AdvBattle.lua
@@ -38,6 +38,7 @@ end | @@ -38,6 +38,7 @@ end | ||
38 | function Battle:initPlayer() | 38 | function Battle:initPlayer() |
39 | local advTeam = self.adv.owner:getProperty("advTeam") | 39 | local advTeam = self.adv.owner:getProperty("advTeam") |
40 | if not next(advTeam.heros) then return end | 40 | if not next(advTeam.heros) then return end |
41 | + local leaderPassive = {} | ||
41 | local player = advTeam.player | 42 | local player = advTeam.player |
42 | if not player then | 43 | if not player then |
43 | player = {} | 44 | player = {} |
@@ -48,11 +49,13 @@ function Battle:initPlayer() | @@ -48,11 +49,13 @@ function Battle:initPlayer() | ||
48 | player.passives = {} | 49 | player.passives = {} |
49 | 50 | ||
50 | for slot, heroId in pairs(advTeam.heros) do | 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 | end | 59 | end |
57 | end | 60 | end |
58 | end | 61 | end |