Core/Vehicles: Take in account current health percentage of vehichle when recalculating new HP based on vehicle gear scaling. Fixes an exploit that would allow vehicles to reset their HP in a jiffy.
Closes ticket #317
This commit is contained in:
@@ -352,9 +352,10 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId, bool byAura)
|
||||
averageItemLevel = scalingInfo->baseItemLevel;
|
||||
averageItemLevel -= scalingInfo->baseItemLevel;
|
||||
|
||||
float currentHealthPct = me->GetHealthPct();
|
||||
m_bonusHP = uint32(me->GetMaxHealth() * (averageItemLevel * scalingInfo->scalingFactor));
|
||||
me->SetMaxHealth(me->GetMaxHealth() + m_bonusHP);
|
||||
me->SetHealth(me->GetHealth() + m_bonusHP);
|
||||
me->SetHealth(uint32((me->GetHealth() + m_bonusHP) * currentHealthPct));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user