Core/Spells: Fixed incorrect switch logic in Unit::SpellCritChanceDone
Port From (https://github.com/TrinityCore/TrinityCore/commit/c8bd6f5da3d03007a9be9bda30aadddb5573ec9d)
This commit is contained in:
@@ -618,6 +618,11 @@ namespace Game.Entities
|
|||||||
case SpellDmgClass.None:
|
case SpellDmgClass.None:
|
||||||
case SpellDmgClass.Magic:
|
case SpellDmgClass.Magic:
|
||||||
{
|
{
|
||||||
|
var getPhysicalCritChance = float () =>
|
||||||
|
{
|
||||||
|
return GetUnitCriticalChanceDone(attackType);
|
||||||
|
};
|
||||||
|
|
||||||
var getMagicCritChance = float () =>
|
var getMagicCritChance = float () =>
|
||||||
{
|
{
|
||||||
Player thisPlayer = ToPlayer();
|
Player thisPlayer = ToPlayer();
|
||||||
@@ -627,18 +632,11 @@ namespace Game.Entities
|
|||||||
return BaseSpellCritChance;
|
return BaseSpellCritChance;
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (schoolMask & SpellSchoolMask.Normal)
|
if (schoolMask.HasAnyFlag(SpellSchoolMask.Normal))
|
||||||
{
|
crit_chance = Math.Max(crit_chance, getPhysicalCritChance());
|
||||||
case SpellSchoolMask.Normal: // physical only
|
|
||||||
crit_chance = GetUnitCriticalChanceDone(attackType);
|
if (schoolMask.HasAnyFlag(~SpellSchoolMask.Normal))
|
||||||
break;
|
crit_chance = Math.Max(crit_chance, getMagicCritChance());
|
||||||
case 0: // spell only
|
|
||||||
crit_chance = getMagicCritChance();
|
|
||||||
break;
|
|
||||||
default: // mix of physical and magic
|
|
||||||
crit_chance = Math.Max(getMagicCritChance(), GetUnitCriticalChanceDone(attackType));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SpellDmgClass.Melee:
|
case SpellDmgClass.Melee:
|
||||||
|
|||||||
Reference in New Issue
Block a user