boss技能

This commit is contained in:
puxuan 2025-06-11 23:51:45 +08:00
parent 30fcf69843
commit a142d9e9d2
8 changed files with 147 additions and 1 deletions

View File

@ -19,6 +19,7 @@ local TIME_FACTOR = BattleConst.TIME_FACTOR
local HURT_ANI_NAME_LIST = {SPINE_ANIMATION_NAME.HIT, SPINE_ANIMATION_NAME.HIT_2} local HURT_ANI_NAME_LIST = {SPINE_ANIMATION_NAME.HIT, SPINE_ANIMATION_NAME.HIT_2}
function BattleUnitComp:ctor() function BattleUnitComp:ctor()
self.hurtNameList = {}
end end
function BattleUnitComp:initPosition() function BattleUnitComp:initPosition()

View File

@ -182,6 +182,10 @@ function BattleBaseController:generateNextMonster()
local isBoss = self.defTeam:getIsBoss() local isBoss = self.defTeam:getIsBoss()
local unitEntity = self.battleData:addMonster(monsterId, true, self) local unitEntity = self.battleData:addMonster(monsterId, true, self)
local modelId = unitEntity:getModelId() local modelId = unitEntity:getModelId()
Logger.logHighlight("=========================xxxx2 modelId = %s isBoss = %s", modelId, isBoss)
if isBoss then
modelId = "p0003"
end
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
self.defTeam:removeAllUnits() self.defTeam:removeAllUnits()
local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT)
@ -197,12 +201,16 @@ function BattleBaseController:generateNextMonster()
if count == 2 then if count == 2 then
self.atkTeam:stopRunAction() self.atkTeam:stopRunAction()
self:onRoundEnd(true) self:onRoundEnd(true)
if isBoss then
self:refreshBossSkill(unitEntity)
end
end end
end end
self.atkTeam:playRunAction() self.atkTeam:playRunAction()
self.atkTeam:recoverHpOnWaveOver(onFinish) self.atkTeam:recoverHpOnWaveOver(onFinish)
isBoss = self.defTeam:getIsBoss() isBoss = self.defTeam:getIsBoss()
Logger.logHighlight("=========================xxxx21 modelId = %s isBoss = %s", modelId, isBoss)
if isBoss then if isBoss then
local monsterInfo = ConfigManager:getConfig("monster")[monsterId] local monsterInfo = ConfigManager:getConfig("monster")[monsterId]
self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() self:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function()
@ -212,11 +220,15 @@ function BattleBaseController:generateNextMonster()
monsterComp:playEnterBattlefield(true, onFinish) monsterComp:playEnterBattlefield(true, onFinish)
end end
else else
self:clearBossSkill()
local count = 0 local count = 0
local function onFinish() local function onFinish()
count = count + 1 count = count + 1
if count == 2 then if count == 2 then
self:onRoundEnd(true) self:onRoundEnd(true)
if isBoss then
self:refreshBossSkill(unitEntity)
end
end end
end end
self.atkTeam:recoverHpOnWaveOver(onFinish) self.atkTeam:recoverHpOnWaveOver(onFinish)
@ -631,6 +643,15 @@ function BattleBaseController:refreshBuff(side, buffList)
self.battleUI:refreshBuff(side, buffList) self.battleUI:refreshBuff(side, buffList)
end end
function BattleBaseController:refreshBossSkill(unitEntity)
local skillList = unitEntity:getSkillList()
self.battleUI:refreshBossSkill(skillList)
end
function BattleBaseController:clearBossSkill()
self.battleUI:clearBossSkill()
end
function BattleBaseController:clearBuff(side) function BattleBaseController:clearBuff(side)
self.battleUI:clearBuff(side) self.battleUI:clearBuff(side)
end end
@ -740,6 +761,7 @@ function BattleBaseController:initDefUnits(callback)
monsterComp:initWithEntity(modelId, unitEntity, self) monsterComp:initWithEntity(modelId, unitEntity, self)
self.defTeam:addUnit(monsterComp, true) self.defTeam:addUnit(monsterComp, true)
self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent())
self:refreshBossSkill(unitEntity)
callback() callback()
end) end)
end end

View File

