diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index 54827765c87..91c20f49ad5 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -3061,6 +3061,12 @@ void Creature::SetCanDualWield(bool state) UpdateDamagePhysical(OFF_ATTACK); } +bool Creature::CanDaze() const +{ + // Generally, only npcs are able to daze targets in melee + return (!IsPlayerControlled() && !GetSettings().HasFlag(CreatureStaticFlags4::CANNOT_DAZE)); +} + bool Creature::CanRestockPickpocketLoot() const { return GetMap()->GetCurrentClockTime() >= m_pickpocketRestockTime; diff --git a/src/game/Entities/Creature.h b/src/game/Entities/Creature.h index 884051c737e..e7214f31e5c 100644 --- a/src/game/Entities/Creature.h +++ b/src/game/Entities/Creature.h @@ -814,6 +814,8 @@ class Creature : public Unit bool hasWeaponForAttack(WeaponAttackType type) const override { return (Unit::hasWeaponForAttack(type) && hasWeapon(type)); } virtual void SetCanDualWield(bool value) override; + virtual bool CanDaze() const override; + void SetInvisible(bool invisible) { m_isInvisible = invisible; } bool IsInvisible() const { return m_isInvisible; } diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 99dfa25180f..c4bdc54cf23 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -3267,12 +3267,6 @@ bool Unit::CanGlance() const return false; } -bool Unit::CanDaze() const -{ - // Generally, only npcs are able to daze targets in melee - return (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)); -} - void Unit::SetCanDodge(const bool flag) { if (m_canDodge == flag) diff --git a/src/game/Entities/Unit.h b/src/game/Entities/Unit.h index ba54d680077..d3fb9f26cef 100644 --- a/src/game/Entities/Unit.h +++ b/src/game/Entities/Unit.h @@ -1591,7 +1591,7 @@ class Unit : public WorldObject // Unit Melee events API: Crush/Glance/Daze bool CanCrush() const; bool CanGlance() const; - bool CanDaze() const; + virtual bool CanDaze() const { return false; }; void SetCanDodge(const bool flag); void SetCanParry(const bool flag);