mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Unit: allow miss chance to exceed 60% cap with certain auras
This commit is contained in:
@@ -2750,18 +2750,13 @@ float Unit::GetUnitParryChance(WeaponAttackType attType, Unit const* victim) con
|
||||
return std::max(chance, 0.0f);
|
||||
}
|
||||
|
||||
float Unit::GetUnitMissChance(WeaponAttackType attType) const
|
||||
float Unit::GetUnitMissChance() const
|
||||
{
|
||||
float miss_chance = 5.0f;
|
||||
|
||||
if (Player const* player = ToPlayer())
|
||||
miss_chance += player->GetMissPercentageFromDefense();
|
||||
|
||||
if (attType == RANGED_ATTACK)
|
||||
miss_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
|
||||
else
|
||||
miss_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
|
||||
|
||||
return miss_chance;
|
||||
}
|
||||
|
||||
@@ -12741,7 +12736,7 @@ int32 Unit::CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid co
|
||||
float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
|
||||
{
|
||||
//calculate miss chance
|
||||
float missChance = victim->GetUnitMissChance(attType);
|
||||
float missChance = victim->GetUnitMissChance();
|
||||
|
||||
// melee attacks while dual wielding have +19% chance to miss
|
||||
if (!spellId && haveOffhandWeapon())
|
||||
@@ -12774,9 +12769,16 @@ float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, i
|
||||
else
|
||||
missChance -= m_modMeleeHitChance;
|
||||
|
||||
// Limit miss chance from 0 to 60%
|
||||
RoundToInterval(missChance, 0.f, 60.f);
|
||||
return missChance;
|
||||
// Limit miss chance to 60%
|
||||
missChance = std::min(missChance, 60.f);
|
||||
|
||||
// miss chance from SPELL_AURA_MOD_ATTACKER_xxx_HIT_CHANCE can exceed 60% miss cap (eg aura 50240)
|
||||
if (attType == RANGED_ATTACK)
|
||||
missChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
|
||||
else
|
||||
missChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);
|
||||
|
||||
return std::max(missChance, 0.f);
|
||||
}
|
||||
|
||||
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
|
||||
@@ -977,7 +977,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
float GetUnitDodgeChance(WeaponAttackType attType, Unit const* victim) const;
|
||||
float GetUnitParryChance(WeaponAttackType attType, Unit const* victim) const;
|
||||
float GetUnitBlockChance(WeaponAttackType attType, Unit const* victim) const;
|
||||
float GetUnitMissChance(WeaponAttackType attType) const;
|
||||
float GetUnitMissChance() const;
|
||||
float GetUnitCriticalChanceDone(WeaponAttackType attackType) const;
|
||||
float GetUnitCriticalChanceTaken(Unit const* attacker, WeaponAttackType attackType, float critDone) const;
|
||||
float GetUnitCriticalChanceAgainst(WeaponAttackType attackType, Unit const* victim) const;
|
||||
|
||||
Reference in New Issue
Block a user