From e9e2d65b4299d71dc15e368dab9b45ff309f5a88 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 13 Sep 2022 18:46:37 +0200 Subject: [PATCH] Core/Units: allow ranged attacks to be blocked --- src/server/game/Entities/Unit/Unit.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index db7da74cf3..ed648a0a07 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2311,12 +2311,11 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo canBlock = false; } - // Ranged attacks can only miss, resist and deflect + // Ranged attacks can only miss, resist and deflect and get blocked if (attType == RANGED_ATTACK) { canDodge = false; canParry = false; - canBlock = false; // only if in front if (!victim->HasUnitState(UNIT_STATE_CONTROLLED) && (victim->HasInArc(float(M_PI), this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))) @@ -2326,7 +2325,6 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo if (roll < tmp) return SPELL_MISS_DEFLECT; } - return SPELL_MISS_NONE; } // Check for attack from behind @@ -2334,10 +2332,10 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo { if (!victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { - // Can`t dodge from behind in PvP (but its possible in PvE) + // Can't dodge from behind in PvP (but its possible in PvE) if (victim->GetTypeId() == TYPEID_PLAYER) canDodge = false; - // Can`t parry or block + // Can't parry or block canParry = false; canBlock = false; }