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:
@@ -791,7 +791,7 @@ namespace Game.Entities
|
|||||||
float MeleeSpellMissChance(Unit victim, WeaponAttackType attType, SpellInfo spellInfo)
|
float MeleeSpellMissChance(Unit victim, WeaponAttackType attType, SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
//calculate miss chance
|
//calculate miss chance
|
||||||
float missChance = victim.GetUnitMissChance(attType);
|
float missChance = victim.GetUnitMissChance();
|
||||||
|
|
||||||
// melee attacks while dual wielding have +19% chance to miss
|
// melee attacks while dual wielding have +19% chance to miss
|
||||||
if (spellInfo == null && HaveOffhandWeapon() && !IsInFeralForm())
|
if (spellInfo == null && HaveOffhandWeapon() && !IsInFeralForm())
|
||||||
@@ -813,9 +813,16 @@ namespace Game.Entities
|
|||||||
else
|
else
|
||||||
missChance -= ModMeleeHitChance;
|
missChance -= ModMeleeHitChance;
|
||||||
|
|
||||||
// Limit miss chance from 0 to 60%
|
// Limit miss chance to 60%
|
||||||
MathFunctions.RoundToInterval(ref missChance, 0.0f, 60.0f);
|
missChance = Math.Min(missChance, 60f);
|
||||||
return missChance;
|
|
||||||
|
// 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)
|
float GetUnitCriticalChanceDone(WeaponAttackType attackType)
|
||||||
@@ -954,15 +961,10 @@ namespace Game.Entities
|
|||||||
chance -= GetTotalAuraModifier(AuraType.ModExpertise) / 4.0f;
|
chance -= GetTotalAuraModifier(AuraType.ModExpertise) / 4.0f;
|
||||||
return Math.Max(chance, 0.0f);
|
return Math.Max(chance, 0.0f);
|
||||||
}
|
}
|
||||||
float GetUnitMissChance(WeaponAttackType attType)
|
float GetUnitMissChance()
|
||||||
{
|
{
|
||||||
float miss_chance = 5.0f;
|
float miss_chance = 5.0f;
|
||||||
|
|
||||||
if (attType == WeaponAttackType.RangedAttack)
|
|
||||||
miss_chance -= GetTotalAuraModifier(AuraType.ModAttackerRangedHitChance);
|
|
||||||
else
|
|
||||||
miss_chance -= GetTotalAuraModifier(AuraType.ModAttackerMeleeHitChance);
|
|
||||||
|
|
||||||
return miss_chance;
|
return miss_chance;
|
||||||
}
|
}
|
||||||
float GetUnitBlockChance(WeaponAttackType attType, Unit victim)
|
float GetUnitBlockChance(WeaponAttackType attType, Unit victim)
|
||||||
|
|||||||
Reference in New Issue
Block a user