pvp战斗取消元素随机加权
This commit is contained in:
parent
59d4dfdc61
commit
37f93d1cd1
@ -320,4 +320,37 @@ function BattleControllerPVP:refreshWave()
|
|||||||
self.battleUI:refreshWave(self.waveRoundCount[self:getWaveIndex()] or 0)
|
self.battleUI:refreshWave(self.waveRoundCount[self:getWaveIndex()] or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleControllerPVP: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 = BattleConst.ELEMENT_WIGHT -- 改为平等权重
|
||||||
|
if self.elementWeightMap and self.elementWeightMap[typeNum] then
|
||||||
|
weight = weight + self.elementWeightMap[typeNum]
|
||||||
|
end
|
||||||
|
if weight > BattleConst.MAX_ELEMENT_WIGHT then
|
||||||
|
weight = BattleConst.MAX_ELEMENT_WIGHT
|
||||||
|
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
|
||||||
|
|
||||||
return BattleControllerPVP
|
return BattleControllerPVP
|
||||||
Loading…
x
Reference in New Issue
Block a user