Core/Spells: Use Unit::IsValidAttack/AssistTarget functions to validate spell explicit targets.
This commit is contained in:
1 parent
31e755c291
commit
9bbb4ef583
2 files changed
+19
-32
No files matched your search
@@ -4781,7 +4781,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
// those spells may have incorrect target entries or not filled at all (for example 15332)
|
||||
// such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead
|
||||
// also, such casts shouldn't be sent to client
|
||||
if (!(((m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && !m_targets.GetUnitTarget()) || m_targets.GetUnitTarget() == m_caster))
|
||||
if (!((m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster)))
|
||||
{
|
||||
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
|
||||
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_originalCaster ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
|
||||
@@ -4818,22 +4818,21 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check pet presence
|
||||
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
// check pet presence
|
||||
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
|
||||
{
|
||||
if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
|
||||
if (!m_caster->GetGuardianPet())
|
||||
{
|
||||
target = m_caster->GetGuardianPet();
|
||||
if (!target)
|
||||
{
|
||||
if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
else
|
||||
return SPELL_FAILED_NO_PET;
|
||||
}
|
||||
break;
|
||||
if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
else
|
||||
return SPELL_FAILED_NO_PET;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user