public void OrderRebase(Planet p, bool ClearOrders) { lock (this.wayPointLocker) { this.ActiveWayPoints.Clear(); } if (ClearOrders) { this.OrderQueue.Clear(); } int troops = this.Owner.loyalty.GetShips() .Where(troop => troop.TroopList.Count > 0) .Where(troopAI => troopAI.GetAI().OrderQueue .Where(goal => goal.TargetPlanet != null && goal.TargetPlanet == p).Count() > 0).Count(); if (troops >= p.GetGroundLandingSpots()) { this.OrderQueue.Clear(); this.State = AIState.AwaitingOrders; return; } this.OrderMoveTowardsPosition(p.Position, 0f, new Vector2(0f, -1f), false,p); this.IgnoreCombat = true; ArtificialIntelligence.ShipGoal rebase = new ArtificialIntelligence.ShipGoal(ArtificialIntelligence.Plan.Rebase, Vector2.Zero, 0f) { TargetPlanet = p }; this.OrderQueue.AddLast(rebase); this.State = AIState.Rebase; this.HasPriorityOrder = true; }
public void OrderLandAllTroops(Planet target) { if ((this.Owner.Role == "troop" || this.Owner.HasTroopBay || this.Owner.hasTransporter) && this.Owner.TroopList.Count > 0 && target.GetGroundLandingSpots() >0 ) { this.HasPriorityOrder = true; this.State = AIState.AssaultPlanet; this.OrbitTarget = target; this.OrderQueue.Clear(); ArtificialIntelligence.ShipGoal goal = new ArtificialIntelligence.ShipGoal(ArtificialIntelligence.Plan.LandTroop, Vector2.Zero, 0f) { TargetPlanet = target }; this.OrderQueue.AddLast(goal); } else if (this.Owner.BombBays.Count > 0 && target.GetGroundStrength(this.Owner.loyalty) ==0) //universeScreen.player == this.Owner.loyalty && { this.State = AIState.Bombard; this.OrderBombardTroops(target); } }