优化一版战斗结构

This commit is contained in:
xiekaidong 2023-06-12 15:30:00 +08:00
parent 5be91b491c
commit 1c46acc425
3 changed files with 28 additions and 11 deletions

View File

@ -46,14 +46,6 @@ function BattleController:getInitBoard()
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
end
end
if config.mystery_box and config.mystery_box_reward then
for i, index in ipairs(config.mystery_box) do
if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then
self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i]
end
end
end
end
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap

View File

@ -1,5 +1,3 @@
local BattleHelper = require "app/module/battle/helper/battle_helper"
local BattleController = require "app/module/battle/controller/battle_controller"
local BattleControllerStage = class("BattleControllerStage", BattleController)
@ -15,6 +13,34 @@ function BattleControllerStage:getChapterId()
return DataManager.ChapterData:getChapterId()
end
function BattleControllerStage:getInitBoard()
if not self.boradList then
self.boradList = {}
self.fixedRandomGrid = {}
self.mysteryBoxIndexMap = {}
local config = self:getChapterConfig()[self.chapterId]
local boardCfg = self:getBoardConfig()
for _, boardId in ipairs(config.board) do
local cfg = boardCfg[boardId]
if cfg then
table.insert(self.boradList, {board = GFunc.getTable(cfg.board), mysteryBoard = GFunc.getTable(cfg.mystery_box_board)})
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
end
end
if config.mystery_box and config.mystery_box_reward then
for i, index in ipairs(config.mystery_box) do
if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then
self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i]
end
end
end
end
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
end
function BattleControllerStage:getFixedRogueSkill()
if not self.fixedRogueSkill then
local config = ConfigManager:getConfig("chapter")[self.chapterId]

View File

@ -58,7 +58,6 @@ function DungeonDifficultyUI:onLoadRootComplete()
end)
self.btnStart:addClickListener(function()
-- 开始挑战
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD)
end)
self.btnSweep:addClickListener(function()
-- 开始扫荡