aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp80
1 files changed, 27 insertions, 53 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 939026ede2b..b645c57f154 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -390,13 +390,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
{
// Victory Rush
if (m_spellInfo->Id == 34428)
- ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
+ ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shockwave
else if (m_spellInfo->Id == 46968)
{
int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2);
if (pct > 0)
- damage += int32(CalculatePctN(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
+ damage += int32(CalculatePct(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
break;
}
break;
@@ -445,7 +445,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// converts each extra point of energy ( up to 25 energy ) into additional damage
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -25));
// 25 energy = 100% more damage
- AddPctN(damage, energy * 4);
+ AddPct(damage, energy * 4);
}
break;
}
@@ -1309,8 +1309,8 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->Id == 8129)
{
- int32 maxDamage = int32(CalculatePctN(m_caster->GetMaxPower(powerType), damage * 2));
- damage = int32(CalculatePctN(unitTarget->GetMaxPower(powerType), damage));
+ int32 maxDamage = int32(CalculatePct(m_caster->GetMaxPower(powerType), damage * 2));
+ damage = int32(CalculatePct(unitTarget->GetMaxPower(powerType), damage));
damage = std::min(damage, maxDamage);
}
@@ -1366,7 +1366,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(addhealth, 25);
+ AddPct(addhealth, 25);
}
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
@@ -1737,13 +1737,13 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
case 31930: // Judgements of the Wise
case 63375: // Primal Wisdom
case 68082: // Glyph of Seal of Command
- damage = int32(CalculatePctN(unitTarget->GetCreateMana(), damage));
+ damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage));
break;
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(damage, 25);
+ AddPct(damage, 25);
break;
}
default:
@@ -1827,7 +1827,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
if (maxPower == 0)
return;
- uint32 gain = CalculatePctN(maxPower, damage);
+ uint32 gain = CalculatePct(maxPower, damage);
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
@@ -3115,7 +3115,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
{
if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0))
- AddPctN(totalDamagePercentMod, rendAndTear->GetAmount());
+ AddPct(totalDamagePercentMod, rendAndTear->GetAmount());
}
break;
}
@@ -3134,8 +3134,8 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
// Death Strike
@@ -3145,7 +3145,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// 2% more damage per 5 runic power, up to a maximum of 40%
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
if (uint32 runic = std::min<uint32>(uint32(m_caster->GetPower(POWER_RUNIC_POWER) / 2.5f), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster)))
- AddPctN(totalDamagePercentMod, runic);
+ AddPct(totalDamagePercentMod, runic);
break;
}
// Obliterate (12.5% more damage per disease)
@@ -3154,14 +3154,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), false) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
// Blood-Caked Strike - Blood-Caked Blade
if (m_spellInfo->SpellIconID == 1736)
{
- AddPctF(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
+ AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
break;
}
// Heart Strike
@@ -3170,9 +3170,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue(m_caster) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
+ AddPct(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
break;
@@ -3194,7 +3194,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
normalized = true;
break;
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
- ApplyPctN(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
+ ApplyPct(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
break;
default:
break; // not weapon damage effect, just skip
@@ -3365,36 +3365,10 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
// Wild object not have owner and check clickable by players
map->AddToMap(pGameObj);
- if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- Player* player = m_caster->ToPlayer();
- Battleground* bg = player->GetBattleground();
-
- switch (pGameObj->GetMapId())
- {
- case 489: //WS
- {
- if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
- {
- uint32 team = ALLIANCE;
-
- if (player->GetTeam() == team)
- team = HORDE;
-
- ((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
- }
- break;
- }
- case 566: //EY
- {
- if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
- {
- ((BattlegroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
- }
- break;
- }
- }
- }
+ if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP)
+ if (Player* player = m_caster->ToPlayer())
+ if (Battleground* bg = player->GetBattleground())
+ bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE);
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
@@ -4674,7 +4648,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
return;
uint32 health = target->CountPctFromMaxHealth(damage);
- uint32 mana = CalculatePctN(target->GetMaxPower(POWER_MANA), damage);
+ uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
ExecuteLogEffectResurrect(effIndex, target);
@@ -4824,7 +4798,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
{
health = m_caster->CountPctFromMaxHealth(damage);
if (m_caster->GetMaxPower(POWER_MANA) > 0)
- mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
+ mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
}
Player* player = m_caster->ToPlayer();
@@ -5142,12 +5116,12 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
if (spellInfo)
{
mana += spellInfo->ManaCost;
- mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
+ mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
}
totem->ToTotem()->UnSummon();
}
}
- ApplyPctN(mana, damage);
+ ApplyPct(mana, damage);
if (mana)
m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true);
}