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:
Machiavelli
2011-02-17 21:32:38 +01:00
parent 253891bf9f
commit 6ebf672557
+2 -1
View File
@@ -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));
}
}