bug修复

This commit is contained in:
xiekaidong 2023-06-20 11:35:23 +08:00
parent eb3ec49d37
commit 5de785f28e

View File

@ -219,43 +219,35 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap,
end
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT_UP then
for i = c - 1, c - range, -1 do
if i >= 1 then
for j = r - 1, r - range, -1 do
if j >= 1 then
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
end
end
for i = 1, range do
local newR = r - i
local newC = c - i
if newR >= 1 and newC >= 1 then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT_DOWN then
for i = c - 1, c - range, -1 do
if i >= 1 then
for j = r + 1, r + range do
if j <= BattleConst.ROW_COUNT then
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
end
end
for i = 1, range do
local newR = r + i
local newC = c - i
if newR <= BattleConst.ROW_COUNT and newC >= 1 then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT_UP then
for i = c + 1, c + range do
if i <= BattleConst.COLUMN_COUNT then
for j = r - 1, r - range, -1 do
if j >= 1 then
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
end
end
for i = 1, range do
local newR = r - i
local newC = c + i
if newR >= 1 and newC <= BattleConst.COLUMN_COUNT then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT_DOWN then
for i = c + 1, c + range do
if i <= BattleConst.COLUMN_COUNT then
for j = r + 1, r + range do
if j <= BattleConst.ROW_COUNT then
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
end
end
for i = 1, range do
local newR = r + i
local newC = c + i
if newR <= BattleConst.ROW_COUNT and newC <= BattleConst.COLUMN_COUNT then
table.insert(posIdList, {posId = self:getPosId(newR, newC), direction = direction})
end
end
end