棋盘技能

This commit is contained in:
xiekaidong 2023-04-25 09:56:03 +08:00
parent d281a2261d
commit 09e85e9dba
3 changed files with 30 additions and 5 deletions

View File

@ -594,6 +594,8 @@ BattleConst.SKILL_TYPE = {
NORMAL = 0, NORMAL = 0,
ELIMINATION = 1, ELIMINATION = 1,
CHANGE_AROUND = 2, CHANGE_AROUND = 2,
-- 3 暂不处理
ELIMINATION_GRID_AND_ELEMENT = 4,
} }
BattleConst.SKILL_METHOD_TYPE = { BattleConst.SKILL_METHOD_TYPE = {

View File

@ -10,7 +10,7 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti
if boardrange then if boardrange then
local cludePosIdsMap = {} local cludePosIdsMap = {}
for posId, entity in pairs(gridEntities) do for posId, entity in pairs(gridEntities) do
if entity:canInfluenceBySkill() then if entity:isEmptyIdle() then
cludePosIdsMap[posId] = true cludePosIdsMap[posId] = true
end end
end end
@ -46,9 +46,32 @@ local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntit
end end
end end
local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities, sequenceEntities)
local boardrange = skillEntity:getBoardRange()
if boardrange then
local cludePosIdsMap = {}
for posId, entity in pairs(gridEntities) do
if entity:isNotObstacleIdle() then
cludePosIdsMap[posId] = true
end
end
-- for _, entity in ipairs(sequenceEntities) do
-- cludePosIdsMap[entity:getPosId()] = nil
-- end
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
cludePosIdsMap = {}
for _, info in ipairs(posIdInfos) do
cludePosIdsMap[info.posId] = info
end
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap)
end
end
BattleBoardSkillHandle._activeBoardSkill = { BattleBoardSkillHandle._activeBoardSkill = {
[SKILL_TYPE.ELIMINATION] = _takeElimination, [SKILL_TYPE.ELIMINATION] = _takeElimination,
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround, [SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
[SKILL_TYPE.ELIMINATION_GRID_AND_ELEMENT] = _takeEliminationGridAndElement,
} }
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities) function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities)

View File

@ -173,15 +173,15 @@ function BattleGridEntity:canChangeInfo()
return false return false
end end
function BattleGridEntity:canInfluenceBySkill() function BattleGridEntity:isEmptyIdle()
if self:isEmptyType() and not self:getIsIdle() then if self:isEmptyType() and not self:getSkillId() and not self:getIsIdle() then
return true return true
end end
return false return false
end end
function BattleGridEntity:isEmptyIdle() function BattleGridEntity:isNotObstacleIdle()
if self:isEmptyType() and not self:getSkillId() then if not self:isObstacleType() and not self:getSkillId() and not self:getIsIdle() then
return true return true
end end
return false return false