棋盘死局
This commit is contained in:
parent
e5b0ad98bc
commit
8ef8955972
@ -477,8 +477,35 @@ function BattleController:enterElimination(needDelay)
|
|||||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
Logger.logHighlight("----- 处于无法消除状态 -----")
|
local resetList = {}
|
||||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
|
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 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
|
end
|
||||||
else
|
else
|
||||||
self.attentionList = pathList
|
self.attentionList = pathList
|
||||||
@ -1685,7 +1712,7 @@ function BattleController:changeElementType(count, elementType)
|
|||||||
end
|
end
|
||||||
local entity = table.remove(list, math.random(1, #list))
|
local entity = table.remove(list, math.random(1, #list))
|
||||||
if entity then
|
if entity then
|
||||||
entity:setElementType(elementType)
|
self.battleData:setGridInfo(entity:getPosId(), {gridType = entity:getGridType(), elementType = elementType})
|
||||||
self.battleUI:playChangeElementSfx(entity:getPosId(), i)
|
self.battleUI:playChangeElementSfx(entity:getPosId(), i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1935,6 +1962,81 @@ function BattleController:findAttention()
|
|||||||
return find, pathList
|
return find, pathList
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:resetGrids(posList)
|
||||||
|
local needCount = self:getMinEliminationCount()
|
||||||
|
if not posList[needCount] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local posMap = {}
|
||||||
|
for _, posId in ipairs(posList) do
|
||||||
|
posMap[posId] = true
|
||||||
|
end
|
||||||
|
local useMap = {}
|
||||||
|
local gotPosList = false
|
||||||
|
for _, posId in ipairs(posList) do
|
||||||
|
useMap = {}
|
||||||
|
local count = 0
|
||||||
|
local findPodId = posId
|
||||||
|
gotPosList = false
|
||||||
|
while true do
|
||||||
|
local aounrdList = BattleConst.GRID_OUT_LINE_POS_ID[findPodId]
|
||||||
|
if not aounrdList then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
local got = false
|
||||||
|
for id, status in pairs(aounrdList) do
|
||||||
|
if posMap[id] and not useMap[id] then
|
||||||
|
count = count + 1
|
||||||
|
useMap[id] = true
|
||||||
|
findPodId = id
|
||||||
|
got = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not got then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if count >= needCount then
|
||||||
|
gotPosList = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if gotPosList then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not gotPosList then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local canRandomElmentList = {}
|
||||||
|
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||||
|
if not self:getSealElementType()[typeNum] and self.battleData:getSkillEntityByElement(typeNum) then
|
||||||
|
table.insert(canRandomElmentList, typeNum)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not canRandomElmentList[1] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local elementCount = #canRandomElmentList
|
||||||
|
local mainElement = canRandomElmentList[math.random(1, elementCount)]
|
||||||
|
local resetPosInfo = {}
|
||||||
|
for posId, _ in pairs(posMap) do
|
||||||
|
if useMap[posId] then
|
||||||
|
resetPosInfo[posId] = {gridType = BattleConst.GRID_TYPE.EMPTY, elementType = mainElement}
|
||||||
|
else
|
||||||
|
resetPosInfo[posId] = {gridType = BattleConst.GRID_TYPE.EMPTY, elementType = canRandomElmentList[math.random(1, elementCount)]}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return resetPosInfo
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:findLinkLine(posId, posIdMap, hadSkill, mainElementType, lineList)
|
function BattleController:findLinkLine(posId, posIdMap, hadSkill, mainElementType, lineList)
|
||||||
posIdMap[posId] = true
|
posIdMap[posId] = true
|
||||||
table.insert(lineList, posId)
|
table.insert(lineList, posId)
|
||||||
@ -2067,6 +2169,7 @@ function BattleController:clear()
|
|||||||
BattlePool:clear()
|
BattlePool:clear()
|
||||||
self:unBindAll()
|
self:unBindAll()
|
||||||
DataManager.BattleData:resetTimeSpeed()
|
DataManager.BattleData:resetTimeSpeed()
|
||||||
|
ModuleManager.BattleManager:unscheduleAll()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:endBattleAndExit()
|
function BattleController:endBattleAndExit()
|
||||||
|
|||||||
@ -58,23 +58,23 @@ function ServerItemData:checkRecoveries()
|
|||||||
table.insert(self.data.recoveries, {cfg_id = k, ts = Time:getServerTime()})
|
table.insert(self.data.recoveries, {cfg_id = k, ts = Time:getServerTime()})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:recoveryItems()
|
self:recoveryItems(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ServerItemData:recoveryItems()
|
function ServerItemData:recoveryItems(isInit)
|
||||||
if not self.data.recoveries then
|
if not self.data.recoveries then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i,v in ipairs(self.data.recoveries) do
|
for i,v in ipairs(self.data.recoveries) do
|
||||||
if v.cfg_id == GConst.ItemConst.ITEM_ID_VIT then
|
if v.cfg_id == GConst.ItemConst.ITEM_ID_VIT then
|
||||||
local maxCount = self:getMaxVit()
|
local maxCount = self:getMaxVit()
|
||||||
self:recoveryItem(v, maxCount)
|
self:recoveryItem(v, maxCount, isInit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ServerItemData:recoveryItem(data, maxCount)
|
function ServerItemData:recoveryItem(data, maxCount, isInit)
|
||||||
if not CS.BF.BFMain.IsGotServerTime then
|
if not CS.BF.BFMain.IsGotServerTime then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -116,6 +116,10 @@ function ServerItemData:recoveryItem(data, maxCount)
|
|||||||
addCount = maxCount - currentCount
|
addCount = maxCount - currentCount
|
||||||
end
|
end
|
||||||
self:_addItem(data.cfg_id, addCount)
|
self:_addItem(data.cfg_id, addCount)
|
||||||
|
|
||||||
|
if data.cfg_id == GConst.ItemConst.ITEM_ID_VIT then
|
||||||
|
BIReport:postItemGet(addCount, data.cfg_id)
|
||||||
|
end
|
||||||
ServerDataManager:saveData()
|
ServerDataManager:saveData()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user