Ejemplo n.º 1
0
 /// <summary>
 /// Add an army movement order to the attack plan
 /// </summary>
 /// <param name="order">Movement order for an army joining the attack</param>
 public void AddMovementOrder(ArmyMovementOrder order)
 {
     if (_province == order.GetDestination())
     {
         _orders.Add(order);
         if (!_areHeroesInvolved)
         {
             List <Unit> attackers = order.GetUnits();
             for (int i = 0; i < attackers.Count; i++)
             {
                 _areHeroesInvolved = _areHeroesInvolved || attackers[i].GetUnitType().IsHero();
             }
         }
     }
     else
     {
         FileLogger.Error("AI", "Trying to add an order to move to " + order.GetDestination().GetName() + " to a plan to attack " + _province.GetName());
     }
 }
 /// <summary>
 /// Add an army movement order to the collection
 /// </summary>
 /// <param name="order">Army movement order to add to the collection</param>
 /// <returns>True if the order was added, false if another order with the same origin and destination was found and updated</returns>
 public bool AddArmyMovementOrder(ArmyMovementOrder order)
 {
     for (int i = 0; i < _orders.Count; i++)
     {
         if (_orders[i].GetOrigin() == order.GetOrigin() && _orders[i].GetDestination() == order.GetDestination())
         {
             _orders[i].AddUnits(order.GetUnits());
             return(false);
         }
     }
     _orders.Add(order);
     return(true);
 }