Merge pull request #4260 from wilds/fix_charge

Core/Spells: fix charge and chargedest effect through textures
This commit is contained in:
Machiavelli
2011-12-16 04:10:24 -08:00
+14 -6
View File
@@ -6244,9 +6244,13 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget) if (!unitTarget)
return; return;
float x, y, z; float angle = unitTarget->GetRelativeAngle(m_caster);
unitTarget->GetContactPoint(m_caster, x, y, z); Position pos;
m_caster->GetMotionMaster()->MoveCharge(x, y, z);
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) if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -6267,9 +6271,13 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
if (m_targets.HasDst()) if (m_targets.HasDst())
{ {
float x, y, z; Position pos;
m_targets.GetDst()->GetPosition(x, y, z); m_targets.GetDst()->GetPosition(&pos);
m_caster->GetMotionMaster()->MoveCharge(x, y, z); 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);
} }
} }