aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp32
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 2f6c68c8bb6..1bd90322857 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -2395,37 +2395,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);
- 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)