@ -5,6 +5,7 @@ local GRID_CELL = "app/ui/battle/cell/grid_cell"
local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab" local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell" local SKILL_NODE_CELL = "app/ui/battle/cell/skill_node_cell"
local TINY_BUFF_CELL = "app/ui/battle/cell/tiny_buff_cell" local TINY_BUFF_CELL = "app/ui/battle/cell/tiny_buff_cell"
local BOSS_SKILL_CELL = "app/ui/battle/cell/boss_skill_cell"
local BG_PATH = "assets/arts/textures/background/battle/%s.png" local BG_PATH = "assets/arts/textures/background/battle/%s.png"
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell" local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell"
@ -71,6 +72,11 @@ function BattleBaseUI:initBuff()
self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff) self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff)
end end
function BattleBaseUI:initBossSkill()
local bossSkillPrefix = nil
self:_initBossSkill(bossSkillPrefix)
end
function BattleBaseUI:initBattlefield() function BattleBaseUI:initBattlefield()
self.battleNode = nil self.battleNode = nil
end end
@ -263,6 +269,7 @@ function BattleBaseUI:_display()
self:initBg() self:initBg()
self:initSkill() self:initSkill()
self:initBuff() self:initBuff()
self:initBossSkill()
self:initBattlefield() self:initBattlefield()
self:initNumberNode() self:initNumberNode()
self:initComboNode() self:initComboNode()
@ -415,6 +422,46 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot
end end
end end
function BattleBaseUI:_initBossSkill(bossSkillPrefix)
if self.bossSkillCells then
return
end
self.bossSkillCells = {}
for i = 1, 6 do
if bossSkillPrefix then
local obj = self.uiMap[bossSkillPrefix .. i]
if obj then
self.bossSkillCells[i] = CellManager:addCellComp(obj, BOSS_SKILL_CELL)
-- obj:addClickListener(function()
-- -- self.battleController:showBuffTips(SIDE_DEF)
-- end)
end
end
end
for index, cell in ipairs(self.bossSkillCells) do
cell:setActive(false)
end
-- buff的tips
-- self.battleBuffTipsRoot = battleBuffTipsRoot
-- self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
-- battleBuffTipsMask:addClickListener(function()
-- if self.autoCloseBuffSid then
-- self:unscheduleGlobal(self.autoCloseBuffSid)
-- self.autoCloseBuffSid = nil
-- end
-- self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
-- end)
-- self.battleBuffTipsBg = battleBuffTipsBg
-- self.battleBuffTipsBuff = battleBuffTipsBuff
-- self.battleBuffTipsBuffList = {}
-- local children = self.battleBuffTipsBg:getChildList()
-- if children then
-- for k, v in ipairs(children) do
-- table.insert(self.battleBuffTipsBuffList, v)
-- end
-- end
end
function BattleBaseUI:refreshBuff(side, buffList) function BattleBaseUI:refreshBuff(side, buffList)
if not self.tinyBuffCells then if not self.tinyBuffCells then
return return
@ -455,6 +502,31 @@ function BattleBaseUI:clearBuff(side)
end end
end end
function BattleBaseUI:refreshBossSkill(skillList)
if not self.bossSkillCells then
return
end
local skillCellCount = #self.bossSkillCells
for i = 1, skillCellCount do
if not skillList[i] then
self.bossSkillCells[i]:setActive(false)
else
self.bossSkillCells[i]:setActive(true)
self.bossSkillCells[i]:refresh(skillList[i])
end
end
end
function BattleBaseUI:clearBossSkill()
if not self.bossSkillCells then
return
end
for _, cell in ipairs(self.bossSkillCells) do
cell:setActive(false)
end
end
function BattleBaseUI:refreshChessBoard(boardBg) function BattleBaseUI:refreshChessBoard(boardBg)
self.boardNode:setTexture(string.format(BATTLE_COMMON_PATH, boardBg), function() self.boardNode:setTexture(string.format(BATTLE_COMMON_PATH, boardBg), function()
self.boardNode:setAnchoredPositionX(0) self.boardNode:setAnchoredPositionX(0)

View File

@ -81,6 +81,11 @@ function BattleUI:initBuff()
self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff) self:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot, battleBuffTipsMask, battleBuffTipsBg, battleBuffTipsBuff)
end end
function BattleUI:initBossSkill()
local bossSkillPrefix = "battle_ui.top_node.buff_boss.boss_skill_cell_"
self:_initBossSkill(bossSkillPrefix)
end
function BattleUI:initBattlefield() function BattleUI:initBattlefield()
self.battleNode = self.uiMap["battle_ui.battle_root.battle_node"] self.battleNode = self.uiMap["battle_ui.battle_root.battle_node"]
end end

View File

@ -0,0 +1,26 @@
local BossSkillCell = class("BossSkillCell", BaseCell)
function BossSkillCell:init()
self.baseObject:addClickListener(function()
-- self.battleController:showBuffTips(SIDE_DEF)
-- ModuleManager.TipsManager:showBattleBoardSkillTips(self.battleData:getHeroEntity(elementType, side), self.battleController, side)
ModuleManager.TipsManager:showSkillTips(self.baseObject, nil, self.skillId)
end)
local uiMap = self:getUIMap()
self.icon = uiMap["boss_skill_cell.icon"]
local value = uiMap["boss_skill_cell.value"]
local count = uiMap["boss_skill_cell.count"]
end
function BossSkillCell:refresh(skillId)
print("=============================== skillId = %s", skillId)
self.skillId = skillId
-- self.icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, self.lastSkillIcon)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, "14_3")
end
function BossSkillCell:setActive(active)
self.baseObject:setActive(active)
end
return BossSkillCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b93e542c122d8481396b8f8f28a31a04
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -178,7 +178,6 @@ function BattleBaseData:initRogueSkills(side, formation)
-- end -- end
-- end -- end
end end
Logger.logHighlight("===========")
end end
function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot) function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot)

View File

@ -595,4 +595,15 @@ function BattleUnitEntity:onRoundEnd()
end end
end end
function BattleUnitEntity:getSkillList()
local list = {}
for _, v in ipairs(self.activeSkills or {}) do
table.insert(list, v.skillId)
end
for _, v in ipairs(self.passiveSkills or {}) do
table.insert(list, v.skillId)
end
return list
end
return BattleUnitEntity return BattleUnitEntity