public RunForRune(IAbilityUnit unit, RunePosition <T> rune, List <Vector3> path) : base(OrderType.TakeRune, unit, "Running for rune") { this.Path = path; this.RunePosition = rune; this.ShouldExecuteFast = true; this.Color = Color.LightPink; }
public override bool ShouldTakeRune(RunePosition <PowerUpRune> rune) { if (rune.HasRune && rune.CurrentRune.SourceRune.RuneType == RuneType.Illusion) { return(false); } return(false); }
public override bool ShouldTakeRune(RunePosition <BountyRune> rune) { var time = Game.GameTime; if (time < 0) { if (rune.Team == this.Unit.Team.Name) { return(false); } } if (rune != null && rune.HasRune && this.Unit.Owner.Position.Current.Distance2D(rune.Position) < 300) { return(false); } return(true); }
public BearRuneForRune(IAbilityUnit unit, RunePosition <BountyRune> rune, List <Vector3> path) : base(unit, rune, path) { }
private bool TakeBountyRune() { if (this.Unit.Position.PredictedByLatency.Distance2D(this.lastOrderPosition) > 500 || this.lastOrderPosition == Vector3.Zero) { var list = new List <RunePosition <BountyRune> >(this.AbilityMapData.BountyRuneSpawner.Positions); // if (this.latestBounty != null) // { // list.Remove(this.latestBounty); // } foreach (var runePosition in this.AbilityMapData.BountyRuneSpawner.Positions) { if (!this.ShouldTakeRune(runePosition)) { list.Remove(runePosition); } } if (list.Any()) { this.orderedBounties = list.OrderBy(position => position.Position.Distance2D(this.Unit.Position.PredictedByLatency)); this.ClosestBounty = this.orderedBounties.First(); this.lastOrderPosition = this.Unit.Position.PredictedByLatency; this.latestBounty = null; } } foreach (var runePosition in this.orderedBounties) { if (runePosition.HasRune && runePosition.CurrentRune != null && this.Unit.Position.PredictedByLatency.Distance2D(runePosition.Position) < 350) { if (this.ShouldTakeRune(runePosition)) { Console.WriteLine("pickup order sent"); this.Unit.OrderQueue.EnqueueOrder(new PickUpRune(this.Unit, runePosition.CurrentRune)); this.Sleeper.Sleep(1000); return(true); } } } if (!this.AutoRunToTake && (Game.GameTime > 0 || !this.TakeBountyOnStart)) { return(false); } if (this.Unit.Fighting) { return(false); } List <Vector3> path; var walkDuration = this.Unit.Pathfinder.PathDistance(this.ClosestBounty.Position, out path) / this.Unit.SourceUnit.MovementSpeed; if (this.ClosestBounty.HasRune && this.ClosestBounty.CurrentRune != null && !this.ClosestBounty.CurrentRune.Disposed || this.ClosestBounty.NextSpawnTime - Game.GameTime < walkDuration + 5 && this.ClosestBounty.NextSpawnTime - Game.GameTime >= walkDuration) { if (this.ShouldRunForRune(this.ClosestBounty)) { Console.WriteLine("run for rune order sent"); this.latestBounty = this.ClosestBounty; this.EnqueueRunForRune(path); this.Sleeper.Sleep(1000); return(true); } } return(false); }
public virtual bool ShouldTakeRune(RunePosition <PowerUpRune> rune) { return(true); }
public virtual bool ShouldTakeRune(RunePosition <BountyRune> rune) { return(true); }
public virtual void EnqueueRunForRune(RunePosition <PowerUpRune> rune) { }
public virtual void EnqueueRunForRune(RunePosition <BountyRune> rune) { }