Merge pull request #3469 from Chaplain/cleanup3

Core/Spells: SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT improvement
This commit is contained in:
megamage
2011-10-12 08:39:45 -07:00
4 changed files with 22 additions and 2 deletions
+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))
+1
View File
@@ -1371,6 +1371,7 @@ class Unit : public WorldObject
void SetMaxPower(Powers power, uint32 val);
// returns the change in power
int32 ModifyPower(Powers power, int32 val);
int32 ModifyPowerPct(Powers power, float pct, bool apply = true);
uint32 GetAttackTime(WeaponAttackType att) const
{
@@ -4003,8 +4003,18 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp
// return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
float amount = float(GetAmount());
target->HandleStatModifier(unitMod, TOTAL_PCT, float(GetAmount()), apply);
if (apply)
{
target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
target->ModifyPowerPct(powerType, amount, apply);
}
else
{
target->ModifyPowerPct(powerType, amount, apply);
target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
}
}
void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
+1 -1
View File
@@ -3094,7 +3094,7 @@ void SpellMgr::LoadDbcDataCorrections()
// with this spell atrribute aura can be stacked several times
spellInfo->Attributes &= ~SPELL_ATTR0_NOT_SHAPESHIFT;
break;
case 64904: //Hymn of Hope
case 64904: // Hymn of Hope
spellInfo->EffectApplyAuraName[EFFECT_1] = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT;
break;
case 30421: // Nether Portal - Perseverence