[9427] Add helper functions for Unit::Get/SetHealthPercent

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-02-21 11:45:44 +01:00
parent 6b0189fed3
commit 67c5e57b0a
3 changed files with 9 additions and 1 deletions

View file

@ -11649,6 +11649,12 @@ void Unit::SetMaxHealth(uint32 val)
SetHealth(val);
}
void Unit::SetHealthPercent(float percent)
{
uint32 newHealth = GetMaxHealth() * percent/100.0f;
SetHealth(newHealth);
}
void Unit::SetPower(Powers power, uint32 val)
{
if(GetPower(power) == val)