Skip to content

fix(Core/Spells): weapon damage based magic abilities gain too much effect from spell aura % damage increase #22232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 17 additions & 25 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3581,46 +3581,38 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
}
}

// apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage
if (fixed_bonus || spell_bonus)
bool const isPhysical = (m_spellSchoolMask & SPELL_SCHOOL_MASK_NORMAL);
if (isPhysical && (fixed_bonus || spell_bonus))
{
UnitMods unitMod;
switch (m_attackType)
{
default:
case BASE_ATTACK:
unitMod = UNIT_MOD_DAMAGE_MAINHAND;
break;
case OFF_ATTACK:
unitMod = UNIT_MOD_DAMAGE_OFFHAND;
break;
case RANGED_ATTACK:
unitMod = UNIT_MOD_DAMAGE_RANGED;
break;
}

if (m_spellSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
{
float weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
spell_bonus = int32(spell_bonus * weapon_total_pct);
default:
case BASE_ATTACK:
unitMod = UNIT_MOD_DAMAGE_MAINHAND;
break;
case OFF_ATTACK:
unitMod = UNIT_MOD_DAMAGE_OFFHAND;
break;
case RANGED_ATTACK:
unitMod = UNIT_MOD_DAMAGE_RANGED;
break;
}
float weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
spell_bonus = int32(spell_bonus * weapon_total_pct);
}

int32 weaponDamage = 0;
// Dancing Rune Weapon
if (m_caster->GetEntry() == 27893)
{
if (Unit* owner = m_caster->GetOwner())
weaponDamage = owner->CalculateDamage(m_attackType, normalized, true);
}
else if (m_spellInfo->Id == 5019) // Wands
{
weaponDamage = m_caster->CalculateDamage(m_attackType, true, false);
weaponDamage = owner->CalculateDamage(m_attackType, normalized, isPhysical);
}
else
{
weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true);
weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, isPhysical);
}

// Sequence is important
Expand Down