grideffect=6的处理
This commit is contained in:
parent
1319417de0
commit
4846a97b75
@ -418,6 +418,7 @@ BattleConst.GRID_EFFECT_TYPE = {
|
||||
SELECT_COMMON_SKILL = 3,
|
||||
REWARD_BOX = 4,
|
||||
CROSS_SPREAD_NOT_BREAK = 5,
|
||||
CROSS_MOVE_NOT_BREAK = 6,
|
||||
}
|
||||
|
||||
BattleConst.GRID_EFFECT_TRIGGER_TYPE = {
|
||||
|
||||
@ -575,7 +575,7 @@ function BattleController:takeGridEffect()
|
||||
local availableEffectTypeMap
|
||||
for _, entity in ipairs(effectGrid) do
|
||||
local effectType = entity:getEffectType()
|
||||
if not availableEffectTypeMap or not availableEffectTypeMap[effectType] then
|
||||
if effectType ~= BattleConst.GRID_EFFECT_TYPE.CROSS_MOVE_NOT_BREAK and (not availableEffectTypeMap or not availableEffectTypeMap[effectType]) then
|
||||
local succ = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(entity:getPosId(), gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_ROUND_BEGIN, self)
|
||||
if succ and (effectType == BattleConst.GRID_EFFECT_TYPE.CROSS_SPREAD or
|
||||
effectType == BattleConst.GRID_EFFECT_TYPE.CROSS_SPREAD_NOT_BREAK) then
|
||||
@ -586,6 +586,19 @@ function BattleController:takeGridEffect()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, entity in ipairs(effectGrid) do -- gridEffect == 6的最后处理
|
||||
local effectType = entity:getEffectType()
|
||||
if effectType == BattleConst.GRID_EFFECT_TYPE.CROSS_MOVE_NOT_BREAK and (not availableEffectTypeMap or not availableEffectTypeMap[effectType]) then
|
||||
local succ = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(entity:getPosId(), gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_ROUND_BEGIN, self)
|
||||
if succ then
|
||||
if not availableEffectTypeMap then
|
||||
availableEffectTypeMap = {}
|
||||
end
|
||||
availableEffectTypeMap[effectType] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:enterEliminationBegin()
|
||||
@ -1919,14 +1932,25 @@ end
|
||||
|
||||
function BattleController:changeElementType(count, elementType)
|
||||
self.changeElementTypeMap = table.clearOrCreate(self.changeElementTypeMap)
|
||||
self.changeElementTypeList = table.clearOrCreate(self.changeElementTypeList)
|
||||
local listCount = 0
|
||||
for _, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:canChangeInfo() and entity:getElementType() ~= elementType then
|
||||
self.changeElementTypeMap[entity] = elementType
|
||||
count = count - 1
|
||||
if count <= 0 then
|
||||
table.insert(self.changeElementTypeList, entity)
|
||||
listCount = listCount + 1
|
||||
end
|
||||
end
|
||||
|
||||
count = math.min(count, listCount)
|
||||
for i = 1, count do
|
||||
if listCount <= 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
local index = math.random(1, listCount)
|
||||
self.changeElementTypeList[index], self.changeElementTypeList[listCount] = self.changeElementTypeList[listCount], self.changeElementTypeList[index]
|
||||
local entity = table.remove(self.changeElementTypeList)
|
||||
listCount = listCount - 1
|
||||
self.changeElementTypeMap[entity] = elementType
|
||||
end
|
||||
|
||||
self:changeElementTypeByMap(self.changeElementTypeMap)
|
||||
|
||||
@ -95,12 +95,58 @@ local function _rewardBox(entity, gridEntities, battleController, onlyCheck)
|
||||
return true
|
||||
end
|
||||
|
||||
local function _crossMoveNotBreak(entity, gridEntities, battleController, onlyCheck)
|
||||
if onlyCheck then
|
||||
return
|
||||
end
|
||||
|
||||
if battleController.lastRoundBreakedGridType[entity:getGridType()] then
|
||||
return
|
||||
end
|
||||
|
||||
-- 计算所有的蛇
|
||||
local allSnake = {}
|
||||
for posId, entity in pairs(gridEntities) do
|
||||
if entity:getEffectType() == BattleConst.GRID_EFFECT_TYPE.CROSS_MOVE_NOT_BREAK then
|
||||
table.insert(allSnake, entity)
|
||||
end
|
||||
end
|
||||
|
||||
if not allSnake[1] then
|
||||
return
|
||||
end
|
||||
|
||||
local map = {}
|
||||
local succ = false
|
||||
for _, entity in ipairs(allSnake) do
|
||||
local tempList = BattleConst.UP_DOWN_LEFT_RIGHT[entity:getPosId()]
|
||||
if tempList then
|
||||
tempList = table.shuffle(GFunc.getTable(tempList))
|
||||
for _, posId in ipairs(tempList) do
|
||||
local gridEntity = gridEntities[posId]
|
||||
if gridEntity:isEmptyIdle() and not map[posId] then
|
||||
map[entity:getPosId()] = entity
|
||||
map[posId] = gridEntity
|
||||
battleController.battleData:exchangeGridEntities(entity:getPosId(), posId)
|
||||
succ = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if succ then
|
||||
battleController.battleUI:moveGridCells(map)
|
||||
end
|
||||
return succ
|
||||
end
|
||||
|
||||
BattleGridEffectHandle._gridEffectOn = {
|
||||
[GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination,
|
||||
[GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread,
|
||||
[GRID_EFFECT_TYPE.SELECT_COMMON_SKILL] = _selectCommonSkill,
|
||||
[GRID_EFFECT_TYPE.REWARD_BOX] = _rewardBox,
|
||||
[GRID_EFFECT_TYPE.CROSS_SPREAD_NOT_BREAK] = _crossSpreadNotBreak,
|
||||
[GRID_EFFECT_TYPE.CROSS_MOVE_NOT_BREAK] = _crossMoveNotBreak,
|
||||
}
|
||||
|
||||
function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController, onlyCheck)
|
||||
|
||||
@ -1136,6 +1136,35 @@ function BattleUI:showGridEffectSfx(posId, sfxName, callback, customTime, zEuler
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:moveGridCells(gridEntityList, callback)
|
||||
if not gridEntityList then
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
if self.moveGridCellsSeq then
|
||||
self.moveGridCellsSeq:Kill()
|
||||
self.moveGridCellsSeq = nil
|
||||
end
|
||||
|
||||
self.moveGridCellsSeq = self.root:createBindTweenSequence()
|
||||
for _, entity in pairs(gridEntityList) do
|
||||
local posId = entity:getPosId()
|
||||
local baseObject = entity:getCell():getBaseObject()
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
if entity:getEffectType() then
|
||||
baseObject:getTransform():SetAsLastSibling()
|
||||
end
|
||||
self.moveGridCellsSeq:Insert(0, baseObject:getTransform():DOLocalMove(pos, 1))
|
||||
end
|
||||
self.moveGridCellsSeq:AppendCallback(function()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:generateSkillAni(map, callback)
|
||||
if table.nums(map) <= 0 then
|
||||
if callback then
|
||||
@ -2357,6 +2386,11 @@ function BattleUI:clear()
|
||||
self.bossEnterAniSeq:Kill()
|
||||
self.bossEnterAniSeq = nil
|
||||
end
|
||||
|
||||
if self.moveGridCellsSeq then
|
||||
self.moveGridCellsSeq:Kill()
|
||||
self.moveGridCellsSeq = nil
|
||||
end
|
||||
end
|
||||
|
||||
return BattleUI
|
||||
Loading…
x
Reference in New Issue
Block a user