mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/Unit: remove duplicate resist roll in Unit::MeleeSpellHitResult (#17520)
This commit is contained in:
@@ -2395,38 +2395,20 @@ 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;
|
||||
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
|
||||
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;
|
||||
|
||||
// Same spells cannot be parried/dodged
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK))
|
||||
return SPELL_MISS_NONE;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user