打乱棋盘的技能机制
This commit is contained in:
parent
9d70b5b8b1
commit
5f7cca6351
@ -686,12 +686,14 @@ BattleConst.SKILL_TYPE = {
|
|||||||
ELIMINATION_GRID_AND_ELEMENT = 4,
|
ELIMINATION_GRID_AND_ELEMENT = 4,
|
||||||
CHANGE_ALL_ELEMENT_TYPE = 5,
|
CHANGE_ALL_ELEMENT_TYPE = 5,
|
||||||
RANDOM_KILL_SKILL_GRID = 6,
|
RANDOM_KILL_SKILL_GRID = 6,
|
||||||
|
SHUFFLE_BOARD = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE = {
|
BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE = {
|
||||||
[BattleConst.SKILL_TYPE.RELEASE_GRID_TYPE] = true,
|
[BattleConst.SKILL_TYPE.RELEASE_GRID_TYPE] = true,
|
||||||
[BattleConst.SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = true,
|
[BattleConst.SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = true,
|
||||||
[BattleConst.SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = true,
|
[BattleConst.SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = true,
|
||||||
|
[BattleConst.SKILL_TYPE.SHUFFLE_BOARD] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleConst.SKILL_METHOD_TYPE = {
|
BattleConst.SKILL_METHOD_TYPE = {
|
||||||
|
|||||||
@ -469,43 +469,9 @@ function BattleController:enterElimination(needDelay)
|
|||||||
-- 检查棋盘
|
-- 检查棋盘
|
||||||
local find, pathList = self:findAttention()
|
local find, pathList = self:findAttention()
|
||||||
if not find then -- 如果没找到,就要打乱棋盘
|
if not find then -- 如果没找到,就要打乱棋盘
|
||||||
local changeInfo = self:shuffleBoard()
|
self:shuffleBoard(function()
|
||||||
if changeInfo then
|
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||||
self.battleData:setGridEntitiesPosId(changeInfo)
|
end)
|
||||||
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
|
|
||||||
else
|
else
|
||||||
self.attentionList = pathList
|
self.attentionList = pathList
|
||||||
-- ModuleManager.BattleManager:performWithDelayGlobal(function()
|
-- ModuleManager.BattleManager:performWithDelayGlobal(function()
|
||||||
@ -1797,7 +1763,49 @@ function BattleController:showAttention()
|
|||||||
end, 2)
|
end, 2)
|
||||||
end
|
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 posList = {}
|
||||||
local gridEntityList = {}
|
local gridEntityList = {}
|
||||||
local anySkillList = {}
|
local anySkillList = {}
|
||||||
|
|||||||
@ -137,6 +137,15 @@ local function _takeRandomKillSkillGrid(atkUnitComp, skillEntity, battleControll
|
|||||||
battleController:killGrids(list)
|
battleController:killGrids(list)
|
||||||
end
|
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 = {
|
BattleBoardSkillHandle._activeBoardSkill = {
|
||||||
[SKILL_TYPE.ELIMINATION] = _takeElimination,
|
[SKILL_TYPE.ELIMINATION] = _takeElimination,
|
||||||
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
|
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
|
||||||
@ -147,6 +156,7 @@ BattleBoardSkillHandle._activeAttackOverSkill = {
|
|||||||
[SKILL_TYPE.RELEASE_GRID_TYPE] = _taleReleaseGridType,
|
[SKILL_TYPE.RELEASE_GRID_TYPE] = _taleReleaseGridType,
|
||||||
[SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = _takeChangeAllElementType,
|
[SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = _takeChangeAllElementType,
|
||||||
[SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = _takeRandomKillSkillGrid,
|
[SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = _takeRandomKillSkillGrid,
|
||||||
|
[SKILL_TYPE.SHUFFLE_BOARD] = _takeShuffleBoard,
|
||||||
}
|
}
|
||||||
|
|
||||||
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities, battleController)
|
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities, battleController)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user