mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 04:59:41 -04:00
Core/Entities: implement SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, fixes talent Point of no Escape
This commit is contained in:
@@ -2844,6 +2844,15 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victi
|
||||
else
|
||||
crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
|
||||
|
||||
AuraEffectList const& critChanceForCaster = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
|
||||
for (AuraEffect const* aurEff : critChanceForCaster)
|
||||
{
|
||||
if (aurEff->GetCasterGUID() != GetGUID())
|
||||
continue;
|
||||
|
||||
crit += aurEff->GetAmount();
|
||||
}
|
||||
|
||||
crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
|
||||
|
||||
// reduce crit chance from Rating for players
|
||||
@@ -10255,6 +10264,19 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
|
||||
|
||||
// for this types the bonus was already added in GetUnitCriticalChance, do not add twice
|
||||
if (spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE && spellProto->DmgClass != SPELL_DAMAGE_CLASS_RANGED)
|
||||
{
|
||||
AuraEffectList const& critChanceForCaster = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
|
||||
for (AuraEffect const* aurEff : critChanceForCaster)
|
||||
{
|
||||
if (aurEff->GetCasterGUID() != GetGUID() || !aurEff->IsAffectedOnSpell(spellProto))
|
||||
continue;
|
||||
|
||||
crit_chance += aurEff->GetAmount();
|
||||
}
|
||||
}
|
||||
|
||||
return crit_chance > 0.0f ? crit_chance : 0.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user