From bfd33de587a2add46754097fe37d278c6afdbf1f Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Wed, 15 Jan 2020 11:03:53 +0800 Subject: [PATCH] 队长技 --- src/actions/AdvAction.lua | 12 ++++++++++++ src/adv/AdvBattle.lua | 13 ++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index f252f7c..6a83b7c 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -37,7 +37,10 @@ local function checkFormat(role, format, checkAdvTeam) end if not format.leader then return end + if format.leader2 == format.leader then return end local hadLeader = false + local hadLeader2 = false + local heroCount = 0 for slot, heroId in pairs(format.heros) do if not role.heros[heroId] or hadHero[heroId] then return @@ -45,6 +48,13 @@ local function checkFormat(role, format, checkAdvTeam) if heroId == format.leader then hadLeader = true end + if heroId == format.leader2 then + hadLeader2 = true + end + heroCount = heroCount + 1 + end + if not hadLeader2 and heroCount >= 2 then + return end if not hadLeader then return end return true @@ -104,6 +114,7 @@ function _M.startAdvRpc( agent, data ) advTeam.heros[slot] = heroId end advTeam.leader = format.leader + advTeam.leader2 = format.leader2 role:updateProperty({field = "advTeam", value = advTeam}) if AdvCommon.isEndless(chapterId) then role.dailyData:updateProperty({field = "advElC", delta = 1}) @@ -148,6 +159,7 @@ function _M.startHangRpc(agent, data) local info = {} info.format = {} info.format.leader = format.leader + info.format.leader2 = format.leader2 info.format.heros = {} for slot, heroId in pairs(format.heros) do info.format.heros[slot] = heroId diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 8a82c35..516a3ed 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -38,6 +38,7 @@ end function Battle:initPlayer() local advTeam = self.adv.owner:getProperty("advTeam") if not next(advTeam.heros) then return end + local leaderPassive = {} local player = advTeam.player if not player then player = {} @@ -48,11 +49,13 @@ function Battle:initPlayer() player.passives = {} for slot, heroId in pairs(advTeam.heros) do - local hero = self.adv.owner.heros[heroId] - if hero then - local advSkillId = csvdb["unitCsv"][self.adv.owner.heros[heroId]:getProperty("type")]["adv"] - if advSkillId > 1000 then - table.insert(player.passives, {id = advSkillId, level = hero:getSkillLevel(4)}) + if heroId == advTeam.leader or heroId == advTeam.leader2 then + local hero = self.adv.owner.heros[heroId] + if hero then + local unit = csvdb["unitCsv"][self.adv.owner.heros[heroId]:getProperty("type")] + if unit.advCaptain ~= 0 then + table.insert(player.passives, {id = unit.advCaptain, level = 1}) + end end end end -- libgit2 0.21.2