Core/Spells: SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT improvement

*Now it'll correctly increase\decrease % of power
*Added helper function for modify power with percent ammount
This commit is contained in:
Chaplain committed 2011-10-12 01:11:52 +03:00
1 parent 44c55f78e0
commit 3e9611578c
4 files changed
+22 -2

No files matched your search

+9
View File
@@ -12384,6 +12384,15 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
return gain;
}
// returns negative amount on power reduction
int32 Unit::ModifyPowerPct(Powers power, float pct, bool apply)
{
float amount = (float)GetMaxPower(power);
ApplyPercentModFloatVar(amount, pct, apply);
return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
}
bool Unit::isAlwaysVisibleFor(WorldObject const* seer) const
{
if (WorldObject::isAlwaysVisibleFor(seer))