diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-01-25 19:35:41 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-01-25 19:35:41 +0100 |
| commit | e0437ca49460d89f968e5986612bbd295539bea2 (patch) | |
| tree | 8b254f4f1398b2a1b1b4ea18c7f53253873969e1 /src/server/game/Movement | |
| parent | 11ad71e2fc322c8e109ffe8cd8c52332a26048bf (diff) | |
Core/Spells: Implemented casting spells on movement finish from SPELL_EFFECT_JUMP, SPELL_EFFECT_JUMP_DEST and SPELL_EFFECT_CHARGE
Diffstat (limited to 'src/server/game/Movement')
4 files changed, 17 insertions, 8 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 |
