Beispiel #1
0
 public Gaia()
 {
     DalrionPpts      = new PawnsPerTerrain(ECultures.DALRIONS);
     RahkarPpts       = new PawnsPerTerrain(ECultures.RAHKARS);
     NearEnemies      = new List <ABasicPawn>();
     DalrionStatistcs = new List <double>()
     {
         0, 0, 0
     };
     RahkarStatistcs = new List <double>()
     {
         0, 0, 0
     };
 }
Beispiel #2
0
        public void DoGaiaWill(Player playerOne, Player playerTwo, Board boards, int turn)
        {
            Random rnd        = new Random();
            int    actionTurn = 10 + rnd.Next(6);

            if (turn % actionTurn == 0)
            {
                InspectField(playerOne, playerTwo, boards);
                Array           terrains       = Enum.GetValues(typeof(ETerrain));
                int             terrain        = rnd.Next(terrains.Length);
                int             cultToCheck    = rnd.Next(2);
                Player          other          = null;
                Player          currPlayer     = null;
                PawnsPerTerrain currPpt        = null;
                List <double>   currStatistics = null;

                if (cultToCheck == 0)
                {
                    if (playerOne.GetCulture() == ECultures.DALRIONS)
                    {
                        currPlayer     = playerOne;
                        other          = playerTwo;
                        currPpt        = DalrionPpts;
                        currStatistics = DalrionStatistcs;
                    }
                    else
                    {
                        currPlayer     = playerTwo;
                        other          = playerOne;
                        currPpt        = RahkarPpts;
                        currStatistics = RahkarStatistcs;
                    }
                }
                else
                {
                    if (playerOne.GetCulture() == ECultures.RAHKARS)
                    {
                        currPlayer     = playerOne;
                        other          = playerTwo;
                        currPpt        = RahkarPpts;
                        currStatistics = RahkarStatistcs;
                    }
                    else
                    {
                        currPlayer     = playerTwo;
                        other          = playerOne;
                        currPpt        = DalrionPpts;
                        currStatistics = DalrionStatistcs;
                    }
                }
                List <APawn> playerPawns = currPlayer.GetPawns();
                string       msg         = "Gaia will now ";
                if (currPpt.PPTs[(ETerrain)terrains.GetValue(terrain)] < 2)
                {
                    if (currStatistics[ENMY_DIST] < 1)
                    {
                        if (currPpt.OccupiedTerrains() > 3)
                        {
                            msg += "increase the defense of pawns at " + (ETerrain)terrains.GetValue(terrain);
                            foreach (APawn pawn in playerPawns)
                            {
                                if (boards.TerrainAt(pawn.Position) == (ETerrain)terrains.GetValue(terrain))
                                {
                                    pawn.Def += 3;
                                }
                            }
                        }
                        else
                        {
                            msg += "set the atk of pawns at " + (ETerrain)terrains.GetValue(terrain) + " to 1!";
                            foreach (APawn pawn in playerPawns)
                            {
                                if (boards.TerrainAt(pawn.Position) == (ETerrain)terrains.GetValue(terrain) &&
                                    pawn is ABasicPawn)
                                {
                                    ABasicPawn bPawn = (ABasicPawn)pawn;
                                    bPawn.Atk = 1;
                                }
                            }
                        }
                    }
                    else if (currStatistics[ENMY_DIST] >= 1 && currStatistics[ENMY_DIST] < 3)
                    {
                        msg += "increase the move points of pawns at " + (ETerrain)terrains.GetValue(terrain);
                        foreach (APawn pawn in playerPawns)
                        {
                            if (boards.TerrainAt(pawn.Position) != (ETerrain)terrains.GetValue(terrain))
                            {
                                pawn.MovePoints += 2;
                            }
                        }
                    }
                    else
                    {
                        if (currStatistics[ALLY_DIST] < 3)
                        {
                            msg += "set the move range of pawns at " + (ETerrain)terrains.GetValue(terrain) + " to 1!";
                            foreach (APawn pawn in playerPawns)
                            {
                                if (boards.TerrainAt(pawn.Position) == (ETerrain)terrains.GetValue(terrain))
                                {
                                    pawn.MovePoints = 1;
                                }
                            }
                        }
                        else if (currStatistics[ALLY_DIST] >= 3 && currStatistics[ALLY_DIST] < 7)
                        {
                            msg += "increase the attack range of pawns at " + (ETerrain)terrains.GetValue(terrain);
                            foreach (APawn pawn in playerPawns)
                            {
                                if (boards.TerrainAt(pawn.Position) == (ETerrain)terrains.GetValue(terrain) &&
                                    pawn is ABasicPawn)
                                {
                                    ABasicPawn bPawn = (ABasicPawn)pawn;
                                    bPawn.AtkRange += 2;
                                }
                            }
                        }
                        else
                        {
                            msg += "set the def of pawns at " + (ETerrain)terrains.GetValue(terrain) + " to 1!";
                            foreach (APawn pawn in playerPawns)
                            {
                                if (boards.TerrainAt(pawn.Position) != (ETerrain)terrains.GetValue(terrain))
                                {
                                    pawn.Def = 1;
                                }
                            }
                        }
                    }
                }

                //UserUtils.PrintSucess(msg + " For " + currPlayer.GetCulture());
                // Console.ReadLine();
            }
        }