Core/Entities: implement SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, fixes talent Point of no Escape
This commit is contained in:
1 parent
9d5ff93e27
commit
7a4c33bc66
2 files changed
+23
-1
No files matched your search
@@ -2667,6 +2667,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);
|
||||
|
||||
if (crit < 0.0f)
|
||||
@@ -9240,6 +9249,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();
|
||||
}
|
||||
}
|
||||
|
||||
AuraEffectList const& critAuras = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
|
||||
for (AuraEffectList::const_iterator i = critAuras.begin(); i != critAuras.end(); ++i)
|
||||
if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectingSpell(spellProto))
|
||||
|
||||
Reference in new issue
Block a user