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>
This commit is contained in:
KJack
2023-10-16 18:07:47 -04:00
committed by GitHub
parent f820a964cb
commit 99bf49e0dd

View File

@@ -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;
}