diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-02-13 20:21:26 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-02-13 20:21:26 +0100 |
| commit | d926ad63c037457198cec8a28a86863643d92dc6 (patch) | |
| tree | f75b8869059d5dcb6816ece0a9872f2ec1bc4ced /src/server/game/Spells/Spell.cpp | |
| parent | 20cd6cfc61414c47a6ed784e62f967ca6b44960e (diff) | |
Core/Spells: Fixed charge effects with non-explicit targets
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 18dc6f104a4..53bcd6bd077 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5148,26 +5148,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: |
