aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp51
1 files changed, 10 insertions, 41 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 1383391ff8d..4092d0db626 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -71,40 +71,9 @@
extern NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EFFECTS];
-SpellDestination::SpellDestination()
+SpellDestination::SpellDestination(WorldObject const& wObj) : _position(wObj.GetMapId(), wObj),
+ _transportGUID(wObj.GetTransGUID()), _transportOffset(wObj.GetTransOffset())
{
- _position.Relocate(0, 0, 0, 0);
- _transportGUID.Clear();
- _transportOffset.Relocate(0, 0, 0, 0);
-}
-
-SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId)
-{
- _position.Relocate(x, y, z, orientation);
- _transportGUID.Clear();
- _position.m_mapId = mapId;
- _transportOffset.Relocate(0, 0, 0, 0);
-}
-
-SpellDestination::SpellDestination(Position const& pos)
-{
- _position.Relocate(pos);
- _transportGUID.Clear();
- _transportOffset.Relocate(0, 0, 0, 0);
-}
-
-SpellDestination::SpellDestination(WorldLocation const& loc)
-{
- _position.WorldRelocate(loc);
- _transportGUID.Clear();
- _transportOffset.Relocate(0, 0, 0, 0);
-}
-
-SpellDestination::SpellDestination(WorldObject const& wObj)
-{
- _transportGUID = wObj.GetTransGUID();
- _transportOffset.Relocate(wObj.GetTransOffsetX(), wObj.GetTransOffsetY(), wObj.GetTransOffsetZ(), wObj.GetTransOffsetO());
- _position.Relocate(wObj);
}
void SpellDestination::Relocate(Position const& pos)
@@ -1178,8 +1147,8 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo,
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id, spellEffectInfo.EffectIndex))
{
SpellDestination dest(*m_caster);
- if (st->target_mapId == m_caster->GetMapId() && m_caster->IsInDist(st->target_X, st->target_Y, st->target_Z, range))
- dest = SpellDestination(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
+ if (st->GetMapId() == m_caster->GetMapId() && m_caster->IsInDist(st, range))
+ dest = st->GetPosition();
else
{
float randomRadius = spellEffectInfo.CalcRadius(m_caster, targetIndex);
@@ -1503,16 +1472,16 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id, spellEffectInfo.EffectIndex))
{
/// @todo fix this check
- if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_WITH_SPELL_VISUAL_KIT_LOADING_SCREEN) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND))
- dest = SpellDestination(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
- else if (st->target_mapId == m_caster->GetMapId())
- dest = SpellDestination(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_TELEPORT_UNITS) || spellEffectInfo.IsEffect(SPELL_EFFECT_TELEPORT_WITH_SPELL_VISUAL_KIT_LOADING_SCREEN) || spellEffectInfo.IsEffect(SPELL_EFFECT_BIND))
+ dest = *st;
+ else if (st->GetMapId() == m_caster->GetMapId())
+ dest = st->GetPosition();
}
else
{
TC_LOG_DEBUG("spells", "SPELL: unknown target coordinates for spell ID {}", m_spellInfo->Id);
if (WorldObject* target = m_targets.GetObjectTarget())
- dest = SpellDestination(*target);
+ dest = *target;
}
break;
case TARGET_DEST_CASTER_FISHING:
@@ -1630,7 +1599,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
case TARGET_DEST_CASTER_FRONT_RIGHT:
case TARGET_DEST_CASTER_BACK_RIGHT:
{
- static float const DefaultTotemDistance = 3.0f;
+ constexpr float DefaultTotemDistance = 3.0f;
if (!spellEffectInfo.HasRadius(targetIndex))
dist = DefaultTotemDistance;
break;