mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
fix(Core/Spell): SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER to face caster (#4351)
* fix(Core/Spell): SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER to face caster
* cherry-pick 28353e920b
Co-Authored-By: Meji <2695278+meji46@users.noreply.github.com>
* [[nodiscard]]
* return;
* fix last thing
* build
* Revert "build"
This reverts commit c892cc292f3592c5089840e393b525f74904779b.
* Update Object.h
* Update Object.h
* Update Object.h
Co-authored-by: Meji <2695278+meji46@users.noreply.github.com>
This commit is contained in:
@@ -521,12 +521,16 @@ struct Position
|
||||
|
||||
float GetAngle(const Position* pos) const;
|
||||
[[nodiscard]] float GetAngle(float x, float y) const;
|
||||
float GetAbsoluteAngle(float x, float y) const
|
||||
[[nodiscard]] float GetAbsoluteAngle(float x, float y) const
|
||||
{
|
||||
float dx = x - m_positionX;
|
||||
float dy = y - m_positionY;
|
||||
return NormalizeOrientation(std::atan2(dy, dx));
|
||||
return NormalizeOrientation(std::atan2(
|
||||
static_cast<float>(y - m_positionY),
|
||||
static_cast<float>(x - m_positionX))
|
||||
);
|
||||
}
|
||||
[[nodiscard]] float GetAbsoluteAngle(Position const& pos) const { return GetAbsoluteAngle(pos.m_positionX, pos.m_positionY); }
|
||||
[[nodiscard]] float GetAbsoluteAngle(Position const* pos) const { return GetAbsoluteAngle(*pos); }
|
||||
|
||||
float GetRelativeAngle(const Position* pos) const
|
||||
{
|
||||
return GetAngle(pos) - m_orientation;
|
||||
|
||||
@@ -2761,15 +2761,10 @@ void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex /*effIndex*/)
|
||||
if (!unitTarget || unitTarget->IsInFlight())
|
||||
return;
|
||||
|
||||
if (!m_targets.HasDst())
|
||||
if (m_targets.HasDst())
|
||||
{
|
||||
sLog->outError("Spell::EffectTeleUnitsFaceCaster - does not have destination for spell ID %u\n", m_spellInfo->Id);
|
||||
return;
|
||||
unitTarget->NearTeleportTo(destTarget->GetPositionX(), destTarget->GetPositionY(), destTarget->GetPositionZ(), destTarget->GetAbsoluteAngle(m_caster), unitTarget == m_caster);
|
||||
}
|
||||
|
||||
float x, y, z;
|
||||
destTarget->GetPosition(x, y, z);
|
||||
unitTarget->NearTeleportTo(x, y, z, unitTarget->GetAngle(m_caster));
|
||||
}
|
||||
|
||||
void Spell::EffectLearnSkill(SpellEffIndex effIndex)
|
||||
|
||||
Reference in New Issue
Block a user