From 24b8242de8e9d88b53ed4eaee50c5fa6c9cb339e Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 13 Sep 2023 09:19:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle_controller_dungeon_rune.lua | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua index cc6aa5a1..dc15d990 100644 --- a/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua +++ b/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua @@ -230,6 +230,36 @@ function BattleControllerDungeonRune:getInitBoard() return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end +function BattleControllerDungeonRune:getRandomGridInfo() + local list, fixedRandomGrid = self:getInitBoard() + local fixedRandomList = fixedRandomGrid[self.curBoardIndex] + + local gridType = 0 + local elementType + if fixedRandomList and fixedRandomList[1] then + elementType = table.remove(fixedRandomList, 1) + else + local map = self.battleData:getElementTypeMap() + self.getRandomGridInfoIndexs = table.clearOrCreate(self.getRandomGridInfoIndexs) + self.getRandomGridInfoTypeList = table.clearOrCreate(self.getRandomGridInfoTypeList) + for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do + if not self:getSealElementType()[typeNum] and self:getSkillEntityByElement(typeNum) then + local weight = 100 + if self.elementWeightMap and self.elementWeightMap[typeNum] then + weight = weight + self.elementWeightMap[typeNum] + end + table.insert(self.getRandomGridInfoIndexs, weight) + table.insert(self.getRandomGridInfoTypeList, typeNum) + end + end + + local index = GFunc.getRandomIndex(self.getRandomGridInfoIndexs) + elementType = self.getRandomGridInfoTypeList[index] + end + + return {gridType = gridType, elementType = elementType} +end + function BattleControllerDungeonRune:onLoadComplete(...) -- 处理技能 local unlockAllSkill = function(side)