diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 299cb71f0..c0e04f22b 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -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(y - m_positionY), + static_cast(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; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 1e39b5d5e..6bf3d5e76 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -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)