From d030ee59886b3ac135aa2afeeb2265e4e285fb59 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 4 Jul 2023 20:21:23 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 42 +++++++++---------- lua/app/module/battle/battle_manager.lua | 13 +++--- .../skill/battle_board_skill_handle.lua | 10 +++-- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index a6e521ce..7d2793a3 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -638,27 +638,27 @@ BattleConst.UP_DOWN_LEFT_RIGHT = { [65] = {55, 75, 64, 66}, [66] = {56, 76, 65, 67}, [67] = {57, 77, 66, }, - [71] = {61, 72}, - [72] = {62, 71, 73}, - [73] = {63, 72, 74}, - [74] = {64, 73, 75}, - [75] = {65, 74, 76}, - [76] = {66, 75, 77}, - [77] = {67, 76, }, - [81] = {71, 82}, - [82] = {72, 81, 83}, - [83] = {73, 82, 84}, - [84] = {74, 83, 85}, - [85] = {75, 84, 86}, - [86] = {76, 85, 87}, - [87] = {77, 86, }, - [91] = {81, 92}, - [92] = {82, 91, 93}, - [93] = {83, 92, 94}, - [94] = {84, 93, 95}, - [95] = {85, 94, 96}, - [96] = {86, 95, 97}, - [97] = {87, 96, }, + [71] = {61, 81, 72}, + [72] = {62, 82, 71, 73}, + [73] = {63, 83, 72, 74}, + [74] = {64, 84, 73, 75}, + [75] = {65, 85, 74, 76}, + [76] = {66, 86, 75, 77}, + [77] = {67, 87, 76, }, + [81] = {71, 91, 82}, + [82] = {72, 92, 81, 83}, + [83] = {73, 93, 82, 84}, + [84] = {74, 94, 83, 85}, + [85] = {75, 95, 84, 86}, + [86] = {76, 96, 85, 87}, + [87] = {77, 97, 86, }, + [91] = {81, 101, 92}, + [92] = {82, 102, 91, 93}, + [93] = {83, 103, 92, 94}, + [94] = {84, 104, 93, 95}, + [95] = {85, 105, 94, 96}, + [96] = {86, 106, 95, 97}, + [97] = {87, 107, 96, }, [101] = {91, 102}, [102] = {92, 101, 103}, [103] = {93, 102, 104}, diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 95fb01ec..7f5da891 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -215,11 +215,11 @@ function BattleManager:getLastLineLastRowPosId(row, column, maxRow) return self:getPosId(maxRow + row, column) end -function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) +function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow) local posIdInfos = {} local randomExclusion = {} 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 table.insert(posIdInfos, info) cludePosIdsMap[info.posId] = nil @@ -230,7 +230,8 @@ function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) return posIdInfos 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 r = rc.r local c = rc.c @@ -258,7 +259,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, end elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then 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}) end end @@ -286,7 +287,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, for i = 1, range do local newR = r + 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}) end end @@ -302,7 +303,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, for i = 1, range do local newR = r + 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}) end end diff --git a/lua/app/module/battle/skill/battle_board_skill_handle.lua b/lua/app/module/battle/skill/battle_board_skill_handle.lua index 807fa499..58b12d80 100644 --- a/lua/app/module/battle/skill/battle_board_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_board_skill_handle.lua @@ -17,7 +17,8 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti for _, entity in ipairs(sequenceEntities) do cludePosIdsMap[entity:getPosId()] = nil end - local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) + local maxRow = battleController.battleData:getRowCount() + local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, maxRow) cludePosIdsMap = {} for _, info in ipairs(posIdInfos) do cludePosIdsMap[info.posId] = info @@ -36,7 +37,8 @@ local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntit cludePosIdsMap[posId] = true 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 for _, info in ipairs(battleController.battleData:getGridSequence()) do local entity = gridEntities[info.posId] @@ -73,8 +75,8 @@ local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities, cludePosIdsMap[posId] = true 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 = {} for _, info in ipairs(posIdInfos) do cludePosIdsMap[info.posId] = info