示例#1
0
 public void Card()
 {
     Card card = new Card("TestCard", "TestCardText", 1, CardType.Money);
     Assert.AreEqual(card.cardName, "TestCard");
     Assert.AreEqual(card.cardText, "TestCardText");
     Assert.AreEqual(card.cardValue, 1);
     Assert.AreEqual(card.cardType, CardType.Money);
     Assert.AreNotEqual(card.cardGuid, new Guid());
 }
 public Card checkIfCardInHand(Card card, PlayerModel pm)
 {
     foreach (Card c in pm.hand.cardsInHand)
     {
         if (c.cardID == card.cardID)
         {
             return c;
         }
     }
     return null;
 }
 //Clone Constructor
 public PropertyCardSet(PropertyCardSet pcs, PlayFieldModel state)
 {
     id = pcs.id;
     guid = pcs.guid;
     hasHouse = pcs.hasHouse;
     hasHotel = pcs.hasHotel;
     if (pcs.hotel != null)
     {
         this.hotel = state.deck.getCardByID(pcs.hotel.cardID);
     }
     if (pcs.house != null)
     {
         this.house = state.deck.getCardByID(pcs.house.cardID);
     }
     properties = pcs.properties.cloneLinkedListPropertyCard(state.deck);
     propertySetColor = pcs.propertySetColor;
 }
示例#4
0
 public Card removeCardFromBank(Card card)
 {
     foreach (Card bankedCard in cardsInBank)
     {
         if (bankedCard.cardID.CompareTo(card.cardID) == 0)
         {
             if (cardsInBank.Remove(bankedCard))
             {
                 return bankedCard;
             }
             else
             {
                 throw new Exception("Card is in bank but is unable to be removed. Error");
             }
         }
     }
     return null;
 }
示例#5
0
 public void addCardToHand(Card card)
 {
     cardsInHand.Add(card);
 }
示例#6
0
 public bool equals(Card checkAgainst)
 {
     if (cardID == checkAgainst.cardID)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#7
0
 public virtual Card clone()
 {
     Card clone = new Card(this.cardName, this.cardText, this.cardValue, this.cardType, this.cardID, this.cardGuid);
     return clone;
 }
 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();
 }
 public bool playPropertyCardMD(PlayerModel player, Card playedCard, PropertyCardSet setToPlayPropertyTo, GuidBox playerGuid, GuidBox gameLobbyGuid, GuidBox playfieldModelInstanceGuid, GuidBox turnActionGuid)
 {
     try
     {
         //Find MonopolyDealGame
         MonopolyDeal md = getMonopolyDeal(gameLobbyGuid.guid);
         if (md != null)
         {
             return md.getMonopolyDealGameStateManager().playPropertyCardToExistingSet(playedCard, setToPlayPropertyTo, gameLobbyGuid.guid, playerGuid.guid, playfieldModelInstanceGuid.guid);
         }
         else
         {
             return false;
         }
     }
     catch (System.ServiceModel.CommunicationException ex)
     {
         throw new FaultException(ex.Message);
     }
 }
 public bool addHouse(Card houseCard)
 {
     if (isFullSet() && !hasHouse)
     {
         hasHouse = true;
         house = houseCard;
         return true;
     }
     else
     {
         return false;
     }
 }
示例#11
0
 public void addCardToBank(Card card)
 {
     cardsInBank.Add(card);
 }
        public bool playPropertyCardToExistingSet(Card playedCard, PropertyCardSet setToPlayPropertyTo, Guid gameLobbyGuid, Guid playerGuid, Guid playfieldModelInstanceGuid)
        {
            ///Check if Card is in hand
            bool cardIsInHand = false;
            int cardId = playedCard.cardID;
            PlayerModel pm = getPlayerModel(playerGuid, gameLobbyGuid, playfieldModelInstanceGuid);
            PropertyCardSet pset = getPropertySet(setToPlayPropertyTo.guid, playerGuid, gameLobbyGuid, playfieldModelInstanceGuid);
            Card card = null;
            foreach (Card c in pm.hand.cardsInHand)
            {
                if (c.cardID == cardId)
                {
                    cardIsInHand = true;
                    card = c;
                    break;
                }
            }

            if (cardIsInHand)
            {
                //Check if card is a property card
                PropertyCard pc = card as PropertyCard;
                if (pc != null)
                {
                    //Card is a property card
                    if (pset.addProperty(pc))
                    {
                        removeCardFromHand(pc, pm);
                        updateState(TurnActionTypes.PlayPropertyCard_New_Set, ActionCardAction.NotAnActionCard, currentPlayFieldModel, playerGuid);
                        return true;
                    }
                    else
                    {
                        //Is a property card in the players hand but cant be added to set
                        return false;
                    }
                }
            }
            return false;
        }
 public bool addHotel(Card hotelCard)
 {
     if (isFullSet() && hasHouse && !hasHotel)
     {
         hasHotel = true;
         hotel = hotelCard;
         return true;
     }
     else
     {
         return false;
     }
 }
示例#14
0
 public void playCardOnPile(Card card)
 {
     playPile.Add(card);
 }
示例#15
0
 public void discardCard(Card card)
 {
     //discard card to bottom of draw pile
     drawPile.Insert(0, card);
 }
示例#16
0
 /// <summary>
 /// Removes a Card from a players Hand and returns the card
 /// </summary>
 /// <param name="card"></param>
 /// <param name="pm"></param>
 /// <returns></returns>
 private Card removeCardFromHand(Card card, PlayerModel pm)
 {
     Card cardInHand = checkIfCardInHand(card, pm);
     if (cardInHand != null && pm.hand.cardsInHand.Remove(cardInHand))
     {
         return cardInHand;
     }
     return null;
 }
        public bool playPropertyCardToExistingSet(Card playedCard, PropertyCardSet setToPlayPropertyTo, Guid gameLobbyGuid, Guid playerGuid, Guid playfieldModelInstanceGuid)
        {
            PlayFieldModel lastState = getPreviousState();
            PlayFieldModel currentState = getCurrentState();
            PlayFieldModel nextState = null;
            PlayerModel playerModelAtCurrentState = move.getPlayerModel(playerGuid, currentState);
            PropertyCard playedPropertycard = monopolyDeal.deck.getCardByID(playedCard.cardID) as PropertyCard;
            if (playedPropertycard != null && checkIfCardInHand(playedPropertycard, playerModelAtCurrentState) != null)
            {
                MoveInfo playPropertyCardFromHand = new MoveInfo();
                playPropertyCardFromHand.playerMakingMove = playerGuid;
                playPropertyCardFromHand.moveBeingMade = TurnActionTypes.PlayPropertyCardFromHand;
                playPropertyCardFromHand.idOfCardBeingUsed = playedCard.cardID;

                bool isOrientedUp = (playedCard as PropertyCard).isCardUp;
                playPropertyCardFromHand.isPropertyToPlayOrientedUp = isOrientedUp;
                playPropertyCardFromHand.addPropertyToPlayToExistingSet = true;//Add to existing set
                playPropertyCardFromHand.guidOfExistingSetToPlayPropertyTo = setToPlayPropertyTo.guid;

                BoolResponseBox result = move.evaluateMove(lastState, currentState, nextState, playerModelAtCurrentState, playPropertyCardFromHand.moveBeingMade, playPropertyCardFromHand);
                return result.success;
            }
            return new BoolResponseBox(false, "Selected Card is not in players hand or is not a property card").success;
        }