Core/MMaps: Implement pathed charge effect

This commit is contained in:
kaelima committed 2012-09-03 20:30:47 +02:00
1 parent c7fed98b9d
commit d7eeebe0f3
9 files changed
+69 -24

No files matched your search

+13 -13
View File
@@ -63,6 +63,7 @@
#include "GameObjectAI.h"
#include "AccountMgr.h"
#include "InstanceScript.h"
#include "PathGenerator.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -5133,25 +5134,24 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
{
if (!unitTarget)
return;
if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
{
if (!unitTarget)
return;
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 (m_preGeneratedPath.getPathType() & PATHFIND_NOPATH)
{
Position pos;
unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster));
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
}
else
m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath);
}
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
{
if (!unitTarget)
return;
// not all charge effects used in negative spells
if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->Attack(unitTarget, true);