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:
@@ -4802,8 +4802,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check creature type
|
// check creature type
|
||||||
//ignore self casts (including area casts when caster selected as target)
|
// ignore self casts (including area casts when caster selected as target)
|
||||||
if (non_caster_target)
|
if (non_caster_target)
|
||||||
{
|
{
|
||||||
if (!CheckTargetCreatureType(target))
|
if (!CheckTargetCreatureType(target))
|
||||||
@@ -4813,58 +4813,24 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
else
|
else
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// who can give me an example to show what is the use of this
|
// Must be behind the target
|
||||||
// even if we need check, check by effect rather than whole spell, otherwise 57108, 57143 are broken
|
if ((m_customAttr & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
|
||||||
/*
|
return SPELL_FAILED_NOT_BEHIND;
|
||||||
// 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
|
// Target must be facing you
|
||||||
if (non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
if ((m_customAttr & SPELL_ATTR0_CU_REQ_TAGRET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
|
||||||
{
|
return SPELL_FAILED_NOT_INFRONT;
|
||||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
|
||||||
if (IsPositiveSpell(m_spellInfo->Id))
|
// Target must not be in combat
|
||||||
{
|
if (m_spellInfo->AttributesEx & SPELL_ATTR1_NOT_IN_COMBAT_TARGET && target->isInCombat())
|
||||||
//dispel positivity is dependant on target, don't check it
|
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
||||||
if (m_caster->IsHostileTo(target) && !IsDispel(m_spellInfo))
|
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_caster->IsFriendlyTo(target))
|
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
if (IsPositiveSpell(m_spellInfo->Id))
|
if (IsPositiveSpell(m_spellInfo->Id))
|
||||||
if (target->IsImmunedToSpell(m_spellInfo))
|
if (target->IsImmunedToSpell(m_spellInfo))
|
||||||
return SPELL_FAILED_TARGET_AURASTATE;
|
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
|
// Spell casted only on battleground
|
||||||
|
|||||||
@@ -3785,8 +3785,58 @@ void SpellMgr::LoadSpellCustomAttr()
|
|||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this REALLY needs to be moved to db (so it can be blamed on db guys)
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
case 1776: // Gouge
|
||||||
|
case 1777:
|
||||||
|
case 8629:
|
||||||
|
case 11285:
|
||||||
|
case 11286:
|
||||||
|
case 12540:
|
||||||
|
case 13579:
|
||||||
|
case 24698:
|
||||||
|
case 28456:
|
||||||
|
case 29425:
|
||||||
|
case 34940:
|
||||||
|
case 36862:
|
||||||
|
case 38764:
|
||||||
|
case 38863:
|
||||||
|
case 52743: // Head Smack
|
||||||
|
mSpellCustomAttr[i] |= SPELL_ATTR0_CU_REQ_TAGRET_FACING_CASTER;
|
||||||
|
++count;
|
||||||
|
break;
|
||||||
|
case 53: // Backstab
|
||||||
|
case 2589:
|
||||||
|
case 2590:
|
||||||
|
case 2591:
|
||||||
|
case 8721:
|
||||||
|
case 11279:
|
||||||
|
case 11280:
|
||||||
|
case 11281:
|
||||||
|
case 25300:
|
||||||
|
case 26863:
|
||||||
|
case 48656:
|
||||||
|
case 48657:
|
||||||
|
case 5221: // Shred
|
||||||
|
case 6800:
|
||||||
|
case 8992:
|
||||||
|
case 9829:
|
||||||
|
case 9830:
|
||||||
|
case 27001:
|
||||||
|
case 27002:
|
||||||
|
case 48571:
|
||||||
|
case 48572:
|
||||||
|
case 21987: // Lash of Pain
|
||||||
|
case 23959: // Test Stab R50
|
||||||
|
case 24825: // Test Backstab
|
||||||
|
mSpellCustomAttr[i] |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET;
|
||||||
|
++count;
|
||||||
|
break;
|
||||||
|
case 58563: // Assassinate Restless Lookout
|
||||||
|
mSpellCustomAttr[i] |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET;
|
||||||
|
++count;
|
||||||
|
break;
|
||||||
case 36350: //They Must Burn Bomb Aura (self)
|
case 36350: //They Must Burn Bomb Aura (self)
|
||||||
spellInfo->EffectTriggerSpell[0] = 36325; // They Must Burn Bomb Drop (DND)
|
spellInfo->EffectTriggerSpell[0] = 36325; // They Must Burn Bomb Drop (DND)
|
||||||
++count;
|
++count;
|
||||||
|
|||||||
@@ -1024,6 +1024,8 @@ enum SpellCustomAttributes
|
|||||||
SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00020000,
|
SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00020000,
|
||||||
SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00040000,
|
SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00040000,
|
||||||
SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00080000,
|
SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00080000,
|
||||||
|
SPELL_ATTR0_CU_REQ_TAGRET_FACING_CASTER = 0x00100000,
|
||||||
|
SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00200000,
|
||||||
|
|
||||||
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
|
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user