This commit is contained in:
puxuan 2025-10-30 15:50:07 +08:00
parent c5cad480d7
commit 63e00b46bb
8 changed files with 94 additions and 33 deletions

View File

@ -44,8 +44,8 @@ function BattleBaseController:isUnlockedSkillElementType(elementType)
return self.battleData:isUnlockedSkillElementType(elementType, self.curActionSide) return self.battleData:isUnlockedSkillElementType(elementType, self.curActionSide)
end end
function BattleBaseController:getSkillCount(skillId) function BattleBaseController:getSkillCount(skillId, side)
return self.battleData:getSkillCount(skillId, self.curActionSide) return self.battleData:getSkillCount(skillId, side or self.curActionSide)
end end
function BattleBaseController:getSkillPool() function BattleBaseController:getSkillPool()
@ -749,10 +749,11 @@ function BattleBaseController:initTimelyRouge()
for _, skillId in ipairs(skillIds) do for _, skillId in ipairs(skillIds) do
local cfg = SkillRogueCfg[skillId] local cfg = SkillRogueCfg[skillId]
if cfg.universal and cfg.universal == 3 then if cfg.universal and cfg.universal == 3 then
ModuleManager.BattleManager:onSelectSkill(skillId) self:onSelectSkill(skillId)
end end
end end
end end
self.battleUI:refreshSkill(nil, nil, SIDE_ATK)
end end
function BattleBaseController:initAtkUnits(callback) function BattleBaseController:initAtkUnits(callback)
@ -917,7 +918,6 @@ function BattleBaseController:battleStart()
self.atkTeam:prepare() self.atkTeam:prepare()
self.defTeam:prepare() self.defTeam:prepare()
self.isBattleStart = true self.isBattleStart = true
self.battleUI:refreshSkill(nil, nil, SIDE_ATK)
self.tickSid = BattleScheduler:scheduleGlobal(function(dt, originDt) self.tickSid = BattleScheduler:scheduleGlobal(function(dt, originDt)
self:_tick(dt, originDt) self:_tick(dt, originDt)
end, 0) end, 0)
@ -2530,7 +2530,7 @@ function BattleBaseController:dealSelectSkill(skillId, value, side, isSnapshot)
side = side or self:getCurActionSide() side = side or self:getCurActionSide()
local cfg = ConfigManager:getConfig("skill_rogue") local cfg = ConfigManager:getConfig("skill_rogue")
local skillCfg = cfg[skillId] local skillCfg = cfg[skillId]
if skillCfg.limit_times and self:getSkillCount(skillId) >= skillCfg.limit_times then if skillCfg.limit_times and self:getSkillCount(skillId, side) >= skillCfg.limit_times then
return return
end end

View File

@ -1,6 +1,11 @@
local BattleController = require "app/module/battle/controller/battle_controller" local BattleController = require "app/module/battle/controller/battle_controller"
local BattleControllerDungeonGold = class("BattleControllerDungeonGold", BattleController) local BattleControllerDungeonGold = class("BattleControllerDungeonGold", BattleController)
local BattleBaseController = require "app/module/battle/controller/battle_base_controller"
local BattleConst = GConst.BattleConst
local SIDE_ATK = BattleConst.SIDE_ATK
local SIDE_DEF = BattleConst.SIDE_DEF
function BattleControllerDungeonGold:getBoardConfig() function BattleControllerDungeonGold:getBoardConfig()
return ConfigManager:getConfig("board_dungeon") return ConfigManager:getConfig("board_dungeon")
end end
@ -16,6 +21,25 @@ function BattleControllerDungeonGold:getChapterId()
return self._chapterId return self._chapterId
end end
function BattleControllerDungeonGold:onLoadComplete(...)
-- 处理技能
local unlockAllSkill = function(side)
local skillPool = self.battleData:getSkillPool(side)
if skillPool then
for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
for _, skillId in ipairs(list) do
self:dealSelectSkill(skillId, nil, side)
end
end
self.battleUI:refreshSkill(nil, nil, side)
end
end
unlockAllSkill(SIDE_ATK)
unlockAllSkill(SIDE_DEF)
BattleBaseController.onLoadComplete(self, ...)
end
function BattleControllerDungeonGold:refreshWave() function BattleControllerDungeonGold:refreshWave()
end end

View File

@ -57,6 +57,9 @@ function BattleControllerPVP:getMaxRoundCount()
return 1 return 1
end end
function BattleControllerPVP:initTimelyRouge()
end
-- *************各个子模块的战斗需要重写的方法 END************* -- *************各个子模块的战斗需要重写的方法 END*************
function BattleControllerPVP:ctor() function BattleControllerPVP:ctor()
@ -100,18 +103,18 @@ function BattleControllerPVP:onLoadComplete(...)
local skillPool = self.battleData:getSkillPool(side) local skillPool = self.battleData:getSkillPool(side)
if skillPool then if skillPool then
for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
if not self.battleData:isUnlockedSkillElementType(elementType, side) then -- if not self.battleData:isUnlockedSkillElementType(elementType, side) then
local skillEntity = self.battleData:getSkillEntityByElement(elementType, side) -- local skillEntity = self.battleData:getSkillEntityByElement(elementType, side)
if skillEntity then -- if skillEntity then
local skillId = skillEntity:getUnlockId() -- local skillId = skillEntity:getUnlockId()
if skillId then -- if skillId then
self:dealSelectSkill(skillId, nil, side) -- self:dealSelectSkill(skillId, nil, side)
end -- end
end -- end
for _, skillId in ipairs(list) do for _, skillId in ipairs(list) do
self:dealSelectSkill(skillId, nil, side) self:dealSelectSkill(skillId, nil, side)
end end
end -- end
end end
self.battleUI:refreshSkill(nil, nil, side) self.battleUI:refreshSkill(nil, nil, side)
end end

