From b6b342c4351f218d02c01578fdae94ec56a49aaa Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 1 Sep 2023 10:23:48 +0800 Subject: [PATCH] =?UTF-8?q?boss=5Frush=E6=88=98=E6=96=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/battle_base_controller.lua | 21 ++++- .../battle_controller_boss_rush.lua | 91 +++++++++++++++++-- .../act_boss_rush/act_boss_rush_data.lua | 5 + lua/app/userdata/battle/battle_base_data.lua | 5 + 4 files changed, 111 insertions(+), 11 deletions(-) diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index e0ad0760..5845413a 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -153,9 +153,19 @@ function BattleBaseController:getMinEliminationCount() return self.minEliminationCount end -function BattleBaseController:generateNextMonster() +function BattleBaseController:getNextMonsterId(waveIndex) + waveIndex = waveIndex or self.waveIndex + 1 local config = self:getChapterConfig()[self.chapterId] - local monsterId = config.monster[self.waveIndex + 1] + local monsterId = config.monster[waveIndex] + return monsterId +end + +function BattleBaseController:showBossEnterAni(bornTime, bossName, monsterComp, callback) + self.battleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback) +end + +function BattleBaseController:generateNextMonster() + local monsterId = self:getNextMonsterId() if monsterId == nil then return self:enterNextWave() end @@ -185,7 +195,7 @@ function BattleBaseController:generateNextMonster() isBoss = self.defTeam:getIsBoss() if isBoss then local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() monsterComp:playEnterBattlefield(true, onFinish) end) else @@ -204,7 +214,7 @@ function BattleBaseController:generateNextMonster() isBoss = self.defTeam:getIsBoss() if isBoss then local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() monsterComp:playEnterBattlefield(false, onFinish) end) else @@ -700,7 +710,8 @@ function BattleBaseController:initDefUnits(callback) if self.waveIndex <= 0 then initIndex = 1 end - local unitEntity = self.battleData:addMonster(config.monster[initIndex], nil, self) + local monsterId = self:getNextMonsterId(initIndex) + local unitEntity = self.battleData:addMonster(monsterId, nil, self) local modelId = unitEntity:getModelId() BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) local monsterComp = spineObject:addLuaComponent(BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) diff --git a/lua/app/module/battle/controller/battle_controller_boss_rush.lua b/lua/app/module/battle/controller/battle_controller_boss_rush.lua index 5da3a651..9ea108ac 100644 --- a/lua/app/module/battle/controller/battle_controller_boss_rush.lua +++ b/lua/app/module/battle/controller/battle_controller_boss_rush.lua @@ -1,6 +1,7 @@ local BattleController = require "app/module/battle/controller/battle_controller" local BattleControllerBossRush = class("BattleControllerBossRush", BattleController) local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" +local SIDE_ATK = GConst.BattleConst.SIDE_ATK function BattleControllerBossRush:getBoardConfig() return ConfigManager:getConfig("chapter_board_bossrush") @@ -20,7 +21,7 @@ function BattleControllerBossRush:getChessBoardBgName() end function BattleControllerBossRush:getScene() - return "bg_1" + return "boss_rush" end function BattleControllerBossRush:getChapterId() @@ -28,7 +29,8 @@ function BattleControllerBossRush:getChapterId() end function BattleControllerBossRush:getMaxWave() - return ConfigManager:getConfigNum("activity_boss_rush_chapter") * 5 -- 每次5波,一共770 + self:getInitBoard() + return #self.monsterList end function BattleControllerBossRush:getInitBoard() @@ -36,12 +38,19 @@ function BattleControllerBossRush:getInitBoard() self.boradList = {} self.fixedRandomGrid = {} self.mysteryBoxIndexMap = {} + self.monsterList = {} local boardCfg = self:getBoardConfig() - for id, info in ipairs(self:getChapterConfig()) do - local cfg = boardCfg[info.board_id] - if cfg then - table.insert(self.boradList, {board = GFunc.getTable(cfg.board), gridEdge = GFunc.getTable(cfg.grid_edge)}) + for _, id in ipairs(DataManager.ActBossRushData:getStageList()) do + local info = self:getChapterConfig()[id] + if info then + for index, montserId in ipairs(info.monster) do + table.insert(self.monsterList, montserId) + end + local cfg = boardCfg[info.board_id] + if cfg then + table.insert(self.boradList, {board = GFunc.getTable(cfg.board), gridEdge = GFunc.getTable(cfg.grid_edge)}) + end end end end @@ -49,6 +58,76 @@ function BattleControllerBossRush:getInitBoard() return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end +function BattleControllerBossRush:onLoadComplete(...) + -- 处理技能 + local unlockAllSkill = function(side) + local skillPool = self.battleData:getSkillPool(side) + if skillPool then + for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 + if not self.battleData:isUnlockedSkillElementType(elementType, side) then + local skillEntity = self.battleData:getSkillEntityByElement(elementType, side) + if skillEntity then + local skillId = skillEntity:getUnlockId() + if skillId then + self:dealSelectSkill(skillId, nil, side) + end + end + end + end + self.battleUI:refreshSkill(nil, nil, side) + end + end + unlockAllSkill(SIDE_ATK) + + BattleController.onLoadComplete(self, ...) +end + +function BattleControllerBossRush:initOther() + self.monsterAtkAddition = GFunc.getConstIntValue("activity_boss_rush_hp_add") + self.monsterHpAddition = GFunc.getConstIntValue("activity_boss_rush_atk_add") +end + +-- 怪物攻击力加成 +function BattleControllerBossRush:getMonsterAtkAddition() + if not self.lastAtkWaveIndex ~= self.waveIndex then + self.lastAtkWaveIndex = self.waveIndex + return self.monsterAtkAddition * (self.waveIndex + 1) + else + return self.monsterAtkAddition * self.lastAtkWaveIndex + end +end + +-- 怪物血量加成 +function BattleControllerBossRush:getMonsterHpAddition() + if not self.lastHpWaveIndex ~= self.waveIndex then + self.lastHpWaveIndex = self.waveIndex + return self.monsterHpAddition * (self.waveIndex + 1) + else + return self.monsterHpAddition * self.lastHpWaveIndex + end +end + +function BattleControllerBossRush:enterNextWave(...) + if self.waveIndex >= 1 and self.waveIndex <= 60 then + self.battleData:addBattleLvCount(1) + end + BattleController.enterNextWave(self, ...) +end + +function BattleControllerBossRush:getNextMonsterId(waveIndex) + self:getInitBoard() + waveIndex = waveIndex or self.waveIndex + 1 + local config = self:getChapterConfig()[self.chapterId] + local monsterId = config.monster[waveIndex] + return self.monsterList[monsterId] +end + +function BattleControllerBossRush:showBossEnterAni(bornTime, bossName, monsterComp, callback) + if callback then + callback() + end +end + function BattleControllerBossRush:controllBattleEnd() -- self.combatReport = { -- battleType = GConst.BattleConst.BATTLE_TYPE.ACT_BOSS_RUSH, diff --git a/lua/app/userdata/activity/act_boss_rush/act_boss_rush_data.lua b/lua/app/userdata/activity/act_boss_rush/act_boss_rush_data.lua index 63bf8fff..46f47a7f 100644 --- a/lua/app/userdata/activity/act_boss_rush/act_boss_rush_data.lua +++ b/lua/app/userdata/activity/act_boss_rush/act_boss_rush_data.lua @@ -140,6 +140,11 @@ function ActBossRushData:getIsFirstDay() end ---- 战斗 +function ActBossRushData:getStageList() + return self.stageList +end + + function ActBossRushData:getTodayMaxWave() return self.todayMaxWave or 0 end diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index f4b398db..717d2504 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -690,6 +690,11 @@ function BattleBaseData:useAddlvCount() return true end +function BattleBaseData:addBattleLvCount(count) + self.addLvCount = self.addLvCount + count + self.battleLv = self.battleLv + count +end + function BattleBaseData:addCommonSelectSkillCount(count) self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1) end