Skip to content

Commit

Permalink
Spell: Implement usage of restriction skip attributes for basic things
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Mar 17, 2024
1 parent 77a097f commit d723409
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4997,6 +4997,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// TODO: Find a nicer and more efficient way to check for this
if (!IsSpellWithScriptUnitTarget(m_spellInfo))
{
bool ignoreRestrictions = m_spellInfo->HasAttribute(SPELL_ATTR_EX3_IGNORE_CASTER_AND_TARGET_RESTRICTIONS) || m_spellInfo->HasAttribute(SPELL_ATTR_EX5_IGNORE_TARGET_REQUIREMENTS);
// target state requirements (not allowed state), apply to self also
if (m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
return SPELL_FAILED_TARGET_AURASTATE;
Expand All @@ -5020,13 +5021,12 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_TARGET_AURASTATE;

// Not allow casting on flying player
if (target->IsTaxiFlying())
if (!ignoreRestrictions && !m_spellInfo->HasAttribute(SPELL_ATTR_ALLOW_WHILE_MOUNTED) && target->IsTaxiFlying())
{
switch (m_spellInfo->Id)
{
// Except some spells from Taxi Flying cast
case 7720: // Ritual of Summoning Effect
case 36573: // Vision Guide
case 42316: // Alcaz Survey Credit
case 42385: // Alcaz Survey Aura
break;
Expand Down Expand Up @@ -5079,7 +5079,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
}

if (!selfTargeting && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNTARGETABLE))
if (!selfTargeting && !ignoreRestrictions && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNTARGETABLE))
return SPELL_FAILED_BAD_TARGETS;

// check creature type
Expand Down Expand Up @@ -6287,6 +6287,12 @@ SpellCastResult Spell::CheckCasterAuras(uint32& param1) const
if (!m_trueCaster->IsUnit())
return SPELL_CAST_OK;

if (m_spellInfo->HasAttribute(SPELL_ATTR_EX3_IGNORE_CASTER_AND_TARGET_RESTRICTIONS))
return SPELL_CAST_OK;

if (m_spellInfo->HasAttribute(SPELL_ATTR_EX5_IGNORE_CASTER_REQUIREMENTS))
return SPELL_CAST_OK;

if (m_spellInfo->HasAttribute(SPELL_ATTR_EX6_NOT_AN_ATTACK))
return SPELL_CAST_OK;

Expand Down

0 comments on commit d723409

Please sign in to comment.