From 4d79d3ea6c4a800c4b5785c6a8b71d2150b96d2a Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 4 Sep 2023 16:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=A4=A7=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle_controller_boss_rush.lua | 19 ++++++++++--------- lua/app/userdata/battle/battle_base_data.lua | 11 +++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) 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 f983e25a..2bfb4c63 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 SIDE_ATK = GConst.BattleConst.SIDE_ATK +local MAX_LV = 61 function BattleControllerBossRush:getBoardConfig() return ConfigManager:getConfig("chapter_board_bossrush") @@ -84,6 +85,7 @@ end function BattleControllerBossRush:initOther() self.monsterAtkAddition = GFunc.getConstIntValue("activity_boss_rush_hp_add") self.monsterHpAddition = GFunc.getConstIntValue("activity_boss_rush_atk_add") + self:setMaxBattleLv(MAX_LV) end -- 怪物攻击力加成 @@ -108,15 +110,6 @@ function BattleControllerBossRush:getMonsterHpAddition() end end -function BattleControllerBossRush:enterNextWave(...) - local waveIndex = self:getWaveIndex() - if waveIndex >= 1 and waveIndex <= 60 then - self.battleData:addBattleLvCount(1) - self.battleUI:refreshLv() - end - BattleController.enterNextWave(self, ...) -end - function BattleControllerBossRush:getNextMonsterId(waveIndex) self:getInitBoard() waveIndex = waveIndex or self:getWaveIndex() + 1 @@ -129,6 +122,14 @@ function BattleControllerBossRush:showBossEnterAni(bornTime, bossName, monsterCo end end +function BattleControllerBossRush:addBattleExp(...) + if self.battleData:getBattleLv() >= MAX_LV then -- 只能升级60次 + return + end + + BattleController.addBattleExp(self, ...) +end + function BattleControllerBossRush:controllBattleEnd() self.combatReport = { battleType = GConst.BattleConst.BATTLE_TYPE.ACT_BOSS_RUSH, diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index 4c2ce471..ae1d0816 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -48,6 +48,7 @@ function BattleBaseData:init(params, snapInfo) self:initRogueSkills(SIDE_DEF, params.defFormation) self.atkFormation = params.atkFormation or {} self.defFormation = params.defFormation or {} + self:setMaxBattleLv(nil) if snapInfo then if snapInfo.cacheSkillList then @@ -670,9 +671,19 @@ function BattleBaseData:getLvNeedExp(lv) return cfg[lv].exp end +function BattleBaseData:setMaxBattleLv(maxLv) + self.maxBattleLv = maxLv +end + function BattleBaseData:addExp(exp) self.curBattleExp = self.curBattleExp + exp while self.curBattleExp >= self.needBattleExp do + if self.maxBattleLv then -- 超过最大等级后跳出 + if self.maxBattleLv <= self.battleLv then + break + end + end + self.curBattleExp = self.curBattleExp - self.needBattleExp self.addLvCount = self.addLvCount + 1 self.battleLv = self.battleLv + 1