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:
@@ -1201,8 +1201,10 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
|
|||||||
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
|
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
|
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_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)
|
if (Entry == VISUAL_WAYPOINT)
|
||||||
SetVisible(false);
|
SetVisible(false);
|
||||||
|
|
||||||
|
|||||||
@@ -1775,13 +1775,11 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
|||||||
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
|
||||||
|
|
||||||
// only spells with SPELL_ATTR3_ONLY_ON_GHOSTS can target ghosts
|
// only spells with SPELL_ATTR3_ONLY_ON_GHOSTS can target ghosts
|
||||||
if (((IsRequiringDeadTarget() != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST)) && !(IsDeathPersistent() && IsAllowingDeadTarget()))
|
if (IsRequiringDeadTarget() && !unitTarget->HasAuraType(SPELL_AURA_GHOST))
|
||||||
{
|
|
||||||
if (AttributesEx3 & SPELL_ATTR3_ONLY_ON_GHOSTS)
|
|
||||||
return SPELL_FAILED_TARGET_NOT_GHOST;
|
return SPELL_FAILED_TARGET_NOT_GHOST;
|
||||||
else
|
|
||||||
|
if (!IsDeathPersistent() && !IsAllowingDeadTarget())
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
}
|
|
||||||
|
|
||||||
if (caster != unitTarget)
|
if (caster != unitTarget)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user