diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 66de2031..9088b537 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -680,6 +680,7 @@ function BattleBaseController:prepareFight() self:initDefUnits(onPreloadFinished) self.battleUI:refreshChessBoard(self:getChessBoardBgName()) self.battleUI:loadBg(self:getScene()) + self.battleData:initAllRogueSkills() end) BattleHelper:setBaseOrder(self.battleUI:getUIOrder()) BattleHelper:setBattleData(self.battleData) @@ -2368,10 +2369,10 @@ function BattleBaseController:dealSelectSkill(skillId, value, side, isSnapshot) end function BattleBaseController:onSelectSkill(skillId, value, pos, side) - if not self.canChoseSkillCount or self.canChoseSkillCount <= 0 then - return - end - self.canChoseSkillCount = self.canChoseSkillCount - 1 + -- if not self.canChoseSkillCount or self.canChoseSkillCount <= 0 then + -- return + -- end + -- self.canChoseSkillCount = self.canChoseSkillCount - 1 side = side or self:getCurActionSide() self:dealSelectSkill(skillId, value, side) @@ -2389,6 +2390,10 @@ function BattleBaseController:onSelectSkill(skillId, value, pos, side) end end + if not self.battleUI then + return + end + self:selectSKillNextToStep() self.battleUI:showCommonSkillTips(skillId) @@ -2402,7 +2407,6 @@ function BattleBaseController:selectSKillNextToStep() end end - function BattleBaseController:changeElementType(count, elementType, side) self.changeElementTypeMap = table.clearOrCreate(self.changeElementTypeMap) self.changeElementTypeList = table.clearOrCreate(self.changeElementTypeList) diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index 26880d8d..1ac1f6d9 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -54,8 +54,8 @@ function BattleBaseData:init(params, snapInfo) BattleSkillEntity.sid = 0 self.atkTeam = self:initTeam(SIDE_ATK, params.atkFormation) self.defTeam = self:initTeam(SIDE_DEF, params.defFormation) - -- self:initRogueSkills(SIDE_ATK, params.atkFormation) - -- self:initRogueSkills(SIDE_DEF, params.defFormation) + self:initRogueSkills(SIDE_ATK, params.atkFormation) + self:initRogueSkills(SIDE_DEF, params.defFormation) self.atkFormation = params.atkFormation or {} self.defFormation = params.defFormation or {} self:setMaxBattleLv(nil) @@ -148,32 +148,38 @@ function BattleBaseData:setTimeSpeed(timeSpeed, timeScale) self.data.timeSpeed = timeSpeed end --- function BattleBaseData:initRogueSkills(side, formation) --- self.skillPool = self.skillPool or {} --- self.skillMap = self.skillMap or {} --- self.skillPool[side] = self.skillPool[side] or {} --- self.skillMap[side] = self.skillMap[side] or {} --- if not formation then --- return --- end --- local skillmap = {} --- for matchType, heroEntity in pairs(formation) do --- local skillId = heroEntity:getBaseSkill() --- local cfg = SKILL_CFG[skillId] --- self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side) --- self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList()) --- self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId()) --- for _, id in ipairs(heroEntity:getActiveRogueSkills()) do --- if not skillmap[id] then --- if not self.skillPool[side][cfg.position] then --- self.skillPool[side][cfg.position] = {} --- end --- table.insert(self.skillPool[side][cfg.position], id) --- skillmap[id] = true --- end --- end --- end --- end +function BattleBaseData:initAllRogueSkills() + self.atkTeam:initRougeSkills() + self.defTeam:initRougeSkills() +end + +function BattleBaseData:initRogueSkills(side, formation) + self.skillPool = self.skillPool or {} + self.skillMap = self.skillMap or {} + self.skillPool[side] = self.skillPool[side] or {} + self.skillMap[side] = self.skillMap[side] or {} + if not formation then + return + end + local skillmap = {} + for matchType, heroEntity in pairs(formation) do + local skillId = heroEntity:getBaseSkill() + local cfg = SKILL_CFG[skillId] + self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side) + -- self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList()) + -- self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId()) + -- for _, id in ipairs(heroEntity:getActiveRogueSkills()) do + -- if not skillmap[id] then + -- if not self.skillPool[side][cfg.position] then + -- self.skillPool[side][cfg.position] = {} + -- end + -- table.insert(self.skillPool[side][cfg.position], id) + -- skillmap[id] = true + -- end + -- end + end + Logger.logHighlight("===========") +end function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot) local r = 1 diff --git a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua index 79781100..22b0eff4 100644 --- a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua @@ -34,7 +34,8 @@ function BattleBoardSkillEntity:getSkillId() end function BattleBoardSkillEntity:getUnlocked() - return self.unlocked + -- return self.unlocked + return true end function BattleBoardSkillEntity:setUnlock() diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 67ba561a..4305674f 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -495,4 +495,12 @@ function BattleTeamEntity:getIsDead() return self.isDead end +--@region 自带rouge +function BattleTeamEntity:initRougeSkills() + for k,v in pairs(self.members) do + v:initRougeSkills() + end +end +--@endregion + return BattleTeamEntity \ No newline at end of file diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index 705b16a8..f37ec1af 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -52,12 +52,6 @@ function BattleUnitEntity:initSkill() table.insert(self.passiveSkills, skill) end end - - if self.unitData.rougeSkills then - for i,v in ipairs(self.unitData.rougeSkills) do - ModuleManager.BattleManager:onSelectSkill(v) - end - end end function BattleUnitEntity:getIsBoss() @@ -68,6 +62,19 @@ function BattleUnitEntity:getId() return self.unitData.id end +function BattleUnitEntity:initRougeSkills() + if self.unitData.rougeSkills then + local SKILL_ICON_POS = { + {x =-240, y= 165}, + {x =-240, y= 0}, + {x =-240, y= -165} + } + for i,v in ipairs(self.unitData.rougeSkills) do + ModuleManager.BattleManager:onSelectSkill(v, nil, SKILL_ICON_POS[i]) + end + end +end + function BattleUnitEntity:addSkill(skillId) local skillInfo = ConfigManager:getConfig("skill")[skillId] if skillInfo == nil then