mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Spells: Fixed extra charge effect visuals
This commit is contained in:
@@ -541,7 +541,8 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
|
||||
void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_CHARGE*/, uint32 id /*= EVENT_CHARGE*/, bool generatePath /*= false*/)
|
||||
void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_CHARGE*/, uint32 id /*= EVENT_CHARGE*/, bool generatePath /*= false*/,
|
||||
Unit const* target /*= nullptr*/, Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/)
|
||||
{
|
||||
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
|
||||
return;
|
||||
@@ -549,17 +550,18 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_C
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
TC_LOG_DEBUG("misc", "Player (%s) charged point (X: %f Y: %f Z: %f).", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed, target), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) charged point (X: %f Y: %f Z: %f).",
|
||||
_owner->GetEntry(), _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed, target), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveCharge(PathGenerator const& path, float speed /*= SPEED_CHARGE*/)
|
||||
void MotionMaster::MoveCharge(PathGenerator const& path, float speed /*= SPEED_CHARGE*/, Unit const* target /*= nullptr*/,
|
||||
Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/)
|
||||
{
|
||||
G3D::Vector3 dest = path.GetActualEndPosition();
|
||||
|
||||
@@ -569,6 +571,10 @@ void MotionMaster::MoveCharge(PathGenerator const& path, float speed /*= SPEED_C
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
init.MovebyPath(path.GetPath());
|
||||
init.SetVelocity(speed);
|
||||
if (target)
|
||||
init.SetFacing(target);
|
||||
if (spellEffectExtraData)
|
||||
init.SetSpellEffectExtraData(*spellEffectExtraData);
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
|
||||
@@ -197,11 +197,11 @@ class TC_GAME_API MotionMaster //: private std::stack<MovementGenerator *>
|
||||
void MoveLand(uint32 id, Position const& pos);
|
||||
void MoveTakeoff(uint32 id, Position const& pos);
|
||||
|
||||
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);
|
||||
void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE);
|
||||
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
|
||||
void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
|
||||
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
|
||||
void MoveJumpTo(float angle, float speedXY, float speedZ);
|
||||
void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP, bool hasOrientation = false, JumpArrivalCastArgs const* arrivalCast = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr)
|
||||
void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP, bool hasOrientation = false, JumpArrivalCastArgs const* arrivalCast = nullptr, ObjectGuid const& target = ObjectGuid::Empty, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr)
|
||||
{
|
||||
MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), speedXY, speedZ, id, hasOrientation, arrivalCast, spellEffectExtraData);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ void PointMovementGenerator<T>::DoInitialize(T* unit)
|
||||
init.MoveTo(i_x, i_y, i_z, m_generatePath);
|
||||
if (speed > 0.0f)
|
||||
init.SetVelocity(speed);
|
||||
if (i_faceTarget)
|
||||
init.SetFacing(i_faceTarget);
|
||||
init.Launch();
|
||||
|
||||
// Call for creature group update
|
||||
|
||||
@@ -26,8 +26,8 @@ template<class T>
|
||||
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, bool _generatePath, float _speed = 0.0f) : id(_id),
|
||||
i_x(_x), i_y(_y), i_z(_z), speed(_speed), m_generatePath(_generatePath), i_recalculateSpeed(false) { }
|
||||
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, bool _generatePath, float _speed = 0.0f, Unit const* faceTarget = nullptr) : id(_id),
|
||||
i_x(_x), i_y(_y), i_z(_z), speed(_speed), i_faceTarget(faceTarget), m_generatePath(_generatePath), i_recalculateSpeed(false) { }
|
||||
|
||||
void DoInitialize(T*);
|
||||
void DoFinalize(T*);
|
||||
@@ -45,6 +45,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
|
||||
uint32 id;
|
||||
float i_x, i_y, i_z;
|
||||
float speed;
|
||||
Unit const* i_faceTarget;
|
||||
bool m_generatePath;
|
||||
bool i_recalculateSpeed;
|
||||
};
|
||||
|
||||
@@ -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*/)
|
||||
|
||||
Reference in New Issue
Block a user