Ejemplo n.º 1
0
        public override bool Execute(bool isSimualtion = false)
        {
            bool valid = false;

            if (Validate())
            {
                APawn        allyPawn  = CurPlayer.GetPawnAt(AllyPos);
                Dijkstra     didi      = new Dijkstra(Boards.GetBoard(), AllyPos, allyPawn.MovePoints);
                List <Coord> moveRange = didi.GetValidPaths(Command.MOVE);
                if (moveRange.Contains(Target))
                {
                    valid = true;
                    allyPawn.Erase(Boards);
                    allyPawn.Position = Target;
                    allyPawn.Place(Boards);
                    allyPawn.Adapt(Boards.TerrainAt(AllyPos), Boards.TerrainAt(Target));
                }
                else
                {
                    ErrorMsg = OUT_OF_RANGE;
                }
            }
            if (!ErrorMsg.Equals("") && !isSimualtion)
            {
                UserUtils.PrintError(ErrorMsg);
                Console.ReadLine();
            }

            return(valid);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This method will execute every turn event for the player. For instance, a pawn respawn
 /// rate.
 /// </summary>
 /// <param name="boards">The board where events should be executed.</param>
 public void ExecuteTurnEvents(Board boards)
 {
     CultCenter.Regen();
     if (Turn % CultCenter.GetUnitsPerTurn() == 0 && Pawns.Count < 6)
     {
         APawn pawn = CultCenter.GeneratePawn(boards);
         if (pawn != null)
         {
             pawn.Place(boards);
             AddPawn(pawn);
         }
         else
         {
             UserUtils.PrintError("Can not create more pawns!");
             Console.ReadLine();
         }
     }
 }