bug修复

This commit is contained in:
xiekaidong 2023-07-04 20:21:23 +08:00
parent faf1e2487d
commit d030ee5988
3 changed files with 34 additions and 31 deletions

View File

@ -638,27 +638,27 @@ BattleConst.UP_DOWN_LEFT_RIGHT = {
[65] = {55, 75, 64, 66}, [65] = {55, 75, 64, 66},
[66] = {56, 76, 65, 67}, [66] = {56, 76, 65, 67},
[67] = {57, 77, 66, }, [67] = {57, 77, 66, },
[71] = {61, 72}, [71] = {61, 81, 72},
[72] = {62, 71, 73}, [72] = {62, 82, 71, 73},
[73] = {63, 72, 74}, [73] = {63, 83, 72, 74},
[74] = {64, 73, 75}, [74] = {64, 84, 73, 75},
[75] = {65, 74, 76}, [75] = {65, 85, 74, 76},
[76] = {66, 75, 77}, [76] = {66, 86, 75, 77},
[77] = {67, 76, }, [77] = {67, 87, 76, },
[81] = {71, 82}, [81] = {71, 91, 82},
[82] = {72, 81, 83}, [82] = {72, 92, 81, 83},
[83] = {73, 82, 84}, [83] = {73, 93, 82, 84},
[84] = {74, 83, 85}, [84] = {74, 94, 83, 85},
[85] = {75, 84, 86}, [85] = {75, 95, 84, 86},
[86] = {76, 85, 87}, [86] = {76, 96, 85, 87},
[87] = {77, 86, }, [87] = {77, 97, 86, },
[91] = {81, 92}, [91] = {81, 101, 92},
[92] = {82, 91, 93}, [92] = {82, 102, 91, 93},
[93] = {83, 92, 94}, [93] = {83, 103, 92, 94},
[94] = {84, 93, 95}, [94] = {84, 104, 93, 95},
[95] = {85, 94, 96}, [95] = {85, 105, 94, 96},
[96] = {86, 95, 97}, [96] = {86, 106, 95, 97},
[97] = {87, 96, }, [97] = {87, 107, 96, },
[101] = {91, 102}, [101] = {91, 102},
[102] = {92, 101, 103}, [102] = {92, 101, 103},
[103] = {93, 102, 104}, [103] = {93, 102, 104},

View File

@ -215,11 +215,11 @@ function BattleManager:getLastLineLastRowPosId(row, column, maxRow)
return self:getPosId(maxRow + row, column) return self:getPosId(maxRow + row, column)
end end
function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow)
local posIdInfos = {} local posIdInfos = {}
local randomExclusion = {} local randomExclusion = {}
for _, info in ipairs(boardrange) do for _, info in ipairs(boardrange) do
local list = self:getAroundPosIds(posId, info.type, info.range, cludePosIdsMap, randomExclusion) local list = self:getAroundPosIds(posId, info.type, info.range, cludePosIdsMap, randomExclusion, maxRow)
for _, info in ipairs(list) do for _, info in ipairs(list) do
table.insert(posIdInfos, info) table.insert(posIdInfos, info)
cludePosIdsMap[info.posId] = nil cludePosIdsMap[info.posId] = nil
@ -230,7 +230,8 @@ function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
return posIdInfos return posIdInfos
end end
function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, randomExclusion) function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, randomExclusion, maxRow)
maxRow = maxRow or BattleConst.ROW_COUNT
local rc = self:getPosRC(posId) local rc = self:getPosRC(posId)
local r = rc.r local r = rc.r
local c = rc.c local c = rc.c
@ -258,7 +259,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap,
end end
elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then
for i = r + 1, r + range do for i = r + 1, r + range do
if i <= BattleConst.ROW_COUNT then if i <= maxRow then
table.insert(posIdList, {posId = self:getPosId(i, c), direction = direction}) table.insert(posIdList, {posId = self:getPosId(i, c), direction = direction})
end end
end end
@ -286,7 +287,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap,
for i = 1, range do for i = 1, range do
local newR = r + i local newR = r + i
local newC = c - i local newC = c - i
if newR <= BattleConst.ROW_COUNT and newC >= 1 then if newR <= maxRow and newC >= 1 then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction}) table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end end
end end
@ -302,7 +303,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap,
for i = 1, range do for i = 1, range do
local newR = r + i local newR = r + i
local newC = c + i local newC = c + i
if newR <= BattleConst.ROW_COUNT and newC <= BattleConst.COLUMN_COUNT then if newR <= maxRow and newC <= BattleConst.COLUMN_COUNT then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction}) table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end end
end end

View File

@ -17,7 +17,8 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti
for _, entity in ipairs(sequenceEntities) do for _, entity in ipairs(sequenceEntities) do
cludePosIdsMap[entity:getPosId()] = nil cludePosIdsMap[entity:getPosId()] = nil
end end
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) local maxRow = battleController.battleData:getRowCount()
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow)
cludePosIdsMap = {} cludePosIdsMap = {}
for _, info in ipairs(posIdInfos) do for _, info in ipairs(posIdInfos) do
cludePosIdsMap[info.posId] = info cludePosIdsMap[info.posId] = info
@ -36,7 +37,8 @@ local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntit
cludePosIdsMap[posId] = true cludePosIdsMap[posId] = true
end end
end end
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) local maxRow = battleController.battleData:getRowCount()
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow)
local mainElementType local mainElementType
for _, info in ipairs(battleController.battleData:getGridSequence()) do for _, info in ipairs(battleController.battleData:getGridSequence()) do
local entity = gridEntities[info.posId] local entity = gridEntities[info.posId]
@ -73,8 +75,8 @@ local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities,
cludePosIdsMap[posId] = true cludePosIdsMap[posId] = true
end end
end end
local maxRow = battleController.battleData:getRowCount()
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow)
cludePosIdsMap = {} cludePosIdsMap = {}
for _, info in ipairs(posIdInfos) do for _, info in ipairs(posIdInfos) do
cludePosIdsMap[info.posId] = info cludePosIdsMap[info.posId] = info