Core/Spells: rework part 2: Split up target selection logic

Target check only determines what kind of entities we can target, spell positivity determines if that entity is valid for attack/assist
This commit is contained in:
ariel- authored and Ovahlord committed 2022-09-12 09:15:13 +02:00
1 parent 95bc5dcc40
commit 98a988a77a
6 files changed
+140 -110

No files matched your search

+2 -2
View File
@@ -2048,12 +2048,12 @@ SpellCastResult SpellInfo::CheckExplicitTarget(Unit const* caster, WorldObject c
if (neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER))
{
if (neededTargets & TARGET_FLAG_UNIT_ENEMY)
if (caster->_IsValidAttackTarget(unitTarget, this))
if (caster->IsValidAttackTarget(unitTarget, this))
return SPELL_CAST_OK;
if (neededTargets & TARGET_FLAG_UNIT_ALLY
|| (neededTargets & TARGET_FLAG_UNIT_PARTY && caster->IsInPartyWith(unitTarget))
|| (neededTargets & TARGET_FLAG_UNIT_RAID && caster->IsInRaidWith(unitTarget)))
if (caster->_IsValidAssistTarget(unitTarget, this))
if (caster->IsValidAssistTarget(unitTarget, this))
return SPELL_CAST_OK;
if (neededTargets & TARGET_FLAG_UNIT_MINIPET)
if (unitTarget->GetGUID() == caster->GetCritterGUID())