Core/Spells: calculate crit chance only for spells that do damage/healing

Port From (https://github.com/TrinityCore/TrinityCore/commit/85e5509e91a1370b16851d375a26121797870921)
This commit is contained in:
hondacrx
2021-06-23 22:06:49 -04:00
parent 89586e9495
commit 9e23ca4b04
6 changed files with 80 additions and 43 deletions
+4 -3
View File
@@ -645,14 +645,15 @@ namespace Game.Entities
return (uint)Math.Max(heal, 0.0f);
}
public float SpellCritChanceDone(SpellInfo spellInfo, SpellSchoolMask schoolMask, WeaponAttackType attackType = WeaponAttackType.BaseAttack)
public float SpellCritChanceDone(Spell spell, AuraEffect aurEff, SpellSchoolMask schoolMask, WeaponAttackType attackType = WeaponAttackType.BaseAttack)
{
SpellInfo spellInfo = spell != null ? spell.GetSpellInfo() : aurEff.GetSpellInfo();
//! Mobs can't crit with spells. (Except player controlled)
if (IsCreature() && !GetSpellModOwner())
return 0.0f;
// not critting spell
if (spellInfo.HasAttribute(SpellAttr2.CantCrit))
if (spell != null && !spellInfo.HasAttribute(SpellCustomAttributes.CanCrit))
return 0.0f;
float crit_chance = 0.0f;
@@ -691,7 +692,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = spell != null ? spell.GetSpellInfo() : aurEff.GetSpellInfo();
// not critting spell
if (spellInfo.HasAttribute(SpellAttr2.CantCrit))
if (spell != null && !spellInfo.HasAttribute(SpellCustomAttributes.CanCrit))
return 0.0f;
float crit_chance = doneChance;