技能机制优化

This commit is contained in:
xiekaidong 2023-08-01 17:35:58 +08:00
parent d79e24d01f
commit e954484a13
4 changed files with 36 additions and 13 deletions

View File

@ -124,6 +124,10 @@ function BattleUnitComp:initWithEntity(modelId, entity, battleController, target
self:initHitAniInfo()
end
function BattleUnitComp:getSide()
return self.side
end
function BattleUnitComp:initHitAniInfo()
self.hurtAniNameList = {}
self.hurtAniNameCount = 0

View File

@ -724,8 +724,9 @@ function BattleBaseController:getCurActionUnitComp()
return self:getCurActionTeam():getMainUnit()
end
function BattleBaseController:getCurActionBoardRowRange()
local isAtkAction = self.curActionSide == SIDE_ATK
function BattleBaseController:getCurActionBoardRowRange(side)
side = side or self.curActionSide
local isAtkAction = side == SIDE_ATK
if isAtkAction then
return self:getAtkMinRow() + 1, self:getRowCount()
else
@ -743,6 +744,16 @@ function BattleBaseController:getPosIdInCurActionBoardRowRange(posId)
return true
end
function BattleBaseController:getPosIdInActionBoardRowRange(side, posId)
local min, max = self:getCurActionBoardRowRange(side)
local r = ModuleManager.BattleManager:getPosRC(posId).r
if r < min or r > max then
return false
end
return true
end
function BattleBaseController:onLoadComplete()
UIManager:closeLoading()
self:handleBuffs()
@ -2151,14 +2162,21 @@ function BattleBaseController:selectSKillNextToStep()
end
function BattleBaseController:changeElementType(count, elementType)
function BattleBaseController:changeElementType(count, elementType, side)
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
table.insert(self.changeElementTypeList, entity)
listCount = listCount + 1
if side then
if self:getPosIdInActionBoardRowRange(side, entity:getPosId()) then
table.insert(self.changeElementTypeList, entity)
listCount = listCount + 1
end
else
table.insert(self.changeElementTypeList, entity)
listCount = listCount + 1
end
end
end

View File

@ -449,7 +449,7 @@ local function _takeChangeElementType(atkUnitComp, skillEntity, battleController
local elementType = params[1]
local changeCount = params[2]
battleController:changeElementType(changeCount, elementType)
battleController:changeElementType(changeCount, elementType, atkUnitComp and atkUnitComp:getSide())
end

View File

@ -957,13 +957,6 @@ end
-- 弹窗优先级: 升级>功能弹窗>英雄解锁弹窗>礼包弹窗>引导
function MainCityUI:checkMainPop()
if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then
return
end
if ModuleManager.MaincityManager:getCurModule() ~= GConst.MainCityConst.MAIN_MODULE.CHAPTER then -- 当前不是关卡界面不触发
return
end
-- 续关
if self.isFirstEnter then
local battleSnapshot = LocalData:getBattleSnapshot()
@ -986,6 +979,14 @@ function MainCityUI:checkMainPop()
end
end
if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then
return
end
if ModuleManager.MaincityManager:getCurModule() ~= GConst.MainCityConst.MAIN_MODULE.CHAPTER then -- 当前不是关卡界面不触发
return
end
-- 检查是否升级
if DataManager.PlayerData:getIfCanLevelUp() then
ModuleManager.PlayerManager:levelUp()