View File

@ -53,6 +53,10 @@ end
-- 请求挑战金币副本 -- 请求挑战金币副本
function DungeonManager:onDungeonStartReq(id) function DungeonManager:onDungeonStartReq(id)
if not DataManager.FormationData:formationIsFull(GConst.BattleConst.FORMATION_TYPE.STAGE) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
return
end
local params = { local params = {
id = id, id = id,
} }

View File

@ -14,6 +14,7 @@ end
function BattleBoardSkillTips:ctor(params) function BattleBoardSkillTips:ctor(params)
self.params = params self.params = params
self.heroEntity = params.heroEntity self.heroEntity = params.heroEntity
self.battleController = params.battleController
self.battleData = params.battleController.battleData self.battleData = params.battleController.battleData
self.side = params.side self.side = params.side
self.boardSkillEntity = self.battleData:getSkillEntityByElement(self.heroEntity:getMatchType()) self.boardSkillEntity = self.battleData:getSkillEntityByElement(self.heroEntity:getMatchType())

View File

@ -93,7 +93,11 @@ function SkillTips:refreshSkillDesc()
if self.skillId then if self.skillId then
self.txDesc:setActive(true) self.txDesc:setActive(true)
self.txDesc:setSizeDeltaX(width - 20) self.txDesc:setSizeDeltaX(width - 20)
self.txDesc:setText(ModuleManager.HeroManager:getSkillRogueDesc(self.skillId)) local str = ModuleManager.HeroManager:getSkillRogueDesc2(self.skillId)
if EDITOR_MODE then
str = str .. "\n<color=#FF5050>技能ID" .. self.skillId .. "</color>"
end
self.txDesc:setText(str)
local txMeshPro = self.txDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO) local txMeshPro = self.txDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
txMeshPro:ForceMeshUpdate() txMeshPro:ForceMeshUpdate()

View File

@ -182,17 +182,15 @@ function BattleBaseData:setTimeSpeed(timeSpeed, timeScale)
self.data.timeSpeed = timeSpeed self.data.timeSpeed = timeSpeed
end end
-- function BattleBaseData:getActiveRogueSkills(heroEntity)
-- return heroEntity:getActiveRogueSkills()
-- end
function BattleBaseData:initRogueSkills(side, formation) function BattleBaseData:initRogueSkills(side, formation)
if not self.skillPool then self.skillPool = self.skillPool or {}
self.skillPool = {} self.skillMap = self.skillMap or {}
self.skillMap = {} self.skillPool[side] = self.skillPool[side] or {}
end self.skillMap[side] = self.skillMap[side] or {}
if not self.skillPool[side] then
self.skillPool[side] = {}
end
if not self.skillMap[side] then
self.skillMap[side] = {}
end
if not formation then if not formation then
return return

View File

