aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index ba570ad73a4..4c465df7c35 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5189,26 +5189,23 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
return SPELL_FAILED_ROOTED;
- Unit* target = m_targets.GetUnitTarget();
-
- if (!target)
- return SPELL_FAILED_DONT_REPORT;
-
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- if (!target->isAlive())
- return SPELL_FAILED_BAD_TARGETS;
-
- Position pos;
- target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
- target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
+ if (GetSpellInfo()->NeedsExplicitUnitTarget())
+ {
+ Unit* target = m_targets.GetUnitTarget();
+ if (!target)
+ return SPELL_FAILED_DONT_REPORT;
- m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f);
- bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize());
- if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
- return SPELL_FAILED_OUT_OF_RANGE;
- else if (!result)
- return SPELL_FAILED_NOPATH;
+ Position pos;
+ target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
+ target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
+ m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f);
+ bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize());
+ if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
+ return SPELL_FAILED_OUT_OF_RANGE;
+ else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH)
+ return SPELL_FAILED_NOPATH;
+ }
break;
}
case SPELL_EFFECT_SKINNING: