mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
* Do not calculate resist chance twice in spells.
--HG-- branch : trunk
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user