From 99bf49e0ddc3419daf7645ef3e42c0e0aa8164b3 Mon Sep 17 00:00:00 2001 From: KJack Date: Mon, 16 Oct 2023 18:07:47 -0400 Subject: [PATCH] Fix (core/SpellEffects): Don't randomize summoned guardian position if target is in the DB (#17506) * Doesn't randomize placement of guardian summons if the target position was specified in the DB * Add `HasRadius()` check * Add check for zero-radius effects, update IF condition style * Accept IF condition statement suggestion Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --- src/server/game/Spells/SpellEffects.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ea793ce8a..7080b5c8f 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -6057,8 +6057,11 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* Position pos; // xinef: do not use precalculated position for effect summon pet in this function - // it means it was cast by NPC and should have its position overridden - if (totalNumGuardians == 1 && GetSpellInfo()->Effects[i].Effect != SPELL_EFFECT_SUMMON_PET) + // it means it was cast by NPC and should have its position overridden unless the + // target position is specified in the DB AND the effect has no or zero radius + if ((totalNumGuardians == 1 && GetSpellInfo()->Effects[i].Effect != SPELL_EFFECT_SUMMON_PET) || + (GetSpellInfo()->Effects[i].TargetA.GetTarget() == TARGET_DEST_DB && + (!GetSpellInfo()->Effects[i].HasRadius() || GetSpellInfo()->Effects[i].RadiusEntry->RadiusMax == 0))) { pos = *destTarget; }