mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Spells: Fixed incorrect switch logic in Unit::SpellCritChanceDone
This commit is contained in:
@@ -6917,6 +6917,11 @@ float Unit::SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSch
|
||||
case SPELL_DAMAGE_CLASS_NONE:
|
||||
case SPELL_DAMAGE_CLASS_MAGIC:
|
||||
{
|
||||
auto getPhysicalCritChance = [&]
|
||||
{
|
||||
return GetUnitCriticalChanceDone(attackType);
|
||||
};
|
||||
|
||||
auto getMagicCritChance = [&]
|
||||
{
|
||||
if (Player const* thisPlayer = ToPlayer())
|
||||
@@ -6925,18 +6930,11 @@ float Unit::SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSch
|
||||
return m_baseSpellCritChance;
|
||||
};
|
||||
|
||||
switch (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
|
||||
{
|
||||
case SPELL_SCHOOL_MASK_NORMAL: // physical only
|
||||
crit_chance = GetUnitCriticalChanceDone(attackType);
|
||||
break;
|
||||
case 0: // spell only
|
||||
crit_chance = getMagicCritChance();
|
||||
break;
|
||||
default: // mix of physical and magic
|
||||
crit_chance = std::max(getMagicCritChance(), GetUnitCriticalChanceDone(attackType));
|
||||
break;
|
||||
}
|
||||
if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
|
||||
crit_chance = std::max(crit_chance, getPhysicalCritChance());
|
||||
|
||||
if (schoolMask & ~SPELL_SCHOOL_MASK_NORMAL)
|
||||
crit_chance = std::max(crit_chance, getMagicCritChance());
|
||||
break;
|
||||
}
|
||||
case SPELL_DAMAGE_CLASS_MELEE:
|
||||
|
||||
Reference in New Issue
Block a user