Core/Spells: Fixed incorrect switch logic in Unit::SpellCritChanceDone

Port From (https://github.com/TrinityCore/TrinityCore/commit/c8bd6f5da3d03007a9be9bda30aadddb5573ec9d)
This commit is contained in:
hondacrx
2024-02-21 21:10:45 -05:00
parent 7919985741
commit 5fce86ac37
+10 -12
View File
@@ -618,6 +618,11 @@ namespace Game.Entities
case SpellDmgClass.None:
case SpellDmgClass.Magic:
{
var getPhysicalCritChance = float () =>
{
return GetUnitCriticalChanceDone(attackType);
};
var getMagicCritChance = float () =>
{
Player thisPlayer = ToPlayer();
@@ -627,18 +632,11 @@ namespace Game.Entities
return BaseSpellCritChance;
};
switch (schoolMask & SpellSchoolMask.Normal)
{
case SpellSchoolMask.Normal: // physical only
crit_chance = GetUnitCriticalChanceDone(attackType);
break;
case 0: // spell only
crit_chance = getMagicCritChance();
break;
default: // mix of physical and magic
crit_chance = Math.Max(getMagicCritChance(), GetUnitCriticalChanceDone(attackType));
break;
}
if (schoolMask.HasAnyFlag(SpellSchoolMask.Normal))
crit_chance = Math.Max(crit_chance, getPhysicalCritChance());
if (schoolMask.HasAnyFlag(~SpellSchoolMask.Normal))
crit_chance = Math.Max(crit_chance, getMagicCritChance());
break;
}
case SpellDmgClass.Melee: