boss_rush战斗

This commit is contained in:
xiekaidong 2023-09-01 10:23:48 +08:00
parent 049d7508ea
commit b6b342c435
4 changed files with 111 additions and 11 deletions

View File

@ -153,9 +153,19 @@ function BattleBaseController:getMinEliminationCount()
return self.minEliminationCount return self.minEliminationCount
end end
function BattleBaseController:generateNextMonster() function BattleBaseController:getNextMonsterId(waveIndex)
waveIndex = waveIndex or self.waveIndex + 1
local config = self:getChapterConfig()[self.chapterId] 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 if monsterId == nil then
return self:enterNextWave() return self:enterNextWave()
end end
@ -185,7 +195,7 @@ function BattleBaseController:generateNextMonster()
isBoss = self.defTeam:getIsBoss() isBoss = self.defTeam:getIsBoss()
if isBoss then if isBoss then
local monsterInfo = ConfigManager:getConfig("monster")[monsterId] 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) monsterComp:playEnterBattlefield(true, onFinish)
end) end)
else else
@ -204,7 +214,7 @@ function BattleBaseController:generateNextMonster()
isBoss = self.defTeam:getIsBoss() isBoss = self.defTeam:getIsBoss()
if isBoss then if isBoss then
local monsterInfo = ConfigManager:getConfig("monster")[monsterId] 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) monsterComp:playEnterBattlefield(false, onFinish)
end) end)
else else
@ -700,7 +710,8 @@ function BattleBaseController:initDefUnits(callback)
if self.waveIndex <= 0 then if self.waveIndex <= 0 then
initIndex = 1 initIndex = 1
end 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() local modelId = unitEntity:getModelId()
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
local monsterComp = spineObject:addLuaComponent(BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) local monsterComp = spineObject:addLuaComponent(BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT)

View File

@ -1,6 +1,7 @@
local BattleController = require "app/module/battle/controller/battle_controller" local BattleController = require "app/module/battle/controller/battle_controller"
local BattleControllerBossRush = class("BattleControllerBossRush", BattleController) local BattleControllerBossRush = class("BattleControllerBossRush", BattleController)
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
local SIDE_ATK = GConst.BattleConst.SIDE_ATK
function BattleControllerBossRush:getBoardConfig() function BattleControllerBossRush:getBoardConfig()
return ConfigManager:getConfig("chapter_board_bossrush") return ConfigManager:getConfig("chapter_board_bossrush")
@ -20,7 +21,7 @@ function BattleControllerBossRush:getChessBoardBgName()
end end
function BattleControllerBossRush:getScene() function BattleControllerBossRush:getScene()
return "bg_1" return "boss_rush"
end end
function BattleControllerBossRush:getChapterId() function BattleControllerBossRush:getChapterId()
@ -28,7 +29,8 @@ function BattleControllerBossRush:getChapterId()
end end
function BattleControllerBossRush:getMaxWave() function BattleControllerBossRush:getMaxWave()
return ConfigManager:getConfigNum("activity_boss_rush_chapter") * 5 -- 每次5波一共770 self:getInitBoard()
return #self.monsterList
end end
function BattleControllerBossRush:getInitBoard() function BattleControllerBossRush:getInitBoard()
@ -36,19 +38,96 @@ function BattleControllerBossRush:getInitBoard()
self.boradList = {} self.boradList = {}
self.fixedRandomGrid = {} self.fixedRandomGrid = {}
self.mysteryBoxIndexMap = {} self.mysteryBoxIndexMap = {}
self.monsterList = {}
local boardCfg = self:getBoardConfig() local boardCfg = self:getBoardConfig()
for id, info in ipairs(self:getChapterConfig()) do 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] local cfg = boardCfg[info.board_id]
if cfg then if cfg then
table.insert(self.boradList, {board = GFunc.getTable(cfg.board), gridEdge = GFunc.getTable(cfg.grid_edge)}) table.insert(self.boradList, {board = GFunc.getTable(cfg.board), gridEdge = GFunc.getTable(cfg.grid_edge)})
end end
end end
end end
end
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
end 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() function BattleControllerBossRush:controllBattleEnd()
-- self.combatReport = { -- self.combatReport = {
-- battleType = GConst.BattleConst.BATTLE_TYPE.ACT_BOSS_RUSH, -- battleType = GConst.BattleConst.BATTLE_TYPE.ACT_BOSS_RUSH,

View File

@ -140,6 +140,11 @@ function ActBossRushData:getIsFirstDay()
end end
---- 战斗 ---- 战斗
function ActBossRushData:getStageList()
return self.stageList
end
function ActBossRushData:getTodayMaxWave() function ActBossRushData:getTodayMaxWave()
return self.todayMaxWave or 0 return self.todayMaxWave or 0
end end

View File

@ -690,6 +690,11 @@ function BattleBaseData:useAddlvCount()
return true return true
end end
function BattleBaseData:addBattleLvCount(count)
self.addLvCount = self.addLvCount + count
self.battleLv = self.battleLv + count
end
function BattleBaseData:addCommonSelectSkillCount(count) function BattleBaseData:addCommonSelectSkillCount(count)
self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1) self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1)
end end