diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 96f5e16f06..5349b69063 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -3906,7 +3906,7 @@ float Unit::CalculateEffectiveCritChance(const Unit* victim, WeaponAttackType at { if (!i->isAffectedOnSpell(ability)) continue; - i->OnCritChanceCalculate(victim, chance); + i->OnCritChanceCalculate(victim, chance, ability); } return std::max(0.0f, std::min(chance, 100.0f)); } @@ -3991,7 +3991,7 @@ float Unit::CalculateSpellCritChance(const Unit* victim, SpellSchoolMask schoolM { if (!i->isAffectedOnSpell(spellInfo)) continue; - i->OnCritChanceCalculate(victim, chance); + i->OnCritChanceCalculate(victim, chance, spellInfo); } return std::max(0.0f, std::min(chance, 100.0f)); } diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp index f3a336e6ba..f49e38047a 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp @@ -55,7 +55,7 @@ struct ShatterMage : public AuraScript aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply); } - void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance) const override + void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* /*spellInfo*/) const override { switch (aura->GetModifier()->m_miscvalue) { diff --git a/src/game/Spells/Scripts/SpellScript.h b/src/game/Spells/Scripts/SpellScript.h index 6a34c14c6a..a76c831773 100644 --- a/src/game/Spells/Scripts/SpellScript.h +++ b/src/game/Spells/Scripts/SpellScript.h @@ -92,7 +92,7 @@ struct AuraScript virtual void OnDamageCalculate(Aura* /*aura*/, Unit* /*attacker*/, Unit* /*victim*/, int32& /*advertisedBenefit*/, float& /*totalMod*/) const {} // called during duration calculation - target can be nullptr for channel duration calculation virtual int32 OnDurationCalculate(WorldObject const* /*caster*/, Unit const* /*target*/, int32 duration) const { return duration; } - virtual void OnCritChanceCalculate(Aura* /*aura*/, Unit const* /*target*/, float& /*chance*/) const {} + virtual void OnCritChanceCalculate(Aura* /*aura*/, Unit const* /*target*/, float& /*chance*/, SpellEntry const* /*spellInfo*/) const {} // the following two hooks are done in an alternative fashion due to how they are usually used // if an aura is applied before, its removed after, and if some aura needs to do something after aura effect is applied, need to revert that change before its removed // called before aura apply and after aura unapply diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 46e75d3c5f..7f345ba358 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -8917,10 +8917,10 @@ void Aura::OnDamageCalculate(Unit* victim, Unit* attacker, int32& advertisedBene return script->OnDamageCalculate(this, attacker, victim, advertisedBenefit, totalMod); } -void Aura::OnCritChanceCalculate(Unit const* victim, float& chance) +void Aura::OnCritChanceCalculate(Unit const* victim, float& chance, SpellEntry const* spellInfo) { if (AuraScript* script = GetAuraScript()) - return script->OnCritChanceCalculate(this, victim, chance); + return script->OnCritChanceCalculate(this, victim, chance, spellInfo); } void Aura::OnApply(bool apply) diff --git a/src/game/Spells/SpellAuras.h b/src/game/Spells/SpellAuras.h index a64c7e938f..937487b9e5 100644 --- a/src/game/Spells/SpellAuras.h +++ b/src/game/Spells/SpellAuras.h @@ -533,7 +533,7 @@ class Aura void OnAuraInit(); int32 OnAuraValueCalculate(Unit* caster, int32 currentValue); void OnDamageCalculate(Unit* victim, Unit* attacker, int32& advertisedBenefit, float& totalMod); - void OnCritChanceCalculate(Unit const* victim, float& chance); + void OnCritChanceCalculate(Unit const* victim, float& chance, SpellEntry const* spellInfo); void OnApply(bool apply); void OnAfterApply(bool apply); bool OnCheckProc(ProcExecutionData& data);