aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilds <ivoselva@gmail.com>2011-12-10 01:43:04 +0100
committerWilds <ivoselva@gmail.com>2011-12-10 22:09:48 +0100
commit65e8ff16ad2cbf89dc0676a946fb88c44f49882f (patch)
tree7e3ee6f250ebba5457ace66814120f3b856385aa /src
parent196159dbcfeaa6d3a581a2fb6119d537a4b39baf (diff)
Core/Spells: fix charge and chargedest effect through textures
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 4eb514c5869..034e38916ef 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -6226,9 +6226,13 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
- float x, y, z;
- unitTarget->GetContactPoint(m_caster, x, y, z);
- m_caster->GetMotionMaster()->MoveCharge(x, y, z);
+ float angle = unitTarget->GetRelativeAngle(m_caster);
+ Position pos;
+
+ unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
+ unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetObjectSize(), angle);
+
+ m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ + unitTarget->GetObjectSize());
}
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -6249,9 +6253,13 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
if (m_targets.HasDst())
{
- float x, y, z;
- m_targets.GetDst()->GetPosition(x, y, z);
- m_caster->GetMotionMaster()->MoveCharge(x, y, z);
+ Position pos;
+ m_targets.GetDst()->GetPosition(&pos);
+ float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY());
+ float dist = m_caster->GetDistance(pos);
+ m_caster->GetFirstCollisionPosition(pos, dist, angle);
+
+ m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
}
}