Core/Utilities: Use generic templates with AddPct, ApplyPct and CalculatePct

This commit is contained in:
Spp
2012-10-02 12:17:42 +02:00
parent f8846cdeaf
commit 380db44583
31 changed files with 321 additions and 357 deletions

View File

@@ -1585,7 +1585,7 @@ class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount());
absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
dmgInfo.AbsorbDamage(absorbAmount);
}

View File

@@ -521,7 +521,7 @@ class boss_algalon_the_observer : public CreatureScript
if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
}
else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePct<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
{
_fightWon = true;
damage = 0;

View File

@@ -194,7 +194,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
void OnPeriodic(AuraEffect const* aurEff)

View File

@@ -70,7 +70,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -118,7 +118,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
absorbAmount = std::min(CalculatePct(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
}
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
@@ -179,7 +179,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -413,7 +413,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
AddPctF(multiplier, aurEff->GetAmount());
AddPct(multiplier, aurEff->GetAmount());
}
}
@@ -425,7 +425,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
int32 bp = GetHitDamage() * multiplier;
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
AddPctN(bp, aurEff->GetAmount());
AddPct(bp, aurEff->GetAmount());
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
@@ -472,7 +472,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader
{
// You have a chance equal to your Parry chance
if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance()))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -582,7 +582,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
// Damage that would take you below [effect0] health or taken while you are at [effect0]
if (remainingHp < minHp)
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -722,7 +722,7 @@ class spell_dk_death_strike : public SpellScriptLoader
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
}
}

View File

@@ -181,7 +181,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
// restore mana
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
return;
}
@@ -204,7 +204,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
// restore mana
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
return;
}
@@ -255,7 +255,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Moonkin Form
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -327,7 +327,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Cat Form
if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -369,7 +369,7 @@ class spell_dru_savage_defense : public SpellScriptLoader
void Absorb(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
{
absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
absorbAmount = uint32(CalculatePct(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
aurEff->SetAmount(0);
}

View File

@@ -1236,7 +1236,7 @@ class spell_gen_lifeblood : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
amount += int32(CalculatePctF(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
}
void Register()

View File

@@ -138,7 +138,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
ApplyPctN(basePoint, TickCount * 40);
ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
@@ -148,11 +148,11 @@ class spell_hun_chimera_shot : public SpellScriptLoader
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget?
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
ApplyPctN(basePoint, TickCount * 60);
ApplyPct(basePoint, TickCount * 60);
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)

View File

@@ -292,7 +292,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
{
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}

View File

@@ -112,7 +112,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
? dmgInfo.GetDamage()
: allowedHealth - remainingHealth;
absorbAmount = CalculatePctN(damageToReduce, absorbPct);
absorbAmount = CalculatePct(damageToReduce, absorbPct);
}
}

View File

@@ -243,7 +243,7 @@ public:
if (pet->isPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
amount += ownerBonus;
}
@@ -313,7 +313,7 @@ public:
if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
{
float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount());
amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
}
}
}
@@ -382,7 +382,7 @@ public:
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
amount += ownerBonus;
_tempBonus = ownerBonus;
@@ -434,7 +434,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetArmor(), 35);
ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
}
@@ -446,7 +446,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
}
@@ -493,7 +493,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
}
@@ -505,7 +505,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
}
@@ -517,7 +517,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
}
@@ -560,7 +560,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
}
@@ -686,7 +686,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount());
amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -708,7 +708,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount());
amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -898,7 +898,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
@@ -941,7 +941,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
@@ -971,7 +971,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
@@ -1028,7 +1028,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
@@ -1047,7 +1047,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
@@ -1066,7 +1066,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
@@ -1115,7 +1115,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
@@ -1134,7 +1134,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
@@ -1153,7 +1153,7 @@ public:
float ownerBonus = 0.0f;
ownerBonus = CalculatePctN(owner->GetArmor(), 35);
ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
@@ -1544,12 +1544,12 @@ public:
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
if (aurEff)
mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod;
amount += ownerBonus;
}

View File

@@ -278,7 +278,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
if (GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
@@ -316,7 +316,7 @@ public:
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0))
{
int32 heal = GetHitHeal();
AddPctN(heal, aurEff->GetAmount());
AddPct(heal, aurEff->GetAmount());
SetHitHeal(heal);
}
}
@@ -432,7 +432,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader
// Pain and Suffering reduces damage
if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
AddPctN(damage, aurEff->GetAmount());
AddPct(damage, aurEff->GetAmount());
GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
}

View File

@@ -124,7 +124,7 @@ class spell_rog_nerves_of_steel : public SpellScriptLoader
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()

View File

@@ -78,7 +78,7 @@ class spell_sha_astral_shift : public SpellScriptLoader
{
// reduces all damage taken while stun, fear or silence
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -184,7 +184,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader
if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
effValue += dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue));
caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
}
}
@@ -501,11 +501,11 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
// Restorative Totems
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
AddPctN(damage, dummy->GetAmount());
AddPct(damage, dummy->GetAmount());
// Glyph of Healing Stream Totem
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
AddPctN(damage, aurEff->GetAmount());
AddPct(damage, aurEff->GetAmount());
damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL));
}
@@ -592,7 +592,7 @@ class spell_sha_lava_lash : public SpellScriptLoader
{
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
AddPctN(hitDamage, damage);
AddPct(hitDamage, damage);
SetHitDamage(hitDamage);
}
}

View File

@@ -410,7 +410,7 @@ class spell_warl_life_tap : public SpellScriptLoader
// Improved Life Tap mod
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0))
AddPctN(mana, aurEff->GetAmount());
AddPct(mana, aurEff->GetAmount());
caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
@@ -421,7 +421,7 @@ class spell_warl_life_tap : public SpellScriptLoader
if (manaFeedVal > 0)
{
ApplyPctN(manaFeedVal, mana);
ApplyPct(manaFeedVal, mana);
caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
}
}
@@ -544,7 +544,7 @@ class spell_warl_haunt : public SpellScriptLoader
{
if (Aura* aura = GetHitAura())
if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
aurEff->SetAmount(CalculatePct(aurEff->GetAmount(), GetHitDamage()));
}
void Register()

View File

@@ -183,7 +183,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader
// apply percent damage mods
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
ApplyPct(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
@@ -368,7 +368,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
}
void Register()
@@ -400,7 +400,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader
void HandleDamage(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
if (Unit* target = GetHitUnit())
{