aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2009-08-23 23:45:15 +0200
committerMachiavelli <none@none>2009-08-23 23:45:15 +0200
commitc7820372693a6ecd62e7b70acab33da760fa04de (patch)
treedb15a9df19a3718d0984c555dd8490c11d73a24a /src/game/Unit.cpp
parenta6e2196247602eb1ce1dc854dc4afd87c63e8f53 (diff)
* Do not calculate resist chance twice in spells.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 567741cfad9..69143f8cab3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2785,10 +2785,6 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
// Reduce spell hit chance for dispel mechanic spells from victim SPELL_AURA_MOD_DISPEL_RESIST
if (IsDispelSpell(spell))
modHitChance-=pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
- // Chance resist mechanic (select max value from every mechanic spell effect)
- int32 resist_chance = pVictim->GetMechanicResistChance(spell);
- // Apply mod
- modHitChance-=resist_chance;
int32 HitChance = modHitChance * 100;
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
@@ -2809,24 +2805,13 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
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 = GetEffectMechanic(spell, eff);
- if (effect_mech)
- {
- int32 temp = pVictim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech);
- if (resist_mech < temp*100)
- resist_mech = temp*100;
- }
- }
+ int32 resist_chance = pVictim->GetMechanicResistChance(spell);
+ tmp += resist_chance;
// Chance resist debuff
tmp -= pVictim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel));
- // Roll chance
- tmp += resist_mech;
+ // Roll chance
if (rand < tmp)
return SPELL_MISS_RESIST;