打乱棋盘的技能机制
This commit is contained in:
parent
9d70b5b8b1
commit
5f7cca6351
@ -686,12 +686,14 @@ BattleConst.SKILL_TYPE = {
|
||||
ELIMINATION_GRID_AND_ELEMENT = 4,
|
||||
CHANGE_ALL_ELEMENT_TYPE = 5,
|
||||
RANDOM_KILL_SKILL_GRID = 6,
|
||||
SHUFFLE_BOARD = 7,
|
||||
}
|
||||
|
||||
BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE = {
|
||||
[BattleConst.SKILL_TYPE.RELEASE_GRID_TYPE] = true,
|
||||
[BattleConst.SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = true,
|
||||
[BattleConst.SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = true,
|
||||
[BattleConst.SKILL_TYPE.SHUFFLE_BOARD] = true,
|
||||
}
|
||||
|
||||
BattleConst.SKILL_METHOD_TYPE = {
|
||||
|
||||
@ -469,43 +469,9 @@ function BattleController:enterElimination(needDelay)
|
||||
-- 检查棋盘
|
||||
local find, pathList = self:findAttention()
|
||||
if not find then -- 如果没找到,就要打乱棋盘
|
||||
local changeInfo = self:shuffleBoard()
|
||||
if changeInfo then
|
||||
self.battleData:setGridEntitiesPosId(changeInfo)
|
||||
self.battleUI:shuffleBoard(changeInfo, function()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||
end)
|
||||
else
|
||||
local resetList = {}
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:isEmptyIdle() then
|
||||
table.insert(resetList, posId)
|
||||
end
|
||||
end
|
||||
local resetInfo = self:resetGrids(resetList)
|
||||
if not resetInfo then
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("----- 处于无法消除状态 -----")
|
||||
end
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||
else
|
||||
if self.resetGridSid then
|
||||
ModuleManager.BattleManager:unscheduleGlobal(self.resetGridSid)
|
||||
self.resetGridSid = nil
|
||||
end
|
||||
|
||||
self.resetGridSid = ModuleManager.BattleManager:performWithDelayGlobal(function()
|
||||
local count = 1
|
||||
for posId, info in pairs(resetInfo) do
|
||||
self.battleData:setGridInfo(posId, info)
|
||||
self.battleUI:playChangeElementSfx(posId, count)
|
||||
count = count + 1
|
||||
end
|
||||
self.resetGridSid = nil
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||
end, 0.5)
|
||||
end
|
||||
end
|
||||
self:shuffleBoard(function()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||
end)
|
||||
else
|
||||
self.attentionList = pathList
|
||||
-- ModuleManager.BattleManager:performWithDelayGlobal(function()
|
||||
@ -1797,7 +1763,49 @@ function BattleController:showAttention()
|
||||
end, 2)
|
||||
end
|
||||
|
||||
function BattleController:shuffleBoard()
|
||||
function BattleController:shuffleBoard(callback)
|
||||
local changeInfo = self:getShuffleBoardInfo()
|
||||
if changeInfo then
|
||||
self.battleData:setGridEntitiesPosId(changeInfo)
|
||||
self.battleUI:shuffleBoard(changeInfo, callback)
|
||||
else
|
||||
local resetList = {}
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:isEmptyIdle() then
|
||||
table.insert(resetList, posId)
|
||||
end
|
||||
end
|
||||
local resetInfo = self:resetGrids(resetList)
|
||||
if not resetInfo then
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("----- 处于无法消除状态 -----")
|
||||
end
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
else
|
||||
if self.resetGridSid then
|
||||
ModuleManager.BattleManager:unscheduleGlobal(self.resetGridSid)
|
||||
self.resetGridSid = nil
|
||||
end
|
||||
|
||||
self.resetGridSid = ModuleManager.BattleManager:performWithDelayGlobal(function()
|
||||
local count = 1
|
||||
for posId, info in pairs(resetInfo) do
|
||||
self.battleData:setGridInfo(posId, info)
|
||||
self.battleUI:playChangeElementSfx(posId, count)
|
||||
count = count + 1
|
||||
end
|
||||
self.resetGridSid = nil
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end, 0.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:getShuffleBoardInfo()
|
||||
local posList = {}
|
||||
local gridEntityList = {}
|
||||
local anySkillList = {}
|
||||
|
||||
@ -137,6 +137,15 @@ local function _takeRandomKillSkillGrid(atkUnitComp, skillEntity, battleControll
|
||||
battleController:killGrids(list)
|
||||
end
|
||||
|
||||
local function _takeShuffleBoard(atkUnitComp, skillEntity, battleController)
|
||||
local battleData = battleController.battleData
|
||||
if not battleData or not battleData:getGridEnties() then
|
||||
return
|
||||
end
|
||||
|
||||
battleController:shuffleBoard()
|
||||
end
|
||||
|
||||
BattleBoardSkillHandle._activeBoardSkill = {
|
||||
[SKILL_TYPE.ELIMINATION] = _takeElimination,
|
||||
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
|
||||
@ -147,6 +156,7 @@ BattleBoardSkillHandle._activeAttackOverSkill = {
|
||||
[SKILL_TYPE.RELEASE_GRID_TYPE] = _taleReleaseGridType,
|
||||
[SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = _takeChangeAllElementType,
|
||||
[SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = _takeRandomKillSkillGrid,
|
||||
[SKILL_TYPE.SHUFFLE_BOARD] = _takeShuffleBoard,
|
||||
}
|
||||
|
||||
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities, battleController)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user