[Fix] Zone state edge case with 0 hp (#4787)

This commit is contained in:
Chris Miles 2025-03-29 14:20:23 -05:00 committed by GitHub
parent 799609fb21
commit a05d0752f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}