public void referenceAllDataContracts(ActionCard ac, Card c, FieldUpdateMessage fum, Message msg, MoneyCard mc, PlayerBank pb, PlayerHand ph, PlayerModel pm, PlayerPropertySets pps, PlayFieldModel pfm, PlayPile pp, PollForFieldUpdateMessage pffum, PropertyCard pc, PropertyCardSet pcs, PropertySetInfo psi, RentStandard rs, TakeActionOnTurnMessage taotm, TurnActionModel tam)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Plays a Wild Rent Card on a players turn.
        /// </summary>
        /// <param name="currentState"></param>
        /// <param name="nextState"></param>
        /// <param name="playerPerformingAction"></param>
        /// <param name="nextStatePhase"></param>
        /// <param name="moveInformation"></param>
        /// <returns></returns>
        private BoolResponseBox playActionCardRentMultiColor(PlayFieldModel currentState, PlayFieldModel nextState, PlayerModel playerPerformingAction, Statephase nextStatePhase, MoveInfo moveInformation)
        {
            //Check
            //Perform action in next state
            //Clone the current state to create next state then draws 5 cards in the next state
            nextState = currentState.clone(generateGuidForNextState());
            PlayerModel playerModelForPlayer = getPlayerModel(playerPerformingAction.guid, nextState);
            PlayerModel playerModelForPlayerToRent = getPlayerModel(moveInformation.guidOfPlayerToPayRent, nextState);
            Card cardInHandToBePlayed = nextState.deck.getCardByID(moveInformation.idOfCardBeingUsed);
            //Get the reference to the players playerModel in the current PlayFieldModel

            //Get the reference to the Card in the current PlayFieldModel
            if (cardInHandToBePlayed != null && cardInHandToBePlayed is ActionCard && ((ActionCard)cardInHandToBePlayed).actionType.CompareTo(ActionCardAction.RentMultiColor) == 0)
            {
                Card card = removeCardFromHand(cardInHandToBePlayed, playerModelForPlayer);
                if (card != null)
                {
                    ActionCard actionCard = card as ActionCard;
                    PropertyCardSet ps = getPropertyCardSet(playerModelForPlayer.propertySets, moveInformation.guidOfSetToCollectRentOnAgainstOnePlayer);
                    if (ps != null)
                    {
                        //rent card is wild so is compatible
                        PropertySetInfo psinfo = new PropertySetInfo(ps.getPropertySetColor());
                        int rentValue = psinfo.getRentValue(ps.getPropertySetColor(), ps.properties.Count, ps.hasHouse, ps.hasHotel);

                        nextState.actionCardEvent = new ActionCardEvent();
                        nextState.actionCardEvent.actionTypeTaken = TurnActionTypes.PlayActionCard;
                        nextState.actionCardEvent.actionCardTypeUsed = ActionCardAction.RentMultiColor;
                        nextState.actionCardEvent.doubleTheRentCardUsed = false;

                        //Double the rent card is being used
                        if (moveInformation.isDoubleTheRentCardBeingUsed == true)
                        {
                            ActionCard cardDoubleTheRentPlayed = removeCardFromHand(nextState.deck.getCardByID(moveInformation.idOfDoubleTheRentCardBeingUsed), playerModelForPlayer) as ActionCard;
                            if (cardDoubleTheRentPlayed != null && cardDoubleTheRentPlayed.actionType.CompareTo(ActionCardAction.DoubleTheRent) == 0)
                            {
                                //Check if the player has not played more than one card on turn so far
                                if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_0_Cards_Played) == 0 || currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_1_Cards_Played) == 0)
                                {
                                    rentValue *= 2;
                                    nextState.actionCardEvent.doubleTheRentCardUsed = true;
                                }
                                else
                                {
                                    return new BoolResponseBox(false, "Can not use double the rent card as you do not have enough card plays left in your turn");
                                }
                            }
                            else
                            {
                                //Card is not in hand
                                return new BoolResponseBox(false, "Double the rent card selected is not in players hand");
                            }
                        }

                        //Do action
                        playerModelForPlayerToRent.owesAnotherPlayer = true;
                        playerModelForPlayerToRent.amountOwedToAnotherPlayer = rentValue;

                        //Change state on success
                        //has been performed, advance the phase of the game
                        nextState.currentPhase = nextStatePhase;
                        //Put card in discard pile
                        nextState.playpile.playCardOnPile(actionCard);
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, nextState);

                        updateAllowableStatesDebtPaid(nextState, notOnTurn, onTurn, nextState.guidOfPlayerWhosTurnItIs, setAllowableActionsNotOnTurnInDebt(new List<TurnActionTypes>(), nextState));

                        //change the current state to the next state
                        addNextState(nextState);
                        return new BoolResponseBox(true, "Player:" + playerPerformingAction.name + " Has used a Wild Rent Card");
                    }
                }

                return new BoolResponseBox(false, "Card is not in hand.");
            }
            return new BoolResponseBox(false, "Card is not in hand or is not a Wild Rent card");
        }
 public void referenceAllDataContracts(ActionCard ac, Card c, FieldUpdateMessage fum, Message msg, MoneyCard mc, PlayerBank pb, PlayerHand ph, PlayerModel pm, PlayerPropertySets pps, PlayFieldModel pfm, PlayPile pp, PollForFieldUpdateMessage pffum, PropertyCard pc, PropertyCardSet pcs, PropertySetInfo psi, RentStandard rs, TakeActionOnTurnMessage taotm, TurnActionModel tam)
 {
     throw new NotImplementedException();
 }