Exemplo n.º 1
0
 public RentStandard(ActionCardAction actionType, int value, PropertyColor colorUp, PropertyColor colorDown)
     : base(actionType, value, "RENT " + colorUp + "/" + colorDown, "All players pay you rent for properties you own in one of these colours. Play into centre to use")
 {
     //Collect rent from all players on one of the propery groups they hold with one of these colors
     this.colorDown = colorDown;
     this.colorUp   = colorUp;
 }
Exemplo n.º 2
0
 public RentStandard(ActionCardAction actionType, int value, PropertyColor colorUp, PropertyColor colorDown)
     : base(actionType, value, "RENT " + colorUp + "/" + colorDown, "All players pay you rent for properties you own in one of these colours. Play into centre to use")
 {
     //Collect rent from all players on one of the propery groups they hold with one of these colors
     this.colorDown = colorDown;
     this.colorUp = colorUp;
 }
Exemplo n.º 3
0
 public ActionCard(ActionCardAction actionType, int value, String name, String text, int id, Guid guid, String description, bool monetaryValueOnly)
     : base(name, text, value, CardType.Action, id, guid)
 {
     this.actionType = actionType;
 }
Exemplo n.º 4
0
 public ActionCard(ActionCardAction actionType, int value, String name, String text)
     : base(name, text, value, CardType.Action)
 {
     this.actionType = actionType;
 }
        private void updateState(TurnActionTypes actionToAttemptToPerform, ActionCardAction actionCardType, PlayFieldModel currentState, Guid playerWhoPerformedAction)
        {
            PlayerModel player = getPlayerByGuid(playerWhoPerformedAction, currentState);

            PlayFieldModel newState = copyPlayFieldModel(currentState);

            //List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
            //List<TurnActionTypes> onTurn = new List<TurnActionTypes>();

            #region draw2state

            //draw 2 on turn start state
            if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Draw_2_Cards) == 0)
            {
                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.drawTwoCardsAtStartOfTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_0_Cards_Played;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }
            }

            #endregion draw2state

            #region draw5state

            //draw 5 on turn start state
            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Draw_5_Cards) == 0)
            {
                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.drawFiveCardsAtStartOfTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_0_Cards_Played;
                        //player has drawn their five cards as they started the turn with zero cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }
            }

            #endregion draw5state

            #region Turn_Started_Cards_Drawn_0_Cards_Played

            //draw 2 on turn start state
            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_0_Cards_Played) == 0)
            {
                #region bankActionCard

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.BankActionCard) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_1_Cards_Played;

                        //player has drawn their two cards, Now can play up to three cards on their turn on
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion bankActionCard

                #region endTurn

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.EndTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        switch (player.hand.cardsInHand.Count)
                        {
                            case 8:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 9:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 10:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 11:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 12:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_12_Cards_In_Hand_Discard_5_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            default:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_7_Or_Less_Cards_In_Hand_Setup_NextPlayer;
                                    setNextPlayerOnTurn(newState);
                                    if (getPlayerByGuid(newState.guidOfPlayerWhosTurnItIs, newState).hand.cardsInHand.Count == 0)
                                    {
                                        //Player has 0 cards draws 5 on turn start instead of 2
                                        newState.currentPhase = Statephase.Turn_Started_Draw_5_Cards;
                                        onTurn.Add(TurnActionTypes.drawFiveCardsAtStartOfTurn);
                                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                                    }
                                    else
                                    {
                                        newState.currentPhase = Statephase.Turn_Started_Draw_2_Cards;
                                        onTurn.Add(TurnActionTypes.drawTwoCardsAtStartOfTurn);
                                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                                    }

                                    break;
                                }
                        }

                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion endTurn

                #region playPropertyToNewSet

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayPropertyCard_New_Set) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();

                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        //updateStateForPropertyPlayedToSet(actionToAttemptToPerform, currentState, playerWhoPerformedAction, player, newState);
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_1_Cards_Played;
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion playPropertyToNewSet

                //Play Action

                #region Actions unable to be just say no carded

                #region pass Go

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayActionCard) == 0 && actionCardType.CompareTo(ActionCardAction.PassGo) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_1_Cards_Played;
                        updateStateActionCardPassGo(actionToAttemptToPerform, currentState, playerWhoPerformedAction, player, newState);
                    }
                }

                #endregion pass Go

                #endregion Actions unable to be just say no carded
            }

            #endregion Turn_Started_Cards_Drawn_0_Cards_Played

            #region Turn_Started_Cards_Drawn_1_Cards_Played

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_1_Cards_Played) == 0)
            {
                #region bankActionCard

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.BankActionCard) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_2_Cards_Played;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion bankActionCard

                #region endTurn

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.EndTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        switch (player.hand.cardsInHand.Count)
                        {
                            case 8:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 9:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 10:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 11:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 12:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_12_Cards_In_Hand_Discard_5_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            default:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_7_Or_Less_Cards_In_Hand_Setup_NextPlayer;
                                    setNextPlayerOnTurn(newState);
                                    if (getPlayerByGuid(newState.guidOfPlayerWhosTurnItIs, newState).hand.cardsInHand.Count == 0)
                                    {
                                        //Player has 0 cards draws 5 on turn start instead of 2
                                        newState.currentPhase = Statephase.Turn_Started_Draw_5_Cards;
                                        onTurn.Add(TurnActionTypes.drawFiveCardsAtStartOfTurn);
                                    }
                                    else
                                    {
                                        newState.currentPhase = Statephase.Turn_Started_Draw_2_Cards;
                                        onTurn.Add(TurnActionTypes.drawTwoCardsAtStartOfTurn);
                                    }

                                    break;
                                }
                        }

                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion endTurn

                #region playPropertyToNewSet

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayPropertyCard_New_Set) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();

                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        //updateStateForPropertyPlayedToSet(actionToAttemptToPerform, currentState, playerWhoPerformedAction, player, newState);
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_2_Cards_Played;
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion playPropertyToNewSet

                //Play Action

                #region Actions unable to be just say no carded

                #region pass Go

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayActionCard) == 0 && actionCardType.CompareTo(ActionCardAction.PassGo) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_2_Cards_Played;
                        updateStateActionCardPassGo(actionToAttemptToPerform, currentState, playerWhoPerformedAction, player, newState);
                    }
                }

                #endregion pass Go

                #endregion Actions unable to be just say no carded
            }

            #endregion Turn_Started_Cards_Drawn_1_Cards_Played

            #region Turn_Started_Cards_Drawn_2_Cards_Played

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_2_Cards_Played) == 0)
            {
                //Actions that can be taken on this phase

                #region bankActionCard

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.BankActionCard) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn.Add(TurnActionTypes.SwitchAroundPlayedProperties);
                        onTurn.Add(TurnActionTypes.EndTurn);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion bankActionCard

                #region endTurn

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.EndTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        switch (player.hand.cardsInHand.Count)
                        {
                            case 8:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 9:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 10:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 11:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 12:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_12_Cards_In_Hand_Discard_5_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            default:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_7_Or_Less_Cards_In_Hand_Setup_NextPlayer;
                                    setNextPlayerOnTurn(newState);
                                    if (getPlayerByGuid(newState.guidOfPlayerWhosTurnItIs, newState).hand.cardsInHand.Count == 0)
                                    {
                                        //Player has 0 cards draws 5 on turn start instead of 2
                                        newState.currentPhase = Statephase.Turn_Started_Draw_5_Cards;
                                        onTurn.Add(TurnActionTypes.drawFiveCardsAtStartOfTurn);
                                    }
                                    else
                                    {
                                        newState.currentPhase = Statephase.Turn_Started_Draw_2_Cards;
                                        onTurn.Add(TurnActionTypes.drawTwoCardsAtStartOfTurn);
                                    }

                                    break;
                                }
                        }

                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion endTurn

                #region playPropertyToNewSet

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayPropertyCard_New_Set) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn.Add(TurnActionTypes.SwitchAroundPlayedProperties);
                        onTurn.Add(TurnActionTypes.EndTurn);
                        //onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        //updateStateForPropertyPlayedToSet(actionToAttemptToPerform, currentState, playerWhoPerformedAction, player, newState);
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only;
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion playPropertyToNewSet

                //Play Action

                #region Actions unable to be just say no carded

                #region pass Go

                else if (actionToAttemptToPerform.CompareTo(TurnActionTypes.PlayActionCard) == 0 && actionCardType.CompareTo(ActionCardAction.PassGo) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn.Add(TurnActionTypes.SwitchAroundPlayedProperties);
                        onTurn.Add(TurnActionTypes.EndTurn);
                        newState.currentPhase = Statephase.Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only;
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion pass Go

                #endregion Actions unable to be just say no carded
            }

            #endregion Turn_Started_Cards_Drawn_2_Cards_Played

            #region Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only

            //draw 2 on turn start state
            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only) == 0)
            {
                #region endTurn

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.EndTurn) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        switch (player.hand.cardsInHand.Count)
                        {
                            case 8:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);
                                    break;
                                }
                            case 9:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card); //Replace with Discard_2_Cards when discarding 2 cards at a time is supported
                                    break;
                                }
                            case 10:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);//Replace with Discard_3_Cards when discarding 2 cards at a time is supported
                                    break;
                                }
                            case 11:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);//Replace with Discard_4_Cards when discarding 2 cards at a time is supported
                                    break;
                                }
                            case 12:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_12_Cards_In_Hand_Discard_5_Cards;
                                    onTurn.Add(TurnActionTypes.Discard_1_Card);//Replace with Discard_5_Cards when discarding 2 cards at a time is supported
                                    break;
                                }
                            default:
                                {
                                    newState.currentPhase = Statephase.Turn_Ended_7_Or_Less_Cards_In_Hand_Setup_NextPlayer;
                                    setNextPlayerOnTurn(newState);
                                    if (getPlayerByGuid(newState.guidOfPlayerWhosTurnItIs, newState).hand.cardsInHand.Count == 0)
                                    {
                                        //Player has 0 cards draws 5 on turn start instead of 2
                                        newState.currentPhase = Statephase.Turn_Started_Draw_5_Cards;
                                        onTurn.Add(TurnActionTypes.drawFiveCardsAtStartOfTurn);
                                    }
                                    else
                                    {
                                        newState.currentPhase = Statephase.Turn_Started_Draw_2_Cards;
                                        onTurn.Add(TurnActionTypes.drawTwoCardsAtStartOfTurn);
                                    }

                                    break;
                                }
                        }

                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion endTurn

                //Play Action
            }

            #endregion Turn_Started_Cards_Drawn_3_Cards_Played_Swap_Properties_Or_End_Turn_Only

            #region Turn_Ended_12_Cards_In_Hand_Discard_5_Cards

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Ended_12_Cards_In_Hand_Discard_5_Cards) == 0)
            {
                #region discard1Card

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.Discard_1_Card) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards;
                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion discard1Card
            }

            #endregion Turn_Ended_12_Cards_In_Hand_Discard_5_Cards

            #region Turn_Ended_11_Cards_In_Hand_Discard_4_Cards

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Ended_11_Cards_In_Hand_Discard_4_Cards) == 0)
            {
                #region discard1Card

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.Discard_1_Card) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion discard1Card
            }

            #endregion Turn_Ended_11_Cards_In_Hand_Discard_4_Cards

            #region Turn_Ended_10_Cards_In_Hand_Discard_3_Cards

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Ended_10_Cards_In_Hand_Discard_3_Cards) == 0)
            {
                #region discard1Card

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.Discard_1_Card) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion discard1Card
            }

            #endregion Turn_Ended_10_Cards_In_Hand_Discard_3_Cards

            #region Turn_Ended_9_Cards_In_Hand_Discard_2_Cards

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Ended_9_Cards_In_Hand_Discard_2_Cards) == 0)
            {
                #region discard1Card

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.Discard_1_Card) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card;

                        //player has drawn their two cards, Now can play up to three cards on their turn
                        List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                        List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                        onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion discard1Card
            }

            #endregion Turn_Ended_9_Cards_In_Hand_Discard_2_Cards

            #region Turn_Ended_8_Cards_In_Hand_Discard_1_Card

            else if (currentState.currentPhase.CompareTo(Statephase.Turn_Ended_8_Cards_In_Hand_Discard_1_Card) == 0)
            {
                #region discard1Card

                if (actionToAttemptToPerform.CompareTo(TurnActionTypes.Discard_1_Card) == 0)
                {
                    //Move was a valid move at current state
                    //Check if move is valid for player
                    List<TurnActionTypes> notOnTurn = new List<TurnActionTypes>();
                    List<TurnActionTypes> onTurn = new List<TurnActionTypes>();
                    if (isActionAllowedForPlayer(actionToAttemptToPerform, playerWhoPerformedAction, currentState))
                    {
                        //action is valid for player at this time

                        //Could perform the action here instead, for now just change the phase of the state
                        //Not an action so cant be just say no'd
                        //Change phase
                        newState.currentPhase = Statephase.Turn_Ended_7_Or_Less_Cards_In_Hand_Setup_NextPlayer;
                        setNextPlayerOnTurn(newState);
                        if (getPlayerByGuid(newState.guidOfPlayerWhosTurnItIs, newState).hand.cardsInHand.Count == 0)
                        {
                            //Player has 0 cards draws 5 on turn start instead of 2
                            newState.currentPhase = Statephase.Turn_Started_Draw_5_Cards;
                            onTurn.Add(TurnActionTypes.drawFiveCardsAtStartOfTurn);
                        }
                        else
                        {
                            newState.currentPhase = Statephase.Turn_Started_Draw_2_Cards;
                            onTurn.Add(TurnActionTypes.drawTwoCardsAtStartOfTurn);
                        }

                        //player has drawn their two cards, Now can play up to three cards on their turn

                        //onTurn = setAllowableActionsOnTurn(onTurn, newState);
                        updateAllowableStates(newState, notOnTurn, onTurn, newState.guidOfPlayerWhosTurnItIs);
                    }
                }

                #endregion discard1Card
            }

            #endregion Turn_Ended_8_Cards_In_Hand_Discard_1_Card
        }
Exemplo n.º 6
0
 public ActionCard(ActionCardAction actionType, int value, String name, String text, int id, Guid guid, String description, bool monetaryValueOnly)
     : base(name, text, value, CardType.Action, id, guid)
 {
     this.actionType = actionType;
 }
Exemplo n.º 7
0
 public ActionCard(ActionCardAction actionType, int value, String name, String text)
     : base(name, text, value, CardType.Action)
 {
     this.actionType = actionType;
 }