public static void FollowCardInstructions(Card card, Player player, List<Player> listOfPlayers)
        {
            if (card.getMoneyModifier != 0)             // Check if we need to do anything money related
            {
                bool negative = false;                  // Temporary bool to check if the money modifier is negative
                if (card.getMoneyModifier < 0)
                    negative = true;                    // Set negative flag

                switch (card.getPerPlayer)              // Check if the card affects all players
                {
                    case true:                          // Case when card affects all players
                        switch (negative)               // Check if we're removing money
                        {
                            case true:                  // Case when we're removing money from current player (current player pays all other players)
                                foreach (Player p in listOfPlayers)
                                    if (player != p)    // Player cannot pay him/herself
                                        player.CurrentPlayerPaysPlayer(p, Math.Abs(card.getMoneyModifier));     // Pay each player the amount
                                break;
                            case false:                 // Case when player pays the bank
                                foreach (Player p in listOfPlayers)
                                    if (player != p)    // Player cannot be paid by him/herself
                                        p.CurrentPlayerPaysPlayer(player, Math.Abs(card.getMoneyModifier));     // Each player pays the current player the amount
                                break;
                        }
                        break;
                    case false:                         // Case when card does not affect all players
                        switch (negative)               // Check if we're removing money
                        {
                            case true:                  // Case when we're removing money
                                player.PlayerPaysBank(Math.Abs(card.getMoneyModifier));         // Player pays bank
                                break;
                            case false:                 // Case when we're adding money
                                player.BankPaysPlayer(Math.Abs(card.getMoneyModifier));         // Bank pays player
                                break;
                        }
                        break;
                }
            }

            if (card.getMoveModifier != 0)              // Check if we need to do a move modification
            {
                // Note: since there are no cards that do this yet, going to skip this for now
            }

            if (card.getMovePosition != 0)              // Check if we need to do a position movement
            {
                if (card.getSpecialCardType == SpecialCardType.CanPassGo)   // Check if the card actually moves around the board
                {
                    if (player.CurrentBoardPosition > card.getMovePosition && player.CurrentBoardPosition <= 47)    // Check if the player will pass Go from his or her current location
                        player.BankPaysPlayer(200);         // Pay 200 since player will pass Go

                }
                MovePlayer(player, card.getMovePosition);
            }

            if (card.getSpecialCardType == SpecialCardType.GetOutOfJailFreeCard)
            {
                player.FreeJailCards += 1;          // Give player a get out of jail free card
                Game1.debugMessageQueue.addMessageToQueue("Player \"" + player.getName + "\" gets a Get Out of Jail Free Card");
            }
        }
Exemple #2
0
        private void PlayerOptions(Player player)
        {
            int currentTile = player.CurrentBoardPosition;
            TileType currentTileType = Tiles[currentTile].getTileType;

            optionPurchaseOrAuctionProperty = false;
            optionDevelopProperty = false;

            // Determine Player Options and take any actions required
            switch (currentTileType)
            {
                case TileType.Property:
                    PropertyTile currentProperty = (PropertyTile)Tiles[currentTile];

                    if (currentProperty.Owner == null)                  // If the property is not owned yet
                        optionPurchaseOrAuctionProperty = true;
                    else if (currentProperty.Owner != player && !currentProperty.MortgageStatus)    // If the property is owned by another player and not mortgaged
                    {
                        if (player.getMoney >= currentProperty.getRent) // Check if the player has enough money to pay Rent
                        {
                            player.CurrentPlayerPaysPlayer(currentProperty.Owner, currentProperty.getRent);     // Pay rent
                            turnPhase = 2;          // Go to next phase
                        }
                        else
                            optionPromptMortgageOrTrade = true;         // Player must decide to mortgage or trade to get money
                    }
                    else
                        // Otherwise, player landed on his or her own property, so go to next phase
                        turnPhase = 2;

                    break;

                case TileType.Utility:
                    UtilityTile currentUtility = (UtilityTile)Tiles[currentTile];
                    UtilityTile otherUtility;

                    if (currentTile == 15)
                        otherUtility = (UtilityTile)Tiles[33];
                    else
                        otherUtility = (UtilityTile)Tiles[15];

                    if (currentUtility.Owner == null)               // If the property is not owned yet
                        optionPurchaseOrAuctionUtility = true;

                    else if (currentUtility.Owner != player && !currentUtility.MortgageStatus)        // If the property is owned by another player
                    {
                        int utilityRent;                           // Calculate the amount to pay for Utility Rent

                        if (currentUtility.Owner == otherUtility.Owner)     // Check if player owns both utilities
                            utilityRent = (int)currentDiceRoll * 10;
                        else
                            utilityRent = (int)currentDiceRoll * 4;

                        if (player.getMoney >= utilityRent)                 // Check if the player has enough money to pay Rent
                        {
                            player.CurrentPlayerPaysPlayer(currentUtility.Owner, utilityRent);  // Pay rent
                            turnPhase = 2;              // Go to next phase
                        }
                        else
                            optionPromptMortgageOrTrade = true;             // Player must decide to mortgage or trade to get money
                    }
                    else
                        // Otherwise, player landed on his or her own property, so go to next phase
                        turnPhase = 2;
                    break;

                case TileType.Chance:
                    Card drawnChanceCard = ChanceCards.drawCard();                              // Draw the Chance card
                    SoshiLandGameFunctions.FollowCardInstructions(drawnChanceCard, player, ListOfPlayers);
                    turnPhase = 2;
                    break;
                case TileType.CommunityChest:
                    Card drawnCommunityChestCard = CommunityChestCards.drawCard();              // Draw the Community Chest card
                    SoshiLandGameFunctions.FollowCardInstructions(drawnCommunityChestCard, player, ListOfPlayers);
                    turnPhase = 2;
                    break;
                case TileType.FanMeeting:
                    turnPhase = 2;              // Nothing happens, so go to last phase
                    break;
                case TileType.Jail:
                    turnPhase = 2;              // Nothing happens, so go to last phase
                    break;
                case TileType.ShoppingSpree:
                        currentTurnsPlayers.PlayerPaysBank(75); // Pay Bank taxes
                        turnPhase = 2;
                    break;
                case TileType.SpecialLuxuryTax:
                        Game1.debugMessageQueue.addMessageToQueue("Player " + "\"" + currentTurnsPlayers.getName + "\"" + " must choose to pay 10% of net worth, or $200");
                        Game1.debugMessageQueue.addMessageToQueue("Press K to pay 10% of net worth, or L to pay $200");
                        optionPromptLuxuryTax = true;
                    break;
                case TileType.GoToJail:
                    SoshiLandGameFunctions.MovePlayerToJail(player);
                    break;
                case TileType.Go:
                    turnPhase = 2;
                    break;
            }

            optionsCalculated = true;

            if (Game1.DEBUG)
            {
                string optionsMessage = "Options Available: Trade,";
                if (optionDevelopProperty)
                    optionsMessage = optionsMessage + " Develop,";
                if (optionPurchaseOrAuctionProperty || optionPurchaseOrAuctionUtility)
                    optionsMessage = optionsMessage + " Purchase/Auction";

                Game1.debugMessageQueue.addMessageToQueue(optionsMessage);
            }
        }
