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

This commit is contained in:
ariel- authored and Ovahlord committed 2022-09-12 09:15:10 +02:00
1 parent dc46f0621b
commit c81f48197d
6 files changed
+46 -8

No files matched your search

+4 -4
View File
@@ -7106,14 +7106,14 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellInfo const* spellInfo) const
return TakenAdvertisedBenefit;
}
float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask schoolMask, WeaponAttackType attackType /*= BASE_ATTACK*/) const
float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask schoolMask, WeaponAttackType attackType /*= BASE_ATTACK*/, bool isPeriodic /*= false*/) const
{
//! Mobs can't crit with spells. (Except player controlled)
if (GetTypeId() == TYPEID_UNIT && !GetSpellModOwner())
return 0.0f;
// not critting spell
if (spellInfo->HasAttribute(SPELL_ATTR2_CANT_CRIT))
if (!isPeriodic && !spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
return 0.0f;
float crit_chance = 0.0f;
@@ -7152,10 +7152,10 @@ float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask scho
return std::max(crit_chance, 0.0f);
}
float Unit::SpellCritChanceTaken(Unit const* caster, SpellInfo const* spellInfo, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType /*= BASE_ATTACK*/) const
float Unit::SpellCritChanceTaken(Unit const* caster, SpellInfo const* spellInfo, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType /*= BASE_ATTACK*/, bool isPeriodic /*= false*/) const
{
// not critting spell
if (spellInfo->HasAttribute(SPELL_ATTR2_CANT_CRIT))
if (!isPeriodic && !spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
return 0.0f;
float crit_chance = doneChance;