/// <summary> /// Calcs the max gain using this many ships. /// </summary> /// <param name="source">The source.</param> /// <param name="arrival">The arrival.</param> /// <param name="numShips">The num ships.</param> /// <returns></returns> internal PlanetTurn CalcMaxGainUsingThisManyShips(Planet source, int arrival, int numShips) { Planet clone = Clone(true); clone.CreateTurns(TurnPrediction.Count); Fleet attack = new Fleet(1, numShips, source, clone, arrival, arrival); clone.CreateTurnPredictions(); return(clone.TurnPrediction.LastTurn); }
protected bool ExecutePlans(AttackPlan sweetPlan) { bool movemade = false; foreach (AttackPlanParticipant attacker in sweetPlan.Participants) { Planet agressor = attacker.Source; agressor.IsInAttackQueue = attacker.ScheduledTurn > 0; if (attacker.ScheduledTurn <= 0) { if (attacker.DefendersTurn.Owner != 1 || sweetPlan.DominationMove) { if (agressor.IsMine) { int ships = attacker.AttackersTurn.NumShips; if (!sweetPlan.Target.IsMine) { ships = Math.Min(attacker.DefendersTurn.NumShips + 1, ships); } ships = Math.Min(ships, agressor.AttackForce); currentUniverse.MakeMove(agressor, sweetPlan.Target, ships); movemade = true; agressor.CreateTurnPredictions(); } } } else { //attacker.Source.MaxDesertersAllowed = 0; } attacker.ScheduledTurn--; } if (sweetPlan.Target.IsMine || sweetPlan.Participants.Count == 0) { foreach (AttackPlanParticipant attacker in sweetPlan.Participants) { attacker.Source.IsInAttackQueue = false; } attackQueue.Remove(sweetPlan); } sweetPlan.Target.AttackMovesAllowed = false; return(movemade); }