Core/Spells: Increase search radius for avoid problems with some spells that can't find units with huge combat reach

Port From (https://github.com/TrinityCore/TrinityCore/commit/b52ce8e65e8998df1b243b854129d359ee2d25ae)
This commit is contained in:
hondacrx
2022-06-15 16:09:33 -04:00
parent f91230ae33
commit 0224d95b91
4 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -2712,6 +2712,8 @@ namespace Game.Spells
var condList = spellEffectInfo.ImplicitTargetConditions;
float radius = spellEffectInfo.CalcRadius(refe);
float extraSearchRadius = 0.0f;
SpellTargetCheckTypes selectionType = SpellTargetCheckTypes.Default;
switch (spellEffectInfo.Effect)
{
@@ -2727,6 +2729,7 @@ namespace Game.Spells
break;
case SpellEffectName.ApplyAreaAuraEnemy:
selectionType = SpellTargetCheckTypes.Enemy;
extraSearchRadius = radius > 0.0f ? SharedConst.ExtraCellSearchRadius : 0.0f;
break;
case SpellEffectName.ApplyAreaAuraPet:
if (condList == null || Global.ConditionMgr.IsObjectMeetToConditions(GetUnitOwner(), refe, condList))
@@ -2763,7 +2766,7 @@ namespace Game.Spells
{
WorldObjectSpellAreaTargetCheck check = new(radius, GetUnitOwner(), refe, GetUnitOwner(), GetSpellInfo(), selectionType, condList, SpellTargetObjectTypes.Unit);
UnitListSearcher searcher = new(GetUnitOwner(), units, check);
Cell.VisitAllObjects(GetUnitOwner(), searcher, radius);
Cell.VisitAllObjects(GetUnitOwner(), searcher, radius + extraSearchRadius);
// by design WorldObjectSpellAreaTargetCheck allows not-in-world units (for spells) but for auras it is not acceptable
units.RemoveAll(unit => !unit.IsSelfOrInSameMap(GetUnitOwner()));