fix(Core/Spells): Resolve invalid spell casts on dead players when the cast is valid. (#20712)

* Initial fix for #20509

* small revert

* Two way visibility between ghosts.

* clean up temporary changes.

* clean up debug code.

* small typo

* revert .gitignore

* fix codestyle

* Add missing flag, resolve issue where cast was failing while alive.

* Update SpellInfo.cpp

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

---------

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Riley S.
2024-11-30 14:18:32 -05:00
committed by GitHub
parent 00109faa86
commit e9137d4d4d
2 changed files with 8 additions and 8 deletions

View File

@@ -1201,8 +1201,10 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
}
else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units
{
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
}
if (Entry == VISUAL_WAYPOINT)
SetVisible(false);

View File

@@ -1775,13 +1775,11 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
// only spells with SPELL_ATTR3_ONLY_ON_GHOSTS can target ghosts
if (((IsRequiringDeadTarget() != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST)) && !(IsDeathPersistent() && IsAllowingDeadTarget()))
{
if (AttributesEx3 & SPELL_ATTR3_ONLY_ON_GHOSTS)
return SPELL_FAILED_TARGET_NOT_GHOST;
else
return SPELL_FAILED_BAD_TARGETS;
}
if (IsRequiringDeadTarget() && !unitTarget->HasAuraType(SPELL_AURA_GHOST))
return SPELL_FAILED_TARGET_NOT_GHOST;
if (!IsDeathPersistent() && !IsAllowingDeadTarget())
return SPELL_FAILED_BAD_TARGETS;
if (caster != unitTarget)
{