mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Spells: define and implement UNIT_FLAG2_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS and corrected sending the correct spell failed message when being too close to a spell cast target
This commit is contained in:
@@ -158,25 +158,26 @@ enum UnitFlags : uint32
|
||||
// Value masks for UNIT_FIELD_FLAGS_2
|
||||
enum UnitFlags2 : uint32
|
||||
{
|
||||
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
|
||||
UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
|
||||
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
|
||||
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
|
||||
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
|
||||
UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
|
||||
UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
|
||||
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
|
||||
UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
|
||||
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
|
||||
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
|
||||
UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
|
||||
UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
|
||||
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
|
||||
UNIT_FLAG2_DISABLE_TURN = 0x00008000,
|
||||
UNIT_FLAG2_UNK2 = 0x00010000,
|
||||
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
|
||||
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
|
||||
UNIT_FLAG2_NO_ACTIONS = 0x00800000
|
||||
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
|
||||
UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
|
||||
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
|
||||
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
|
||||
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
|
||||
UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
|
||||
UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
|
||||
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
|
||||
UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
|
||||
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
|
||||
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
|
||||
UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
|
||||
UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
|
||||
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
|
||||
UNIT_FLAG2_DISABLE_TURN = 0x00008000,
|
||||
UNIT_FLAG2_UNK2 = 0x00010000,
|
||||
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
|
||||
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
|
||||
UNIT_FLAG2_NO_ACTIONS = 0x00800000,
|
||||
UNIT_FLAG2_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS = 0x08000000 // Allows spells with a min range restriction to be cast when closer than given range value
|
||||
};
|
||||
|
||||
/// Non Player Character flags
|
||||
|
||||
@@ -6473,8 +6473,8 @@ SpellCastResult Spell::CheckRange(bool strict) const
|
||||
if (m_caster->GetExactDistSq(target) > maxRange)
|
||||
return SPELL_FAILED_OUT_OF_RANGE;
|
||||
|
||||
if (minRange > 0.0f && m_caster->GetExactDistSq(target) < minRange)
|
||||
return SPELL_FAILED_OUT_OF_RANGE;
|
||||
if (minRange > 0.0f && m_caster->GetExactDistSq(target) < minRange && !target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS))
|
||||
return SPELL_FAILED_TOO_CLOSE;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER &&
|
||||
(((m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target))
|
||||
|
||||
Reference in New Issue
Block a user