战斗bug修复

This commit is contained in:
xiekaidong 2023-06-29 21:25:14 +08:00
parent 36526bcd5e
commit 1035873eef
2 changed files with 11 additions and 5 deletions

View File

@ -24,13 +24,18 @@ end
function BoardHelper:findPvpLinkOptimalSolution(battleController, startRow, endRow) function BoardHelper:findPvpLinkOptimalSolution(battleController, startRow, endRow)
local battleData = battleController.battleData local battleData = battleController.battleData
local gridMap = BoardHelper:getEmptyTable() local gridMap = BoardHelper:getEmptyTable()
local minRow = math.min(startRow, endRow) local gridEntities = BoardHelper:getEmptyTable()
local maxRow = math.max(startRow, endRow) local step = 1
for row = minRow, maxRow do -- 遍历所有的可使用格子 if startRow > endRow then
step = -1
end
for row = startRow, endRow, step do -- 遍历所有的可使用格子
for column = 1, BattleConst.COLUMN_COUNT do for column = 1, BattleConst.COLUMN_COUNT do
local posId = ModuleManager.BattleManager:getPosId(row, column) local posId = ModuleManager.BattleManager:getPosId(row, column)
local gridEntity = battleData:getGridEnties()[posId] local gridEntity = battleData:getGridEnties()[posId]
if gridEntity and gridEntity:canLink() then if gridEntity and gridEntity:canLink() then
table.insert(gridEntities, posId)
gridMap[posId] = gridEntity gridMap[posId] = gridEntity
end end
end end
@ -38,7 +43,8 @@ function BoardHelper:findPvpLinkOptimalSolution(battleController, startRow, endR
local maxPath local maxPath
local maxPathCount = 0 local maxPathCount = 0
for posId, entity in pairs(gridMap) do for _, posId in pairs(gridEntities) do
local entity = gridMap[posId]
local mainElementType local mainElementType
if not entity:getSkillId() then if not entity:getSkillId() then
mainElementType = entity:getElementType() mainElementType = entity:getElementType()

View File

@ -234,9 +234,9 @@ end
function BattleBaseUI:enterHideBoardAni(callback) function BattleBaseUI:enterHideBoardAni(callback)
self:clearEnterShowBoardSeq() self:clearEnterShowBoardSeq()
self.enterShowBoardSeq = self.root:createBindTweenSequence() self.enterShowBoardSeq = self.root:createBindTweenSequence()
self.enterShowBoardSeq:AppendInterval(0.5)
local w, h = GFunc.getUIExpandScreenSize() local w, h = GFunc.getUIExpandScreenSize()
self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(w / 2 + 360, 0.5)) self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(w / 2 + 360, 0.5))
self.enterShowBoardSeq:AppendInterval(0.5)
self.enterShowBoardSeq:AppendCallback(function() self.enterShowBoardSeq:AppendCallback(function()
if callback then if callback then
callback() callback()