From 63e00b46bb5dc8329aba81fbe82a3295ddc26b33 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Thu, 30 Oct 2025 15:50:07 +0800 Subject: [PATCH] fix bug --- .../controller/battle_base_controller.lua | 10 ++--- .../battle_controller_dungeon_gold.lua | 24 +++++++++++ .../controller/battle_controller_pvp.lua | 21 +++++---- lua/app/module/dungeon/dungeon_manager.lua | 4 ++ lua/app/ui/tips/battle_board_skill_tips.lua | 1 + lua/app/ui/tips/skill_tips.lua | 6 ++- lua/app/userdata/battle/battle_base_data.lua | 18 ++++---- lua/app/userdata/hero/hero_entity_other.lua | 43 +++++++++++++++---- 8 files changed, 94 insertions(+), 33 deletions(-) diff --git a/lua/app/module/battle/controller/battle_base_controller.lua b/lua/app/module/battle/controller/battle_base_controller.lua index 24b2a520..156e9c93 100644 --- a/lua/app/module/battle/controller/battle_base_controller.lua +++ b/lua/app/module/battle/controller/battle_base_controller.lua @@ -44,8 +44,8 @@ function BattleBaseController:isUnlockedSkillElementType(elementType) return self.battleData:isUnlockedSkillElementType(elementType, self.curActionSide) end -function BattleBaseController:getSkillCount(skillId) - return self.battleData:getSkillCount(skillId, self.curActionSide) +function BattleBaseController:getSkillCount(skillId, side) + return self.battleData:getSkillCount(skillId, side or self.curActionSide) end function BattleBaseController:getSkillPool() @@ -749,10 +749,11 @@ function BattleBaseController:initTimelyRouge() for _, skillId in ipairs(skillIds) do local cfg = SkillRogueCfg[skillId] if cfg.universal and cfg.universal == 3 then - ModuleManager.BattleManager:onSelectSkill(skillId) + self:onSelectSkill(skillId) end end end + self.battleUI:refreshSkill(nil, nil, SIDE_ATK) end function BattleBaseController:initAtkUnits(callback) @@ -917,7 +918,6 @@ function BattleBaseController:battleStart() self.atkTeam:prepare() self.defTeam:prepare() self.isBattleStart = true - self.battleUI:refreshSkill(nil, nil, SIDE_ATK) self.tickSid = BattleScheduler:scheduleGlobal(function(dt, originDt) self:_tick(dt, originDt) end, 0) @@ -2530,7 +2530,7 @@ function BattleBaseController:dealSelectSkill(skillId, value, side, isSnapshot) side = side or self:getCurActionSide() local cfg = ConfigManager:getConfig("skill_rogue") 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 end diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua index f1fec968..b398c2cb 100644 --- a/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua +++ b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua @@ -1,6 +1,11 @@ local BattleController = require "app/module/battle/controller/battle_controller" 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() return ConfigManager:getConfig("board_dungeon") end @@ -16,6 +21,25 @@ function BattleControllerDungeonGold:getChapterId() return self._chapterId 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() end diff --git a/lua/app/module/battle/controller/battle_controller_pvp.lua b/lua/app/module/battle/controller/battle_controller_pvp.lua index 5780b32f..bd271ec0 100644 --- a/lua/app/module/battle/controller/battle_controller_pvp.lua +++ b/lua/app/module/battle/controller/battle_controller_pvp.lua @@ -57,6 +57,9 @@ function BattleControllerPVP:getMaxRoundCount() return 1 end +function BattleControllerPVP:initTimelyRouge() +end + -- *************各个子模块的战斗需要重写的方法 END************* function BattleControllerPVP:ctor() @@ -100,18 +103,18 @@ function BattleControllerPVP:onLoadComplete(...) local skillPool = self.battleData:getSkillPool(side) if skillPool then for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 - if not self.battleData:isUnlockedSkillElementType(elementType, side) then - local skillEntity = self.battleData:getSkillEntityByElement(elementType, side) - if skillEntity then - local skillId = skillEntity:getUnlockId() - if skillId then - self:dealSelectSkill(skillId, nil, side) - end - end + -- if not self.battleData:isUnlockedSkillElementType(elementType, side) then + -- local skillEntity = self.battleData:getSkillEntityByElement(elementType, side) + -- if skillEntity then + -- local skillId = skillEntity:getUnlockId() + -- if skillId then + -- self:dealSelectSkill(skillId, nil, side) + -- end + -- end for _, skillId in ipairs(list) do self:dealSelectSkill(skillId, nil, side) end - end + -- end end self.battleUI:refreshSkill(nil, nil, side) end diff --git a/lua/app/module/dungeon/dungeon_manager.lua b/lua/app/module/dungeon/dungeon_manager.lua index 17bbbe06..7ce26295 100644 --- a/lua/app/module/dungeon/dungeon_manager.lua +++ b/lua/app/module/dungeon/dungeon_manager.lua @@ -53,6 +53,10 @@ end -- 请求挑战金币副本 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 = { id = id, } diff --git a/lua/app/ui/tips/battle_board_skill_tips.lua b/lua/app/ui/tips/battle_board_skill_tips.lua index 8f3d14a7..ef044eb5 100644 --- a/lua/app/ui/tips/battle_board_skill_tips.lua +++ b/lua/app/ui/tips/battle_board_skill_tips.lua @@ -14,6 +14,7 @@ end function BattleBoardSkillTips:ctor(params) self.params = params self.heroEntity = params.heroEntity + self.battleController = params.battleController self.battleData = params.battleController.battleData self.side = params.side self.boardSkillEntity = self.battleData:getSkillEntityByElement(self.heroEntity:getMatchType()) diff --git a/lua/app/ui/tips/skill_tips.lua b/lua/app/ui/tips/skill_tips.lua index 04a904d6..0b00eaf2 100644 --- a/lua/app/ui/tips/skill_tips.lua +++ b/lua/app/ui/tips/skill_tips.lua @@ -93,7 +93,11 @@ function SkillTips:refreshSkillDesc() if self.skillId then self.txDesc:setActive(true) 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技能ID:" .. self.skillId .. "" + end + self.txDesc:setText(str) local txMeshPro = self.txDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO) txMeshPro:ForceMeshUpdate() diff --git a/lua/app/userdata/battle/battle_base_data.lua b/lua/app/userdata/battle/battle_base_data.lua index 41722e71..7dd6f163 100644 --- a/lua/app/userdata/battle/battle_base_data.lua +++ b/lua/app/userdata/battle/battle_base_data.lua @@ -182,17 +182,15 @@ function BattleBaseData:setTimeSpeed(timeSpeed, timeScale) self.data.timeSpeed = timeSpeed end +-- function BattleBaseData:getActiveRogueSkills(heroEntity) +-- return heroEntity:getActiveRogueSkills() +-- end + function BattleBaseData:initRogueSkills(side, formation) - if not self.skillPool then - self.skillPool = {} - self.skillMap = {} - end - if not self.skillPool[side] then - self.skillPool[side] = {} - end - if not self.skillMap[side] then - self.skillMap[side] = {} - end + self.skillPool = self.skillPool or {} + self.skillMap = self.skillMap or {} + self.skillPool[side] = self.skillPool[side] or {} + self.skillMap[side] = self.skillMap[side] or {} if not formation then return diff --git a/lua/app/userdata/hero/hero_entity_other.lua b/lua/app/userdata/hero/hero_entity_other.lua index c30e6a0e..4884c5b8 100644 --- a/lua/app/userdata/hero/hero_entity_other.lua +++ b/lua/app/userdata/hero/hero_entity_other.lua @@ -80,6 +80,11 @@ function HeroEntity:_updateAllAttr() self.allAttr[k] = v 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 = { -- ATTR_ATK_ALL = "atk_all", -- 全体英雄攻击(固定值) -- ATTR_HP_ALL = "attr_hp_all", -- 全体英雄生命(固定值) @@ -110,7 +115,8 @@ function HeroEntity:_updateAllAttr() local atkType = GConst.MATCH_ATTACK_NAME[self:getMatchType()] -- 全局增加攻击力 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()]) -- 个人攻击力百分比加成 @@ -124,7 +130,8 @@ function HeroEntity:_updateAllAttr() local hpType = GConst.MATCH_HP_NAME[self:getMatchType()] -- 全局增加生命 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()]) -- 个人生命百分比加成 @@ -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[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_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_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_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:getGlobalAttrByType(GConst.ATTR_PERSIONAL.ATTR_SKILL_HURTP) self:calcPower() end @@ -330,7 +337,6 @@ function HeroEntity:setLv(lv, onlyChangeLv) return end self.isNew = lv == 1 - self.oldLv = self.data.lv self.data.lv = lv self:_updateAllBaseAttr() self:setDirty() @@ -607,7 +613,7 @@ function HeroEntity:getUnlockRogueId() end function HeroEntity:checkSkillUnlock() - if not self.oldLv then + if not self.oldStar then return false end local needPop = false @@ -617,7 +623,7 @@ function HeroEntity:checkSkillUnlock() local ids = self.config["rouge_skill_" .. i] if ids then 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 needPop = true isUnlock = ii == 1 @@ -631,7 +637,7 @@ function HeroEntity:checkSkillUnlock() break end end - self.oldLv = nil + self.oldStar = nil return needPop, isUnlock, skillIdx end @@ -658,6 +664,26 @@ function HeroEntity:getRogueSkillList() return self.rogueSkillList 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() if not self.rogueSkillListBattle then self.rogueSkillListBattle = {} @@ -775,6 +801,7 @@ function HeroEntity:canStarUp(showToast) end function HeroEntity:onHeroStarUp() + self.oldStar = self.data.star self.data.star = self.data.star + 1 self:setBaseAttrDirty() self:setDirty()