* Do not calculate resist chance twice in spells.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-08-23 23:45:15 +02:00
parent a6e2196247
commit c782037269

View File

@@ -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;