From a94b0b1a2341d8133727dc6e0cbe096728551f4b Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 1 Aug 2023 18:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=AD=E5=85=B3=E8=AE=B0=E5=BD=95=E8=83=BD?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/helper/battle_snapshot_helper.lua | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lua/app/module/battle/helper/battle_snapshot_helper.lua b/lua/app/module/battle/helper/battle_snapshot_helper.lua index df996bc4..3d86918e 100644 --- a/lua/app/module/battle/helper/battle_snapshot_helper.lua +++ b/lua/app/module/battle/helper/battle_snapshot_helper.lua @@ -74,6 +74,11 @@ function BattleSnapshotHelper:snapshotBattleInfo(battleBaseController) battleBaseController.snapShotInfo.atkSkillMap[tostring(skillId)] = info end + battleBaseController.snapShotInfo.atkSkillEnergy = table.clearOrCreate(battleBaseController.snapShotInfo.atkSkillEnergy) + for elementType, skillEntity in pairs(battleBaseController.battleData:getSkillEntities(SIDE_ATK)) do + battleBaseController.snapShotInfo.atkSkillEnergy[tostring(elementType)] = skillEntity:getEnergy() + end + -- BattleBaseData battleBaseController.snapShotInfo.battledataShopInfo = battleBaseController.battleData:getSnapshoptInfo() @@ -213,12 +218,23 @@ function BattleSnapshotHelper:dealSnapshotBattleExtraInfo(battleBaseController, end end end + end - if battleBaseController.battleUI then - battleBaseController.battleUI:refreshSkill(nil, nil, SIDE_ATK) + local atkSkillEnergy = snapshot.atkSkillEnergy + if atkSkillEnergy then + local skillMap = battleBaseController.battleData:getSkillEntities(SIDE_ATK) + for matchTypeStr, count in pairs(atkSkillEnergy) do + local matchType = tonumber(matchTypeStr) + if matchType and skillMap[matchType] then + skillMap[matchType]:addEnergy(count) + end end end + if battleBaseController.battleUI then + battleBaseController.battleUI:refreshSkill(nil, nil, SIDE_ATK) + end + -- buff local atkBuff = snapshot.atkBuff if atkBuff then