diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2016-07-06 03:58:59 -0300 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-02-04 23:59:07 +0100 |
| commit | ad6e0b6d79d1110898b7fa530a5e35c3b7763dc8 (patch) | |
| tree | 748195ef11730b08c49e12bb86fca3ccf3492113 /src | |
| parent | 9f9692427a95faeca7f4f80ca75f5b0fea766d0b (diff) | |
Core/Unit: remove duplicate resist roll in Unit::MeleeSpellHitResult (#17520)
(cherry picked from commit cfbfa8158ac1220aaed669fde77e1fd96e70a96e)
# Conflicts:
# src/server/game/Entities/Unit/Unit.cpp
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3ea3305f99c..db8c96b25b2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2289,37 +2289,19 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo if (roll < tmp) return SPELL_MISS_MISS; - // Chance resist mechanic (select max value from every mechanic spell effect) - int32 resist_mech = 0; - // Get effects mechanic and chance - for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff) - { - int32 effect_mech = spellInfo->GetEffectMechanic(eff, GetMap()->GetDifficultyID()); - if (effect_mech) - { - int32 temp = victim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech); - if (resist_mech < temp * 100) - resist_mech = temp * 100; - } - } - // Roll chance - tmp += resist_mech; + // Chance resist mechanic + int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100; + tmp += resist_chance; if (roll < tmp) return SPELL_MISS_RESIST; - bool canDodge = true; - bool canParry = true; - bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_BLOCKABLE_SPELL); - - // Same spells cannot be parry/dodge + // Same spells cannot be parried/dodged if (spellInfo->HasAttribute(SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK)) return SPELL_MISS_NONE; - // Chance resist mechanic - int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100; - tmp += resist_chance; - if (roll < tmp) - return SPELL_MISS_RESIST; + bool canDodge = true; + bool canParry = true; + bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_BLOCKABLE_SPELL); // Ranged attacks can only miss, resist and deflect if (attType == RANGED_ATTACK) |
