/// <summary> Query if 'unit' is valid unit. </summary> /// <remarks> Nesox, 2013-06-29. </remarks> private bool IsValidUnit(bool incombat, BattleCharacter unit, BattleCharacter guardian, HotSpot[] hotspots) { if (!unit.IsValid || unit.IsDead || !unit.IsVisible || !unit.IsTargetable || unit.CurrentHealthPercent <= 0) { return(false); } if (IgnoredIds.Contains((int)unit.NpcId)) { return(false); } // Ignore blacklisted mobs if they're in combat with us! if (Blacklist.Contains(unit.ObjectId, BlacklistFlags.Combat)) { return(false); } //Make sure we always return true for units inside our aggro list if (_aggroedBattleCharacters.Contains(unit)) { return(true); } if (!unit.CanAttack) { return(false); } if (guardian != null) { if (guardian.DistanceSqr(unit.Location) <= SoSimpleDutyTag.StaticSearchDistance * SoSimpleDutyTag.StaticSearchDistance) { return(true); } } if (hotspots != null) { if (hotspots.Any(b => b.WithinHotSpot2D(unit.Location, b.Radius))) { return(true); } } return(false); }