Core/Spells: removed miss chance cap for melee attacks

This commit is contained in:
Ovahlord committed 2019-07-26 10:52:49 +02:00
1 parent 41e88fe548
commit 9784be7fce
4 files changed
+12 -33

No files matched your search

+2 -4
View File
@@ -681,14 +681,12 @@ void Player::UpdateArmorPenetration(int32 amount)
void Player::UpdateMeleeHitChances()
{
m_modMeleeHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE);
m_modMeleeHitChance = GetRatingBonusValue(CR_HIT_MELEE);
}
void Player::UpdateRangedHitChances()
{
m_modRangedHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED);
m_modRangedHitChance = GetRatingBonusValue(CR_HIT_RANGED);
}
void Player::UpdateSpellHitChances()
+9 -6
View File
@@ -12749,12 +12749,15 @@ float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, u
else
missChance -= m_modMeleeHitChance;
// Limit miss chance from 0 to 60%
if (missChance < 0.0f)
return 0.0f;
if (missChance > 60.0f)
return 60.0f;
return missChance;
// miss chance from auras after calculating skill based miss
missChance -= GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
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::OnPhaseChange()
@@ -118,7 +118,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
&AuraEffect::HandleAuraModWeaponCritPercent, // 52 SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
&AuraEffect::HandleNoImmediateEffect, // 53 SPELL_AURA_PERIODIC_LEECH implemented in AuraEffect::PeriodicTick
&AuraEffect::HandleModHitChance, // 54 SPELL_AURA_MOD_HIT_CHANCE
&AuraEffect::HandleNoImmediateEffect, // 54 SPELL_AURA_MOD_HIT_CHANCE
&AuraEffect::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
&AuraEffect::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
&AuraEffect::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@@ -3867,27 +3867,6 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
target->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float(GetAmount()), apply);
}
void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit* target = aurApp->GetTarget();
// handle stack rules
if (target->GetTypeId() == TYPEID_PLAYER)
{
target->ToPlayer()->UpdateMeleeHitChances();
target->ToPlayer()->UpdateRangedHitChances();
}
else
{
float value = target->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
target->m_modMeleeHitChance = value;
target->m_modRangedHitChance = value;
}
}
void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
@@ -246,7 +246,6 @@ class TC_GAME_API AuraEffect
void HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool apply) const;