aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-02-12 16:52:59 -0300
committerariel- <ariel-@users.noreply.github.com>2018-02-12 16:52:59 -0300
commit4d14f613f3d0dc579e2ca4b8dead65ac6e43965d (patch)
treea4d525db74b56688392e0e293d8c2fa45f7e4082 /src/server/scripts
parente73bfe8df89e4fb6aecc7cb3a1e266e868510799 (diff)
Core/Unit: corrected calculation for SPELL_AURA_MOD_DAMAGE_TAKEN/SPELL_AURA_MOD_HEALING auras
- Spell bonus calculation and penalty was done twice, but it's simply flat +SP, which should be taken into account before other bonuses - Fixed missing code from SpellDamageBonusDone/SpellHealingBonusDone and killed multiplication by stack amount twice for default coefficient spells (already multiplied on level penalty)
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp16
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp20
2 files changed, 25 insertions, 11 deletions
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index c76f0325c29..c8eaa11810b 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -2022,13 +2022,21 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
{
PreventDefaultAction();
+ Unit* victim = eventInfo.GetProcTarget();
+
float ap = GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK);
- int32 holy = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY);
- holy += eventInfo.GetProcTarget()->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
- int32 bp = int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000);
+ ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
+
+ int32 sph = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY);
+ sph += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_SCHOOL_MASK_HOLY);
+
+ float mws = GetTarget()->GetAttackTime(BASE_ATTACK);
+ mws /= 1000.0f;
+
+ int32 bp = int32(mws * (0.022f * ap + 0.044f * sph));
CastSpellExtraArgs args(aurEff);
args.AddSpellBP0(bp);
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args);
+ GetTarget()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args);
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index a9101e16c46..1b3d63a7ac2 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -715,7 +715,7 @@ class spell_sha_flametongue_weapon : public SpellScriptLoader
if (!item || !item->IsEquipped())
return false;
- WeaponAttackType attType = static_cast<WeaponAttackType>(player->GetAttackBySlot(item->GetSlot()));
+ WeaponAttackType attType = Player::GetAttackBySlot(item->GetSlot());
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
return false;
@@ -738,26 +738,32 @@ class spell_sha_flametongue_weapon : public SpellScriptLoader
Item* item = ASSERT_NOTNULL(player->GetWeaponForAttack(attType));
- float const basePoints = GetSpellInfo()->Effects[aurEff->GetEffIndex()].CalcValue();
+ float basePoints = GetSpellInfo()->Effects[aurEff->GetEffIndex()].CalcValue();
// Flametongue max damage is normalized based on a 4.0 speed weapon
// Tooltip says max damage = BasePoints / 25, so BasePoints / 25 / 4 to get base damage per 1.0s AS
+ float attackSpeed = player->GetAttackTime(attType) / 1000.f;
float fireDamage = basePoints / 100.0f;
- float const attackSpeed = player->GetAttackTime(attType) / 1000.f;
fireDamage *= attackSpeed;
// clip value between (BasePoints / 77) and (BasePoints / 25) as the tooltip indicates
RoundToInterval(fireDamage, basePoints / 77.0f, basePoints / 25.0f);
// Calculate Spell Power scaling
- float spellPowerBonus = player->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) + target->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE);
+ float spellPowerBonus = player->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
+ spellPowerBonus += target->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_SCHOOL_MASK_FIRE);
+
+ // calculate penalty from passive aura as is the one with level
+ float const factorMod = player->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo());
+
float const spCoeff = 0.03811f;
- spellPowerBonus *= spCoeff * attackSpeed;
+ spellPowerBonus *= spCoeff * attackSpeed * factorMod;
// All done, now proc damage
CastSpellExtraArgs args(aurEff);
- args.CastItem = item;
- args.AddSpellBP0(fireDamage + spellPowerBonus);
+ args
+ .SetCastItem(item)
+ .AddSpellBP0(fireDamage + spellPowerBonus);
player->CastSpell(target, SPELL_SHAMAN_FLAMETONGUE_ATTACK, args);
}