diff options
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 55830952a9a..b252dc0b731 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4337,15 +4337,22 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE; + Optional<Movement::SpellEffectExtraData> spellEffectExtraData; + if (effectInfo->MiscValueB) + { + spellEffectExtraData = boost::in_place(); + spellEffectExtraData->Target = unitTarget->GetGUID(); + spellEffectExtraData->SpellVisualId = effectInfo->MiscValueB; + } // Spell is not using explicit target - no generated path if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK) { //unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); - m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed); + m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, false, unitTarget, spellEffectExtraData.get_ptr()); } else - m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath, speed); + m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath, speed, unitTarget, spellEffectExtraData.get_ptr()); } if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -4361,10 +4368,10 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) { - if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) + if (!destTarget) return; - if (m_targets.HasDst()) + if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) { Position pos = destTarget->GetPosition(); float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY()); @@ -4373,6 +4380,11 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); } + else if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) + { + if (effectInfo->TriggerSpell) + m_caster->CastSpell(unitTarget, effectInfo->TriggerSpell, true, nullptr, nullptr, m_originalCasterGUID); + } } void Spell::EffectKnockBack(SpellEffIndex /*effIndex*/) |