Core/Spells: implement CREATURE_STATIC_FLAG_5_240_DEGREE_BACK_ARC

This commit is contained in:
Ovahlord committed 2023-08-27 18:24:41 +02:00
1 parent 71ecd754ce
commit 94a37eeaa0
1 file changed
+9 -2
+9 -2
View File
@@ -5817,8 +5817,15 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
if (target != m_caster)
{
// Must be behind the target
if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_BEHIND;
if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
{
float arcAngle = static_cast<float>(M_PI);
if (target->IsCreature() && target->ToCreature()->HasStaticFlag(CREATURE_STATIC_FLAG_5_240_DEGREE_BACK_ARC))
arcAngle -= static_cast<float>(M_PI / 3);
if (target->HasInArc(arcAngle, m_caster))
return SPELL_FAILED_NOT_BEHIND;
}
// Target must be facing you
if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))