Core/Spells: Remove some incorrect spell attribute checks and add custom attributes instead - it's better to know that there is no attribute for something than to pretend there's one and do ridiculous checks.
This commit is contained in:
1 parent
3bf7035fe1
commit
0bc23239d8
3 files changed
+65
-47
No files matched your search
@@ -4802,8 +4802,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
}
|
||||
|
||||
//check creature type
|
||||
//ignore self casts (including area casts when caster selected as target)
|
||||
// check creature type
|
||||
// ignore self casts (including area casts when caster selected as target)
|
||||
if (non_caster_target)
|
||||
{
|
||||
if (!CheckTargetCreatureType(target))
|
||||
@@ -4813,58 +4813,24 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
else
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
}
|
||||
|
||||
// who can give me an example to show what is the use of this
|
||||
// even if we need check, check by effect rather than whole spell, otherwise 57108, 57143 are broken
|
||||
/*
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
if (non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
{
|
||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
||||
if (IsPositiveSpell(m_spellInfo->Id))
|
||||
{
|
||||
//dispel positivity is dependant on target, don't check it
|
||||
if (m_caster->IsHostileTo(target) && !IsDispel(m_spellInfo))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_caster->IsFriendlyTo(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
// Must be behind the target
|
||||
if ((m_customAttr & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
|
||||
return SPELL_FAILED_NOT_BEHIND;
|
||||
|
||||
// Target must be facing you
|
||||
if ((m_customAttr & SPELL_ATTR0_CU_REQ_TAGRET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
|
||||
return SPELL_FAILED_NOT_INFRONT;
|
||||
|
||||
// Target must not be in combat
|
||||
if (m_spellInfo->AttributesEx & SPELL_ATTR1_NOT_IN_COMBAT_TARGET && target->isInCombat())
|
||||
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
||||
}
|
||||
*/
|
||||
|
||||
if (target)
|
||||
if (IsPositiveSpell(m_spellInfo->Id))
|
||||
if (target->IsImmunedToSpell(m_spellInfo))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
//Must be behind the target.
|
||||
if (m_spellInfo->AttributesEx2 == SPELL_ATTR2_UNK20 && m_spellInfo->AttributesEx & SPELL_ATTR1_UNK9 && target->HasInArc(static_cast<float>(M_PI), m_caster)
|
||||
//Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags
|
||||
&& (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000, 0, 0)))
|
||||
//Mutilate no longer requires you be behind the target as of patch 3.0.3
|
||||
&& (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellInfo->SpellFamilyFlags[1] & 0x200000))
|
||||
//Exclusion for Throw: Facing limitation was added in 3.2.x, but that shouldn't be
|
||||
&& (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellInfo->SpellFamilyFlags[0] & 0x00000001)))
|
||||
{
|
||||
SendInterrupted(2);
|
||||
return SPELL_FAILED_NOT_BEHIND;
|
||||
}
|
||||
|
||||
// Target must be facing you.
|
||||
if ((m_spellInfo->Attributes == (SPELL_ATTR0_ABILITY | SPELL_ATTR0_NOT_SHAPESHIFT | SPELL_ATTR0_DONT_AFFECT_SHEATH_STATE | SPELL_ATTR0_STOP_ATTACK_TARGET)) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
|
||||
{
|
||||
SendInterrupted(2);
|
||||
return SPELL_FAILED_NOT_INFRONT;
|
||||
}
|
||||
|
||||
// check if target is in combat
|
||||
if (non_caster_target && (m_spellInfo->AttributesEx & SPELL_ATTR1_NOT_IN_COMBAT_TARGET) && target->isInCombat())
|
||||
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
||||
}
|
||||
|
||||
// Spell casted only on battleground
|
||||
|
||||
Reference in new issue
Block a user