aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorVincent_Michael <Vincent_Michael@gmx.de>2013-02-13 21:48:09 +0100
committerVincent_Michael <Vincent_Michael@gmx.de>2013-02-13 21:48:09 +0100
commit3c5bf554ffa58e46eb88aebd46af21335d581432 (patch)
treece6d5856921406bf4be4effdbf8873a9c1419bb5 /src/server/game/Spells/Spell.cpp
parentd292b05ac1fb04be23161072a7386d7f44905fe1 (diff)
parentca280dbe051f2d9c43bbda128a6aa6bc19d8149f (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
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: