aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-07-04 22:00:46 +0200
committerjackpoz <giacomopoz@gmail.com>2014-07-04 22:00:46 +0200
commit4302226a853811f1346ca96a78af0e649cdb4580 (patch)
tree56a3efc46b5a2bc9fa3176473dd7753e8f4753d3 /src
parent53a469a52b72e0a5e55e2d7f8c92be766247a50b (diff)
Core/Spells: Fix Charge pathing
Fallback to "straight path" pathing when raycast doesn't find a valid path. Fixes #7931
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Spell.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 0e0443cc675..1407a4975d9 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5046,12 +5046,19 @@ SpellCastResult Spell::CheckCast(bool strict)
//target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
Position pos = target->GetFirstCollisionPosition(CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
+ //first try with raycast, if it fails fall back to normal path
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(), false, true);
if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH)
- return SPELL_FAILED_NOPATH;
+ {
+ result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize(), false, false);
+ 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;
}