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)