From cf263769139c3c41b9f309290fa3785ce2c473e7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 02 二月 2026 14:38:54 +0800
Subject: [PATCH] 125 战斗 修复get max hp报错 跟refreshBlueMinggeBuff报错问题

---
 Main/System/Battle/BattleObject/HeroBattleObject.cs |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Main/System/Battle/BattleObject/HeroBattleObject.cs b/Main/System/Battle/BattleObject/HeroBattleObject.cs
index c54460a..d26e314 100644
--- a/Main/System/Battle/BattleObject/HeroBattleObject.cs
+++ b/Main/System/Battle/BattleObject/HeroBattleObject.cs
@@ -546,16 +546,17 @@
     
     protected override void ApplyCasterHpChange(long newHp)
     {
+        if (teamHero == null) return;
         teamHero.curHp = newHp;
     }
     
-    public override long GetCurHp() => teamHero.curHp;
-    public override long GetMaxHp() => teamHero.maxHp;
-    public override void SetCurHp(long value) { teamHero.curHp = value; }
-    public override void SetIsDead(bool value) { teamHero.isDead = value; }
+    public override long GetCurHp() => teamHero == null ? 0 : teamHero.curHp;
+    public override long GetMaxHp() => teamHero == null ? 0 : teamHero.maxHp;
+    public override void SetCurHp(long value) { if (teamHero == null) return; teamHero.curHp = value; }
+    public override void SetIsDead(bool value) { if (teamHero == null) return; teamHero.isDead = value; }
     
-    public override int GetNPCID() => teamHero.NPCID;
-    public override long GetFightPower() => teamHero.fightPower;
+    public override int GetNPCID() => teamHero == null ? 0 : teamHero.NPCID;
+    public override long GetFightPower() => teamHero == null ? 0 : teamHero.fightPower;
 
     // 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
     protected override BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)

--
Gitblit v1.8.0