战斗rogue技能接入上阵

This commit is contained in:
xiekaidong 2023-04-13 21:30:07 +08:00
parent d1b80d3527
commit 0d2e914210
2 changed files with 36 additions and 16 deletions

View File

@ -10,26 +10,32 @@ local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_bora
local ATTR_TYPE = GConst.ATTR_TYPE
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
function BattleData:init(skillIds, skillPool)
function BattleData:init()
self:clear()
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
self:initRogueSkills()
end
--- todo
skillIds = {
10, 21, 30, 40, 50
}
for _, skillId in ipairs(skillIds) do
local cfg = SKILL_HERO_CFG[skillId]
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
end
---- skillPool
self.skillPool = skillPool or {}
for id, info in pairs(ConfigManager:getConfig("skill_rogue")) do
if not info.universal then
table.insert(self.skillPool, id)
function BattleData:initRogueSkills()
self.skillPool = {}
self.skillMap = {}
local skillmap = {}
local formation = DataManager.FormationData:getStageFormation()
for matchType, heroId in pairs(formation) do
if heroId > 0 then
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if heroEntity then
local skillId = heroEntity:getActiveSkill()
local cfg = SKILL_HERO_CFG[skillId]
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
for _, id in ipairs(heroEntity:getActiveTogueSkills()) do
if not skillmap[id] then
table.insert(self.skillPool, id)
skillmap[id] = true
end
end
end
end
end
end

View File

@ -209,4 +209,18 @@ function HeroEntity:getRogueSkillList()
return self.rogueSkillList
end
function HeroEntity:getActiveTogueSkills()
local list = {}
for i = 1, self:getActiveRogueCount() do
local id = self:getRogueSkillList()[i]
if id then
table.insert(list, id)
else
return
end
end
return list
end
return HeroEntity