From a05d0752f65d7803f85c5a35f7b6a4ac946bad65 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 29 Mar 2025 14:20:23 -0500 Subject: [PATCH] [Fix] Zone state edge case with 0 hp (#4787) --- zone/zone_save_state.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zone/zone_save_state.cpp b/zone/zone_save_state.cpp index 67676af5b..fa4bd4e12 100644 --- a/zone/zone_save_state.cpp +++ b/zone/zone_save_state.cpp @@ -336,6 +336,16 @@ inline void LoadNPCState(Zone *zone, NPC *n, ZoneStateSpawnsRepository::ZoneStat n->SetEndurance(s.endurance); } + // if these are zero for some reason, we need to reset the max hp + if (!s.is_corpse) { + if (s.hp == 0 || n->GetHP() == 0) { + n->SetMaxHP(); + } + if (s.mana == 0 || n->GetMana() == 0) { + n->RestoreMana(); + } + } + if (s.grid) { n->AssignWaypoints(s.grid, s.current_waypoint); }