diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 67fb695b..6952e393 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -226,7 +226,6 @@ function BattleController:enterNextWave() return end - Logger.logHighlight("self.maxWaveIndex " .. self.maxWaveIndex) if self.waveIndex >= self.maxWaveIndex then self.victory = true self:battleEnd() @@ -281,7 +280,11 @@ function BattleController:enterAtkStepOver() local defTeam = self.battleData:getDefTeam() if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 - self:enterRefreshBoard() + if self.waveIndex >= self.maxWaveIndex() then + self:enterRoundEnd() + else + self:enterRefreshBoard() + end return end @@ -312,7 +315,11 @@ function BattleController:enterDefStepOver() local defTeam = self.battleData:getDefTeam() if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 - self:enterRefreshBoard() + if self.waveIndex >= self.maxWaveIndex() then + self:enterRoundEnd() + else + self:enterRefreshBoard() + end return end @@ -624,9 +631,10 @@ function BattleController:fillBoard() end function BattleController:onFillBoardOver() - self:generateSkill() - self.battleUI:refreshSkill() - self:enterRoundEnd() + self:generateSkill(function() + self.battleUI:refreshSkill() + self:enterRoundEnd() + end) end function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap) @@ -766,20 +774,37 @@ function BattleController:popBoardCacheSkill(callback) end end -function BattleController:generateSkill() +function BattleController:generateSkill(callback) local map = {} for _, skillEntity in pairs(self.battleData:getSkillEntities()) do if skillEntity:getEnergyEnough() then - map[skillEntity:getPosition()] = skillEntity:getSkillId() + local list = self:getSkillElementList(skillEntity:getPosition(), 1, true) + if list[1] then + map[skillEntity:getPosition()] = + { + skillId = skillEntity:getSkillId(), + posId = list[1] + } + end end end - for elementType, skillId in pairs(map) do - local list = self:getSkillElementList(elementType, 1, true) - for _, posId in ipairs(list) do - self:setGridSkillId(posId, skillId) + if not self.battleUI then + if callback then + callback() end + return end + + self.battleUI:generateSkillAni(map, function() + for elementType, info in pairs(map) do + self:setGridSkillId(info.posId, info.skillId) + end + + if callback then + callback() + end + end) end function BattleController:setGridSkillId(posId, skillId) diff --git a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua index 327c587b..9de53445 100644 --- a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua @@ -183,6 +183,34 @@ local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleControlle end end +local _addSkillGeneralAttackEffect = function(skillInfo, battleData, battleController) + local elementType = skillInfo.skill_position + if not elementType or not skillInfo.effect then + return + end + + local entity = battleData:getSkillEntityByElement(elementType) + if entity then + for _, effect in ipairs(skillInfo.effect) do + entity:addGeneralAttackEffect(effect) + end + end +end + +local _addSkillElementCountEffect = function(skillInfo, battleData, battleController) + local elementType = skillInfo.skill_position + if not elementType or not skillInfo.effect then + return + end + + local entity = battleData:getSkillEntityByElement(elementType) + if entity then + for _, effect in ipairs(skillInfo.effect) do + entity:addElementCountEffect(effect) + end + end +end + BattleRogueSkillHandle._effectOn = { [1] = _changeBaseSkill, -- 改变初始技能ID [2] = _addEliminationRange, -- 增加消除数量 @@ -195,6 +223,8 @@ BattleRogueSkillHandle._effectOn = { [9] = _addSkillEffect, -- 获得技能效果 [10] = _changeElementType, -- 将场上随机几个元素变为某元素 [11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害 + [12] = _addSkillGeneralAttackEffect, -- 技能链接中的每一个元素,都触发的技能效果 + [11] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果 } function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController) diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index 8684906a..823d9ce6 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -13,7 +13,7 @@ function ChapterManager:openBox(chapterId, index) if result.status == 0 then GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.CHAPTER_BOX) GFunc.showRewardBox(result.rewards) - DataManager.ChapterData:init(result.chapterData) + DataManager.ChapterData:init(result.chapterData, true) DataManager.ChapterData:setDirty() end end) @@ -48,7 +48,7 @@ function ChapterManager:endFight(id, combatReport) if result.status == 0 then GFunc.addRewards(result.rewards, BIReport.ITEM_GET_TYPE.FIGHT_END) ModuleManager.BattleManager:showBattleResultUI(result.rewards, combatReport) - DataManager.ChapterData:init(result.chapterData) + DataManager.ChapterData:init(result.chapterData, true) DataManager.ChapterData:setDirty() end end) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index dc5e84a7..41b2a72a 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -32,6 +32,7 @@ function BattleUI:_display() self:initBattlefield() self:initNumberNode() self:initHpNode() + self:hideGenerateSkillGridCells() end function BattleUI:_addListeners() @@ -254,6 +255,62 @@ function BattleUI:eliminationAni(sequence, callback) end) end +function BattleUI:generateSkillAni(map, callback) + if table.nums(map) <= 0 then + if callback then + callback() + end + return + end + + self:hideGenerateSkillGridCells() + if self.generateSkillAniSeq then + self.generateSkillAniSeq:Kill() + self.generateSkillAniSeq = nil + end + + self.generateSkillAniSeq = self.root:createBindTweenSequence() + for elementType, info in pairs(map) do + local entity = self.generateSkillGridEntities[elementType] + if entity and entity:getCell() then + entity:setSkilId(info.skillId) + local cell = entity:getCell() + cell:refresh(entity) + self.generateSkillAniSeq:AppendCallback(function() + local pos = self:getElementSkillPos(elementType) + cell:getBaseObject():setAnchoredPosition(pos.x, pos.y) + end) + local pos = ModuleManager.BattleManager:getPosInfo(info.posId) + self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5)) + end + end + self.generateSkillAniSeq:AppendCallback(function() + if callback then + callback() + end + self:hideGenerateSkillGridCells() + end) +end + +function BattleUI:hideGenerateSkillGridCells() + if not self.generateSkillGridEntities then + local uiMap = self.root:genAllChildren() + self.generateSkillGridEntities = {} + for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do + local cell = CellManager:addCellComp(uiMap["battle_ui.bg_2.board_node.ani_node.grid_cell_" .. elementType], GRID_CELL) + local entity = DataManager.BattleData:getNewGridEntity() + entity:setCell(cell) + self.generateSkillGridEntities[elementType] = entity + end + end + + for _, entity in pairs(self.generateSkillGridEntities) do + if entity:getCell() then + entity:getCell():getBaseObject():setAnchoredPositionX(DEFAULT_X) + end + end +end + function BattleUI:fallGrid(listInfo, callback) self:showMask(false) self.fallAniCount = 0 diff --git a/lua/app/ui/hero/cell/hero_list_cell.lua b/lua/app/ui/hero/cell/hero_list_cell.lua index ac1976a9..b86ea7fa 100644 --- a/lua/app/ui/hero/cell/hero_list_cell.lua +++ b/lua/app/ui/hero/cell/hero_list_cell.lua @@ -37,7 +37,7 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act end local heroStartIndex = (index-1)*4 + 1 if heroStartIndex > activeCount then - heroStartIndex = heroStartIndex - activeCount%4 + heroStartIndex = heroStartIndex - (4 - activeCount%4) end local heroIndex = heroStartIndex for i = 1, 4 do diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua index 26b405c2..a89db857 100644 --- a/lua/app/ui/hero/hero_comp.lua +++ b/lua/app/ui/hero/hero_comp.lua @@ -40,6 +40,18 @@ function HeroComp:init() self.content:addClickListener(function() self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) end) + + for index, obj in ipairs(self.heroNodeList) do + obj:addClickListener(function() + local heroId = self.stageFormation[index] + if heroId then + local hero = DataManager.HeroData:getHeroById(heroId) + if hero then + ModuleManager.HeroManager:showHeroDetailUI(heroId) + end + end + end) + end end function HeroComp:refresh() 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 d83837e8..471a5e23 100644 --- a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua @@ -6,6 +6,8 @@ function BattleBoardSkillEnity:ctor(skillId) self.addRange = {} self.linkAtkp = 0 self.inInfluenceAtkp = 0 + self.generalAttackEffect = {} + self.elementCountEffect = {} end function BattleBoardSkillEnity:refreshSkillId(skillId) @@ -167,4 +169,28 @@ function BattleBoardSkillEnity:addInInfluenceAtkp(atkp) self.inInfluenceAtkp = self.inInfluenceAtkp + atkp end +function BattleBoardSkillEnity:addGeneralAttackEffect(effect) + if not self.generalAttackEffect[effect.type] then + self.generalAttackEffect[effect.type] = GFunc.getTable(effect) + else + self.generalAttackEffect[effect.type].num = self.generalAttackEffect[effect.type].numn + effect.num + end +end + +function BattleBoardSkillEnity:getGeneralAttackEffect() + return self.generalAttackEffect +end + +function BattleBoardSkillEnity:addElementCountEffect(effect) + if not self.elementCountEffect[effect.type] then + self.elementCountEffect[effect.type] = GFunc.getTable(effect) + else + self.elementCountEffect[effect.type].num = self.elementCountEffect[effect.type].numn + effect.num + end +end + +function BattleBoardSkillEnity:getElementCountEffect() + return self.elementCountEffect +end + return BattleBoardSkillEnity \ No newline at end of file diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index 1ba577e0..ed4934be 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -17,8 +17,10 @@ function ChapterData:clear() self.data.chapterFightInfo = {} end -function ChapterData:init(data) - self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID +function ChapterData:init(data, notChangeChapterId) + if not notChangeChapterId then + self.data.chapterId = data and data.chapterId or MIN_CHAPTER_ID + end self.data.maxChapterId = data and data.maxChapterId or self.data.chapterId - 1 self.data.chapterBoxInfo = data and data.chapterBoxInfo or {} self.data.chapterFightInfo = data and data.chapterFightInfo or {}