Exemple #3
0
        public static void FollowCardInstructions(Card card, Player player, List <Player> listOfPlayers)
        {
            if (card.getMoneyModifier != 0)             // Check if we need to do anything money related
            {
                bool negative = false;                  // Temporary bool to check if the money modifier is negative
                if (card.getMoneyModifier < 0)
                {
                    negative = true;                    // Set negative flag
                }
                switch (card.getPerPlayer)              // Check if the card affects all players
                {
                case true:                              // Case when card affects all players
                    switch (negative)                   // Check if we're removing money
                    {
                    case true:                          // Case when we're removing money from current player (current player pays all other players)
                        foreach (Player p in listOfPlayers)
                        {
                            if (player != p)                                                        // Player cannot pay him/herself
                            {
                                player.CurrentPlayerPaysPlayer(p, Math.Abs(card.getMoneyModifier)); // Pay each player the amount
                            }
                        }
                        break;

                    case false:                         // Case when player pays the bank
                        foreach (Player p in listOfPlayers)
                        {
                            if (player != p)                                                        // Player cannot be paid by him/herself
                            {
                                p.CurrentPlayerPaysPlayer(player, Math.Abs(card.getMoneyModifier)); // Each player pays the current player the amount
                            }
                        }
                        break;
                    }
                    break;

                case false:                                                     // Case when card does not affect all players
                    switch (negative)                                           // Check if we're removing money
                    {
                    case true:                                                  // Case when we're removing money
                        player.PlayerPaysBank(Math.Abs(card.getMoneyModifier)); // Player pays bank
                        break;

                    case false:                                                 // Case when we're adding money
                        player.BankPaysPlayer(Math.Abs(card.getMoneyModifier)); // Bank pays player
                        break;
                    }
                    break;
                }
            }

            if (card.getMoveModifier != 0)              // Check if we need to do a move modification
            {
                // Note: since there are no cards that do this yet, going to skip this for now
            }

            if (card.getMovePosition != 0)                                                                       // Check if we need to do a position movement
            {
                if (card.getSpecialCardType == SpecialCardType.CanPassGo)                                        // Check if the card actually moves around the board
                {
                    if (player.CurrentBoardPosition > card.getMovePosition && player.CurrentBoardPosition <= 47) // Check if the player will pass Go from his or her current location
                    {
                        player.BankPaysPlayer(200);                                                              // Pay 200 since player will pass Go
                    }
                }
                MovePlayer(player, card.getMovePosition);
            }

            if (card.getSpecialCardType == SpecialCardType.GetOutOfJailFreeCard)
            {
                player.FreeJailCards += 1;          // Give player a get out of jail free card
                Game1.debugMessageQueue.addMessageToQueue("Player \"" + player.getName + "\" gets a Get Out of Jail Free Card");
            }
        }