@ -80,6 +80,11 @@ function HeroEntity:_updateAllAttr()
self.allAttr[k] = v self.allAttr[k] = v
end end
-- 装备
local equipAttr = DataManager.EquipData:getEquipAttrBySlotId(self.cfgId, self:getMatchType())
for k, v in pairs(equipAttr) do
self.allAttr[k] = (self.allAttr[k] or 0) + v
end
-- GConst.ALL_ATTR = { -- GConst.ALL_ATTR = {
-- ATTR_ATK_ALL = "atk_all", -- 全体英雄攻击(固定值) -- ATTR_ATK_ALL = "atk_all", -- 全体英雄攻击(固定值)
-- ATTR_HP_ALL = "attr_hp_all", -- 全体英雄生命(固定值) -- ATTR_HP_ALL = "attr_hp_all", -- 全体英雄生命(固定值)
@ -110,7 +115,8 @@ function HeroEntity:_updateAllAttr()
local atkType = GConst.MATCH_ATTACK_NAME[self:getMatchType()] local atkType = GConst.MATCH_ATTACK_NAME[self:getMatchType()]
-- 全局增加攻击力 -- 全局增加攻击力
local allAtk = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_ATK_ALL) local allAtk = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_ATK_ALL)
local atk = self.allAttr[atkType] + allAtk local persionalAtk = self.allAttr[GConst.ATTR_PERSIONAL.ATTR_ATK] or 0
local atk = self.allAttr[atkType] + allAtk + persionalAtk
-- 全局元素攻击力百分比加成 -- 全局元素攻击力百分比加成
local allFactorValue = self:getGlobalAttrByType(GConst.MATCH_ALL_ATKP_NAME[self:getMatchType()]) local allFactorValue = self:getGlobalAttrByType(GConst.MATCH_ALL_ATKP_NAME[self:getMatchType()])
-- 个人攻击力百分比加成 -- 个人攻击力百分比加成
@ -124,7 +130,8 @@ function HeroEntity:_updateAllAttr()
local hpType = GConst.MATCH_HP_NAME[self:getMatchType()] local hpType = GConst.MATCH_HP_NAME[self:getMatchType()]
-- 全局增加生命 -- 全局增加生命
local allHp = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_HP_ALL) local allHp = self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_HP_ALL)
local hp = self.allAttr[hpType] + allHp local persionalHp = self.allAttr[GConst.ATTR_PERSIONAL.ATTR_HP] or 0
local hp = self.allAttr[hpType] + allHp + persionalHp
-- 全局元素生命百分比加成 -- 全局元素生命百分比加成
local allFactorValue = self:getGlobalAttrByType(GConst.MATCH_ALL_HPP_NAME[self:getMatchType()]) local allFactorValue = self:getGlobalAttrByType(GConst.MATCH_ALL_HPP_NAME[self:getMatchType()])
-- 个人生命百分比加成 -- 个人生命百分比加成
@ -137,8 +144,8 @@ function HeroEntity:_updateAllAttr()
self.allAttr[ATTR_NAME.DMGDEC] = (self.allAttr[ATTR_NAME.DMGDEC] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_DMGDEC_ALL) self.allAttr[ATTR_NAME.DMGDEC] = (self.allAttr[ATTR_NAME.DMGDEC] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_DMGDEC_ALL)
self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_CRIT_ALL) self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_CRIT_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_CRIT_ALL)
self.allAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_CRIT_TIME_ALL) self.allAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_CRIT_TIME_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_CRIT_TIME_ALL)
self.allAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_NORMAL_HURTP_ALL) self.allAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_NORMAL_HURTP_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_NORMAL_HURTP_ALL) + self:getGlobalAttrByType(GConst.ATTR_PERSIONAL.ATTR_NORMAL_HURTP)
self.allAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_SKILL_HURTP_ALL) self.allAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] = (self.allAttr[GConst.MATCH_SKILL_HURTP_NAME[self:getMatchType()]] or 0) + self:getGlobalAttrByType(GConst.ATTR_ALL.ATTR_SKILL_HURTP_ALL) + self:getGlobalAttrByType(GConst.ATTR_PERSIONAL.ATTR_SKILL_HURTP)
self:calcPower() self:calcPower()
end end
@ -330,7 +337,6 @@ function HeroEntity:setLv(lv, onlyChangeLv)
return return
end end
self.isNew = lv == 1 self.isNew = lv == 1
self.oldLv = self.data.lv
self.data.lv = lv self.data.lv = lv
self:_updateAllBaseAttr() self:_updateAllBaseAttr()
self:setDirty() self:setDirty()
@ -607,7 +613,7 @@ function HeroEntity:getUnlockRogueId()
end end
function HeroEntity:checkSkillUnlock() function HeroEntity:checkSkillUnlock()
if not self.oldLv then if not self.oldStar then
return false return false
end end
local needPop = false local needPop = false
@ -617,7 +623,7 @@ function HeroEntity:checkSkillUnlock()
local ids = self.config["rouge_skill_" .. i] local ids = self.config["rouge_skill_" .. i]
if ids then if ids then
for ii = #ids, 1, -1 do for ii = #ids, 1, -1 do
if self.data.lv >= ids[ii][1] and self.oldLv < ids[ii][1] then if self.data.star >= ids[ii][1] and self.oldStar < ids[ii][1] then
skillIdx = i skillIdx = i
needPop = true needPop = true
isUnlock = ii == 1 isUnlock = ii == 1
@ -631,7 +637,7 @@ function HeroEntity:checkSkillUnlock()
break break
end end
end end
self.oldLv = nil self.oldStar = nil
return needPop, isUnlock, skillIdx return needPop, isUnlock, skillIdx
end end
@ -658,6 +664,26 @@ function HeroEntity:getRogueSkillList()
return self.rogueSkillList return self.rogueSkillList
end end
function HeroEntity:getUnlockSkillIdx(checkUp)
if not checkUp then
return
end
local count = 1
while true do
local ids = self.config["rouge_skill_" .. count]
if ids then
for i = #ids, 1, -1 do
if self.data.star == ids[i][1] then
return count
end
end
else
break
end
count = count + 1
end
end
function HeroEntity:getRogueSkillListBattle() function HeroEntity:getRogueSkillListBattle()
if not self.rogueSkillListBattle then if not self.rogueSkillListBattle then
self.rogueSkillListBattle = {} self.rogueSkillListBattle = {}
@ -775,6 +801,7 @@ function HeroEntity:canStarUp(showToast)
end end
function HeroEntity:onHeroStarUp() function HeroEntity:onHeroStarUp()
self.oldStar = self.data.star
self.data.star = self.data.star + 1 self.data.star = self.data.star + 1
self:setBaseAttrDirty() self:setBaseAttrDirty()
self:setDirty() self:setDirty()