diff options
5 files changed, 22 insertions, 10 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 56cfd6f4a92..982db89978b 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -363,7 +363,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) MoveJump(x, y, z, speedXY, speedZ); } -void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) +void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id /*= EVENT_JUMP*/, uint32 arrivalSpellId /*= 0*/, ObjectGuid const& arrivalSpellTargetGuid /*= ObjectGuid::Empty*/) { TC_LOG_DEBUG("misc", "Unit (%s) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z); if (speedXY <= 0.1f) @@ -377,7 +377,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee init.SetParabolic(max_height, 0); init.SetVelocity(speedXY); init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); + Mutate(new EffectMovementGenerator(id, arrivalSpellId, arrivalSpellTargetGuid), MOTION_SLOT_CONTROLLED); } void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount) diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index ce0f1f7836e..3cb56e7d9d9 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -181,9 +181,11 @@ class MotionMaster //: private std::stack<MovementGenerator *> void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE); void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ); void MoveJumpTo(float angle, float speedXY, float speedZ); - void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP) - { MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id); } - void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP); + void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty) + { + MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id, arrivalSpellId, arrivalSpellTargetGuid); + } + void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty); void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount); void MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk); void MoveFall(uint32 id = 0); diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 38295f83859..c2f65bfdb84 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -25,6 +25,7 @@ #include "MoveSpline.h" #include "Player.h" #include "CreatureGroups.h" +#include "ObjectAccessor.h" //----- Point Movement Generator template<class T> @@ -134,6 +135,9 @@ bool EffectMovementGenerator::Update(Unit* unit, uint32) void EffectMovementGenerator::Finalize(Unit* unit) { + if (_arrivalSpellId) + unit->CastSpell(ObjectAccessor::GetUnit(*unit, _arrivalSpellTargetGuid), _arrivalSpellId, true); + if (unit->GetTypeId() != TYPEID_UNIT) return; @@ -147,5 +151,5 @@ void EffectMovementGenerator::Finalize(Unit* unit) } if (unit->ToCreature()->AI()) - unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); + unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, _id); } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index f73d51db962..87241276262 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -63,14 +63,17 @@ class AssistanceMovementGenerator : public PointMovementGenerator<Creature> class EffectMovementGenerator : public MovementGenerator { public: - explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) { } + EffectMovementGenerator(uint32 id, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty) + : _id(id), _arrivalSpellId(arrivalSpellId), _arrivalSpellTargetGuid(arrivalSpellTargetGuid) { } void Initialize(Unit*) override { } void Finalize(Unit*) override; void Reset(Unit*) override { } bool Update(Unit*, uint32) override; MovementGeneratorType GetMovementGeneratorType() const override { return EFFECT_MOTION_TYPE; } private: - uint32 m_Id; + uint32 _id; + uint32 _arrivalSpellId; + ObjectGuid _arrivalSpellTargetGuid; }; #endif diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 66cf7173f27..d014119f00c 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -924,7 +924,7 @@ void Spell::EffectJump(SpellEffIndex /*effIndex*/) float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ); - m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); + m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, EVENT_JUMP, effectInfo->TriggerSpell, unitTarget->GetGUID()); } void Spell::EffectJumpDest(SpellEffIndex /*effIndex*/) @@ -944,7 +944,7 @@ void Spell::EffectJumpDest(SpellEffIndex /*effIndex*/) float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ); - m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); + m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, EVENT_JUMP, effectInfo->TriggerSpell); } void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ) @@ -4514,6 +4514,9 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) // not all charge effects used in negative spells if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->Attack(unitTarget, true); + + if (effectInfo->TriggerSpell) + m_caster->CastSpell(unitTarget, effectInfo->TriggerSpell, true, nullptr, nullptr, m_originalCasterGUID); } } |