Core/Auras: remove too strict checks in area auras, since a few aren't owned by its caster

Port From (https://github.com/TrinityCore/TrinityCore/commit/95c8eae12340d2df59d63c7f67874d21af46a171)
This commit is contained in:
hondacrx
2021-08-20 18:55:14 -04:00
parent 14392fe24c
commit 9947e778b7
+8 -8
View File
@@ -2544,6 +2544,10 @@ namespace Game.Spells
public override void FillTargetMap(ref Dictionary<Unit, uint> targets, Unit caster) public override void FillTargetMap(ref Dictionary<Unit, uint> targets, Unit caster)
{ {
Unit refe = caster;
if (refe == null)
refe = GetUnitOwner();
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects()) foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
{ {
if (effect == null || !HasEffect(effect.EffectIndex)) if (effect == null || !HasEffect(effect.EffectIndex))
@@ -2554,22 +2558,19 @@ namespace Game.Spells
// non-area aura // non-area aura
if (effect.Effect == SpellEffectName.ApplyAura) if (effect.Effect == SpellEffectName.ApplyAura)
{ {
if (condList == null || Global.ConditionMgr.IsObjectMeetToConditions(GetUnitOwner(), caster, condList)) if (condList == null || Global.ConditionMgr.IsObjectMeetToConditions(GetUnitOwner(), refe, condList))
targetList.Add(GetUnitOwner()); targetList.Add(GetUnitOwner());
} }
else else
{ {
Cypher.Assert(caster != null, $"Area aura (Id: {GetSpellInfo().Id}) has nullptr caster ({GetCasterGUID()})");
Cypher.Assert(GetCasterGUID() == GetUnitOwner().GetGUID(), $"Area aura (Id: {GetSpellInfo().Id}) has owner ({GetUnitOwner().GetGUID()}) different to caster ({GetCasterGUID()})");
// skip area update if owner is not in world! // skip area update if owner is not in world!
if (!GetUnitOwner().IsInWorld) if (!GetUnitOwner().IsInWorld)
continue; continue;
float radius = effect.CalcRadius(caster); if (GetUnitOwner().HasUnitState(UnitState.Isolated))
continue;
if (!GetUnitOwner().HasUnitState(UnitState.Isolated)) float radius = effect.CalcRadius(caster);
{
SpellTargetCheckTypes selectionType = SpellTargetCheckTypes.Default; SpellTargetCheckTypes selectionType = SpellTargetCheckTypes.Default;
switch (effect.Effect) switch (effect.Effect)
{ {
@@ -2627,7 +2628,6 @@ namespace Game.Spells
targetList.RemoveAll(unit => !unit.IsSelfOrInSameMap(GetUnitOwner())); targetList.RemoveAll(unit => !unit.IsSelfOrInSameMap(GetUnitOwner()));
} }
} }
}
foreach (var unit in targetList) foreach (var unit in targetList)
{ {