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