Exemplo n.º 1
0
        public int calcCommerceIncome(Card playedCard, GameState gs, int playerId)
        {
            PlayerState thePlayer = gs.getPlayerNum(playerId);

            //System.Console.WriteLine(playedCard.getNumber());
            if (!playedCard.getName().StartsWith("CO"))
            {
                return(0);
            }
            if (playedCard.GetType() != typeof(CommerceCard))
            {
                return(0);
            }
            CommerceCard commCard = (CommerceCard)playedCard;

            if (commCard.getCoins() != 0)
            {
                return(commCard.getCoins());
            }
            if ((commCard.getNumber().Equals(77)) ||
                (commCard.getNumber().Equals(78)))
            {
                return(countCardType(1, thePlayer)
                       + countCardType(1, gs.getLeftPlayer(thePlayer))
                       + countCardType(1, gs.getRightPlayer(thePlayer)));
            }
            if ((commCard.getNumber().Equals(80)) ||
                (commCard.getNumber().Equals(79)))
            {
                return(countCardType(2, thePlayer)
                       + countCardType(2, gs.getLeftPlayer(thePlayer))
                       + countCardType(2, gs.getRightPlayer(thePlayer)));
            }
            //Haven
            if ((commCard.getNumber().Equals(119)) ||
                (commCard.getNumber().Equals(120)))
            {
                return(countCardType(1, thePlayer));
            }
            //LightHouse
            if ((commCard.getNumber().Equals(121)) ||
                (commCard.getNumber().Equals(122)))
            {
                return(countCardType(4, thePlayer));
            }
            //Chamber of Commerce
            if ((commCard.getNumber().Equals(123)) ||
                (commCard.getNumber().Equals(124)))
            {
                return(2 * countCardType(2, thePlayer));
            }
            //Arena
            if ((commCard.getNumber().Equals(125)) ||
                (commCard.getNumber().Equals(126)) ||
                (commCard.getNumber().Equals(127)))
            {
                return(3 * thePlayer.getBoard().getCurrentWonderLevel());
            }
            return(0);
        }
Exemplo n.º 2
0
 public int calcCommerceIncome(Card playedCard, GameState gs, int playerId)
 {
     PlayerState thePlayer = gs.getPlayerNum(playerId);
     //System.Console.WriteLine(playedCard.getNumber());
     if (!playedCard.getName().StartsWith("CO"))
     {
         return 0;
     }
     if(playedCard.GetType() != typeof(CommerceCard))
     {
         return 0;
     }
     CommerceCard commCard = (CommerceCard)playedCard;
     if (commCard.getCoins() != 0)
     {
         return commCard.getCoins();
     }
     if ((commCard.getNumber().Equals(77)) ||
         (commCard.getNumber().Equals(78)))
     {
         return countCardType(1, thePlayer) 
             + countCardType(1, gs.getLeftPlayer(thePlayer))
             + countCardType(1, gs.getRightPlayer(thePlayer));
     }
     if ((commCard.getNumber().Equals(80)) ||
         (commCard.getNumber().Equals(79)))
     {
         return countCardType(2, thePlayer)
             + countCardType(2, gs.getLeftPlayer(thePlayer))
             + countCardType(2, gs.getRightPlayer(thePlayer));
     }
     //Haven
     if ((commCard.getNumber().Equals(119)) ||
         (commCard.getNumber().Equals(120)))
     {
         return countCardType(1, thePlayer);
     }
     //LightHouse
     if ((commCard.getNumber().Equals(121)) ||
         (commCard.getNumber().Equals(122)))
     {
         return countCardType(4, thePlayer);
     }
     //Chamber of Commerce
     if ((commCard.getNumber().Equals(123)) ||
         (commCard.getNumber().Equals(124)))
     {
         return 2 * countCardType(2, thePlayer);
     }
     //Arena
     if ((commCard.getNumber().Equals(125)) ||
         (commCard.getNumber().Equals(126)) ||
         (commCard.getNumber().Equals(127)))
     {
         return 3 * thePlayer.getBoard().getCurrentWonderLevel();
     }
     return 0;
 }
Exemplo n.º 3
0
// Mouse Click on player Buttons 72-78 Red 79-85 blue
        private void playerButton_Click(object sender, EventArgs e)
        {
            Button b  = (Button)sender;
            string p1 = "P1";
            string p2 = "P2";
            string p3 = "P3";
            string p4 = "P4";
            string p5 = "P5";
            string p6 = "P6";
            string p7 = "P7";

            makeCirclesBlack();

            if (b.Name.Equals(p1))
            {
                Ellipse el = (Ellipse)playBoard.Children[72];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(0), game);
            }
            else if (b.Name.Equals(p2))
            {
                Ellipse el = (Ellipse)playBoard.Children[73];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(1), game);
            }
            else if (b.Name.Equals(p3))
            {
                Ellipse el = (Ellipse)playBoard.Children[74];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(2), game);
            }
            else if (b.Name.Equals(p4))
            {
                Ellipse el = (Ellipse)playBoard.Children[75];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(3), game);
            }
            else if (b.Name.Equals(p5))
            {
                Ellipse el = (Ellipse)playBoard.Children[76];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(4), game);
            }
            else if (b.Name.Equals(p6))
            {
                Ellipse el = (Ellipse)playBoard.Children[77];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(5), game);
            }
            else if (b.Name.Equals(p7))
            {
                Ellipse el = (Ellipse)playBoard.Children[78];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(6), game);
            }
        }
Exemplo n.º 4
0
 public Score(GameState g)
 {
     finalScore = new int[g.getPlayers().Count,7];
     for(int i = 0; i < g.getPlayers().Count; i++){
         if (g.players[i].getPlayedCards().Count < 10) {
             g.players[i].setScore(0, 0);
             g.players[i].setScore(0, 1);
             g.players[i].setScore(0, 2);
             g.players[i].setScore(0, 3);
             g.players[i].setScore(0, 4);
             g.players[i].setScore(0, 5);
             g.players[i].setScore(0, 6);
         }
         else
         {
             g.players[i].setScore(militaryScore(g.getPlayerNum(i)), 0);
             g.players[i].setScore(treasuryScore(g.getPlayerNum(i)), 1);
             g.players[i].setScore(WonderScore(g.getPlayerNum(i)), 2);
             g.players[i].setScore(civScore(g.getPlayerNum(i)), 3);
             g.players[i].setScore(sciScore(g.getPlayerNum(i)), 4);
             g.players[i].setScore(comScore(g.getPlayerNum(i)), 5);
             g.players[i].setScore(0, 6);
             //g.players[i].setScore(,7);
         }
     }
 }