From 2c643fe7d0fe3623fe2263330f8fa276152588f1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 10 Jun 2024 00:13:57 +0200 Subject: Core/Spells: Implemented SPELL_ATTR9_FORCE_DEST_LOCATION (cherry picked from commit 84c84b66d43d655a6fc9f6e75acbc1107dfadf23) --- src/server/game/Spells/Spell.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 38946defeba..24c7adb71bf 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1182,7 +1182,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, { float randomRadius = spellEffectInfo.CalcRadius(m_caster, targetIndex); if (randomRadius > 0.0f) - m_caster->MovePositionToFirstCollision(dest._position, randomRadius, targetType.CalcDirectionAngle()); + MovePosition(dest._position, m_caster, randomRadius, targetType.CalcDirectionAngle()); } CallScriptDestinationTargetSelectHandlers(dest, spellEffectInfo.EffectIndex, targetType); @@ -1269,7 +1269,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, { SpellDestination dest(*target); if (randomRadius > 0.0f) - target->MovePositionToFirstCollision(dest._position, randomRadius, targetType.CalcDirectionAngle()); + MovePosition(dest._position, target, randomRadius, targetType.CalcDirectionAngle()); if (m_spellInfo->HasAttribute(SPELL_ATTR4_USE_FACING_FROM_SPELL)) dest._position.SetOrientation(spellEffectInfo.PositionFacing); @@ -1594,7 +1594,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn Position pos = dest._position; - unitCaster->MovePositionToFirstCollision(pos, dist, angle); + MovePosition(pos, unitCaster, dist, angle); dest.Relocate(pos); break; } @@ -1641,7 +1641,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn dist = objSize; Position pos = dest._position; - m_caster->MovePositionToFirstCollision(pos, dist, angle); + MovePosition(pos, m_caster, dist, angle); dest.Relocate(pos); break; @@ -1674,7 +1674,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectIn float dist = spellEffectInfo.CalcRadius(nullptr, targetIndex); Position pos = dest._position; - target->MovePositionToFirstCollision(pos, dist, angle); + MovePosition(pos, target, dist, angle); dest.Relocate(pos); break; @@ -1714,7 +1714,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo Position pos = dest._position; float angle = pos.GetAbsoluteAngle(m_caster) - m_caster->GetOrientation(); - m_caster->MovePositionToFirstCollision(pos, dist, angle); + MovePosition(pos, m_caster, dist, angle); pos.SetOrientation(m_caster->GetAbsoluteAngle(dest._position)); dest.Relocate(pos); @@ -1726,7 +1726,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex); Position pos = dest._position; - m_caster->MovePositionToFirstCollision(pos, dist, angle); + MovePosition(pos, m_caster, dist, angle); dest.Relocate(pos); break; @@ -9006,6 +9006,14 @@ bool Spell::IsWithinLOS(WorldObject const* source, Position const& target, VMAP: return source->IsWithinLOS(target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), LINEOFSIGHT_ALL_CHECKS, ignoreFlags); } +void Spell::MovePosition(Position& pos, WorldObject const* from, float dist, float angle) const +{ + if (m_spellInfo->HasAttribute(SPELL_ATTR9_FORCE_DEST_LOCATION)) + from->MovePosition(pos, dist, angle); + else + from->MovePositionToFirstCollision(pos, dist, angle); +} + namespace Trinity { -- cgit v1.2.3