Core/Unit: allow miss chance to exceed 60% cap with certain auras

Port From (https://github.com/TrinityCore/TrinityCore/commit/6ab410b926f8d708f06a5da52357bc70e3b02244)
This commit is contained in:
hondacrx
2021-06-22 20:23:08 -04:00
parent 0711c5b3a4
commit 24f666a59d
+12 -10
View File
@@ -791,7 +791,7 @@ namespace Game.Entities
float MeleeSpellMissChance(Unit victim, WeaponAttackType attType, SpellInfo spellInfo)
{
//calculate miss chance
float missChance = victim.GetUnitMissChance(attType);
float missChance = victim.GetUnitMissChance();
// melee attacks while dual wielding have +19% chance to miss
if (spellInfo == null && HaveOffhandWeapon() && !IsInFeralForm())
@@ -813,9 +813,16 @@ namespace Game.Entities
else
missChance -= ModMeleeHitChance;
// Limit miss chance from 0 to 60%
MathFunctions.RoundToInterval(ref missChance, 0.0f, 60.0f);
return missChance;
// Limit miss chance to 60%
missChance = Math.Min(missChance, 60f);
// miss chance from SPELL_AURA_MOD_ATTACKER_xxx_HIT_CHANCE can exceed 60% miss cap (eg aura 50240)
if (attType == WeaponAttackType.RangedAttack)
missChance -= victim.GetTotalAuraModifier(AuraType.ModAttackerRangedHitChance);
else
missChance -= victim.GetTotalAuraModifier(AuraType.ModAttackerMeleeHitChance);
return Math.Max(missChance, 0f);
}
float GetUnitCriticalChanceDone(WeaponAttackType attackType)
@@ -954,15 +961,10 @@ namespace Game.Entities
chance -= GetTotalAuraModifier(AuraType.ModExpertise) / 4.0f;
return Math.Max(chance, 0.0f);
}
float GetUnitMissChance(WeaponAttackType attType)
float GetUnitMissChance()
{
float miss_chance = 5.0f;
if (attType == WeaponAttackType.RangedAttack)
miss_chance -= GetTotalAuraModifier(AuraType.ModAttackerRangedHitChance);
else
miss_chance -= GetTotalAuraModifier(AuraType.ModAttackerMeleeHitChance);
return miss_chance;
}
float GetUnitBlockChance(WeaponAttackType attType, Unit victim)