diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2016-07-19 02:57:01 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2016-07-19 02:57:01 -0300 |
| commit | 2feb53ecb69d66bb6df3f48d9a5f4e6a00aec1f7 (patch) | |
| tree | 12fab66768d5baa39686a612c8ba7258c244c0f0 /src/server/game/Entities/Unit | |
| parent | ef85d01746b744d563d7c17a0734bf7e562dfab0 (diff) | |
Core/Entities: implement SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, fixes talent Point of no Escape
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ba8fc5d920b..75458eae12d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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; } |
