Skip to content
Permalink
Browse files

Server/Unit: Fix Logic in Setting Max Health. Closes #883

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed Jan 14, 2020
1 parent 10530b9 commit 137ed823f7a82bc541f2127e1e8d423ba4ad30ba
Showing with 5 additions and 3 deletions.
  1. +1 −0 sql/updates/world/2020_01_14_00_world.sql
  2. +4 −3 src/server/game/Entities/Unit/Unit.cpp
@@ -0,0 +1 @@
UPDATE creature SET curhealth=0 WHERE curhealth=1;
@@ -11930,11 +11930,12 @@ void Unit::SetHealth(uint32 val)

void Unit::SetMaxHealth(uint32 val)
{
if (!val && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_POWERS))
val = 0;
else
if (!val)
val = 1;

if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_POWERS))
val = 0;

uint32 health = GetHealth();
SetUInt32Value(UNIT_FIELD_MAX_HEALTH, val);

0 comments on commit 137ed82

Please sign in to comment.
You can’t perform that action at this time.