Exemple #4
0
        private void PlayerOptions(Player player)
        {
            int      currentTile     = player.CurrentBoardPosition;
            TileType currentTileType = Tiles[currentTile].getTileType;

            optionPurchaseOrAuctionProperty = false;
            optionDevelopProperty           = false;

            // Determine Player Options and take any actions required
            switch (currentTileType)
            {
            case TileType.Property:
                PropertyTile currentProperty = (PropertyTile)Tiles[currentTile];

                if (currentProperty.Owner == null)                      // If the property is not owned yet
                {
                    optionPurchaseOrAuctionProperty = true;
                }
                else if (currentProperty.Owner != player && !currentProperty.MortgageStatus)            // If the property is owned by another player and not mortgaged
                {
                    if (player.getMoney >= currentProperty.getRent)                                     // Check if the player has enough money to pay Rent
                    {
                        player.CurrentPlayerPaysPlayer(currentProperty.Owner, currentProperty.getRent); // Pay rent
                        turnPhase = 2;                                                                  // Go to next phase
                    }
                    else
                    {
                        optionPromptMortgageOrTrade = true;             // Player must decide to mortgage or trade to get money
                    }
                }
                else
                {
                    // Otherwise, player landed on his or her own property, so go to next phase
                    turnPhase = 2;
                }


                break;

            case TileType.Utility:
                UtilityTile currentUtility = (UtilityTile)Tiles[currentTile];
                UtilityTile otherUtility;

                if (currentTile == 15)
                {
                    otherUtility = (UtilityTile)Tiles[33];
                }
                else
                {
                    otherUtility = (UtilityTile)Tiles[15];
                }

                if (currentUtility.Owner == null)                   // If the property is not owned yet
                {
                    optionPurchaseOrAuctionUtility = true;
                }

                else if (currentUtility.Owner != player && !currentUtility.MortgageStatus) // If the property is owned by another player
                {
                    int utilityRent;                                                       // Calculate the amount to pay for Utility Rent

                    if (currentUtility.Owner == otherUtility.Owner)                        // Check if player owns both utilities
                    {
                        utilityRent = (int)currentDiceRoll * 10;
                    }
                    else
                    {
                        utilityRent = (int)currentDiceRoll * 4;
                    }


                    if (player.getMoney >= utilityRent)                                    // Check if the player has enough money to pay Rent
                    {
                        player.CurrentPlayerPaysPlayer(currentUtility.Owner, utilityRent); // Pay rent
                        turnPhase = 2;                                                     // Go to next phase
                    }
                    else
                    {
                        optionPromptMortgageOrTrade = true;                 // Player must decide to mortgage or trade to get money
                    }
                }
                else
                {
                    // Otherwise, player landed on his or her own property, so go to next phase
                    turnPhase = 2;
                }
                break;

            case TileType.Chance:
                Card drawnChanceCard = ChanceCards.drawCard();                                  // Draw the Chance card
                SoshiLandGameFunctions.FollowCardInstructions(drawnChanceCard, player, ListOfPlayers);
                turnPhase = 2;
                break;

            case TileType.CommunityChest:
                Card drawnCommunityChestCard = CommunityChestCards.drawCard();                  // Draw the Community Chest card
                SoshiLandGameFunctions.FollowCardInstructions(drawnCommunityChestCard, player, ListOfPlayers);
                turnPhase = 2;
                break;

            case TileType.FanMeeting:
                turnPhase = 2;                  // Nothing happens, so go to last phase
                break;

            case TileType.Jail:
                turnPhase = 2;                  // Nothing happens, so go to last phase
                break;

            case TileType.ShoppingSpree:
                currentTurnsPlayers.PlayerPaysBank(75);         // Pay Bank taxes
                turnPhase = 2;
                break;

            case TileType.SpecialLuxuryTax:
                Game1.debugMessageQueue.addMessageToQueue("Player " + "\"" + currentTurnsPlayers.getName + "\"" + " must choose to pay 10% of net worth, or $200");
                Game1.debugMessageQueue.addMessageToQueue("Press K to pay 10% of net worth, or L to pay $200");
                optionPromptLuxuryTax = true;
                break;

            case TileType.GoToJail:
                SoshiLandGameFunctions.MovePlayerToJail(player);
                break;

            case TileType.Go:
                turnPhase = 2;
                break;
            }

            optionsCalculated = true;

            if (Game1.DEBUG)
            {
                string optionsMessage = "Options Available: Trade,";
                if (optionDevelopProperty)
                {
                    optionsMessage = optionsMessage + " Develop,";
                }
                if (optionPurchaseOrAuctionProperty || optionPurchaseOrAuctionUtility)
                {
                    optionsMessage = optionsMessage + " Purchase/Auction";
                }

                Game1.debugMessageQueue.addMessageToQueue(optionsMessage);
            }
        }