public CacheAvoidance(AvoidanceType type, int snoid, int raguid, int acdguid, Vector3 position, string name = "") : base(snoid, raguid, acdguid, position, name) { AvoidanceType = type; AvoidanceValue = FunkyBaseExtension.Settings.Avoidance.Avoidances[(int)type]; targetType = TargetType.Avoidance; }
public CacheAvoidance(CacheObject parent, AvoidanceType type, Ray R, double speed) : base(parent) { AvoidanceType = type; AvoidanceValue = FunkyBaseExtension.Settings.Avoidance.Avoidances[(int)type]; ray_ = R; Speed = speed; projectile_startPosition = base.Position; }
public CacheAvoidance(CacheObject parent, AvoidanceType type, Ray R, double speed) : base(parent) { AvoidanceType = type; AvoidanceValue = Bot.Settings.Avoidance.Avoidances[(int)type]; ray_ = R; Speed = speed; projectile_startPosition = base.Position; }
public CacheAvoidance(CacheObject parent, AvoidanceType avoidancetype) : base(parent) { AvoidanceType = avoidancetype; AvoidanceValue = FunkyBaseExtension.Settings.Avoidance.Avoidances[(int)avoidancetype]; RefreshRemovalCounter = AvoidanceValue.RemovalSeconds; //Special avoidances that require additional loops before removal (note: the loops are checked every 150ms, but obstacles are checked twice!) //if (AvoidanceType.HasFlag(AvoidanceType.TreeSpore) && SNOID == 6578) // RefreshRemovalCounter = 75; //else if (AvoidanceType.HasFlag(AvoidanceType.GrotesqueExplosion)) // RefreshRemovalCounter = 25; //else if (AvoidanceType.HasFlag(AvoidanceType.DemonicForge)) // RefreshRemovalCounter = 10; }
public CacheAvoidance(CacheObject parent, AvoidanceType avoidancetype) : base(parent) { AvoidanceType = avoidancetype; AvoidanceValue = Bot.Settings.Avoidance.Avoidances[(int)avoidancetype]; //Special avoidances that require additional loops before removal (note: the loops are checked every 150ms, but obstacles are checked twice!) if (AvoidanceType.HasFlag(AvoidanceType.TreeSpore) && SNOID == 6578) RefreshRemovalCounter = 75; else if (AvoidanceType.HasFlag(AvoidanceType.GrotesqueExplosion)) RefreshRemovalCounter = 25; else if (AvoidanceType.HasFlag(AvoidanceType.DemonicForge)) RefreshRemovalCounter = 10; }
public double UpdateWeight(out int monstercount, out int avoidcount, ref List <int> UsedRAGUIDs, bool ResetIndex = false) { monstercount = 0; avoidcount = 0; if (ResetIndex) { LastIndexUsed = 0; } OccupiedObjects.Clear(); Vector3 sectorCenter = this.Center; //Get the Diagonal Length between start and end, multiply by 2.5 since each point represents an area of 5f than Divide the total by 2 for the radius range. double range = GridPoint.GetDistanceBetweenPoints(this.StartPoint, this.CornerPoint); int TotalGridPoints = this.ContainedPoints.Count; this.ThisWeight = 0d; //We use 2D Distance and subtract the obstacles radius IEnumerable <CacheObstacle> obstaclesContained = ObjectCache.Obstacles.Values .Where(obs => Math.Max(0f, sectorCenter.Distance2D(obs.Position) - obs.Radius) <= range); double maxaverage = ObjectCache.Objects.MaximumHitPointAverage; if (obstaclesContained.Any()) { //reset weight this.ThisWeight = 0; //copy SectorPoints //GridPoint[] SectorPoints=new GridPoint[this.ContainedPoints.Count]; //this.ContainedPoints.CopyTo(SectorPoints); List <GridPoint> NonNavPoints = new List <GridPoint>(); foreach (CacheObstacle item in obstaclesContained) { OccupiedObjects.Add(item.RAGUID); if (item is CacheServerObject) { //Monsters should add 10% of its weight //if (item.Obstacletype.Value==ObstacleType.Monster) //{ // if (Bot.Settings.Fleeing.EnableFleeingBehavior&& Bot.Targeting.Environment.FleeTrigeringRAGUIDs.Contains(item.RAGUID)) // { // } //} if (item.Obstacletype.Value == ObstacleType.ServerObject) { //give +1 to weight this.ThisWeight++; } } else if (item is CacheAvoidance) { if (!UsedRAGUIDs.Contains(item.RAGUID)) { AvoidanceType thisAvoidanceType = ((CacheAvoidance)item).AvoidanceType; if (AvoidanceCache.IgnoringAvoidanceType(thisAvoidanceType)) { continue; } AvoidanceValue AV = Bot.Settings.Avoidance.Avoidances[(int)thisAvoidanceType]; avoidcount++; float BaseWeight = AV.Weight; //if ((AvoidanceType.ArcaneSentry|AvoidanceType.Dececrator|AvoidanceType.MoltenCore|AvoidanceType.TreeSpore).HasFlag(thisAvoidanceType)) // BaseWeight=1f; //else // BaseWeight=0.5f; this.ThisWeight += (BaseWeight / Bot.Character.Data.dCurrentHealthPct); UsedRAGUIDs.Add(item.RAGUID); } } } ////Now add a base score for non-nav points. (25 being 100% non-navigable) //int PointMultiplier=(25/TotalGridPoints); //int RemainingPoints=SectorPoints.Length; //this.ThisWeight+=25-(RemainingPoints*PointMultiplier); //Logger.DBLog.InfoFormat("Weight assigned to this sector {0}. \r\n" //+"Total Points {1} with {2} Remaining points Valid!", this.ThisWeight, this.ContainedPoints.Count, SectorPoints.Length); } return(this.ThisWeight); //(Total Points / Non-Navigable Points Ratio) }