diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 089b9cd45..9ee693b29 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2234,7 +2234,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f))); } -float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim) +float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo /*= nullptr*/) { float victimResistance = static_cast(victim->GetResistance(schoolMask)); if (owner) @@ -2252,7 +2252,8 @@ float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMa } victimResistance = std::max(victimResistance, 0.0f); - if (owner) + + if (owner && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL))) victimResistance += std::max(static_cast(victim->GetLevel() - owner->GetLevel()) * 5.0f, 0.0f); float level = static_cast(victim->GetLevel()); @@ -3555,9 +3556,8 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100; } - // Players resistance for binary spells if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_HOLY)) == 0) - tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage + tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim, spellInfo) * 10000.0f); } // Roll chance diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 94ec2e962..cd0639da7 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1191,7 +1191,7 @@ public: int32 GetMechanicResistChance(SpellInfo const* spell); [[nodiscard]] uint32 GetResistance(SpellSchoolMask mask) const; [[nodiscard]] uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(static_cast(UNIT_FIELD_RESISTANCES) + school); } - static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim); + static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr); void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(static_cast(UNIT_FIELD_RESISTANCES) + school, val); } void UpdateResistanceBuffModsMod(SpellSchools school);