Beispiel #1
0
        public IDeck Shuffle()
        {
            CardList shuffledCards = new CardList();

            shuffledCards.AddRange(Shuffle(_currentDeck, _random));
            return(new DummyDeck(_random, new CardList(shuffledCards)));
        }
        public void Start()
        {
            State.DeckBuilderSetupState setupState =
                (State.DeckBuilderSetupState)State.StateHolder.StateManager.GetAndClearPassedState();
            if (setupState != null)
            {
                mCardCollection = setupState.mCardCollection;
                if (setupState.mCardCollection.mLibrary != null)
                {
                    mLibraryCards = Cards.Loading.CardLoading.ProduceDeck(State.StateHolder.StateManager.CardPool,
                                                                          setupState.mCardCollection.mLibrary);
                }
                else
                {
                    mLibraryCards = new CardList();
                }

                if (setupState.mCardCollection.mDeck != null)
                {
                    mDeckCards = Cards.Loading.CardLoading.ProduceDeck(State.StateHolder.StateManager.CardPool,
                                                                       setupState.mCardCollection.mDeck);
                }
                else
                {
                    mDeckCards = new CardList();
                }
                mLastScene = setupState.mLastScene;
            }

            VerifyDeck();
            UpdateUI();
        }
Beispiel #3
0
        public void MakeInvisible(int deck)
        {
            var thisCard = CardList.Single(items => items.Deck == deck);

            thisCard.Visible = false;
            RecalculateEnables();
        }
Beispiel #4
0
        public static int GetSortedAgainstId(List <Card> _CardList)
        {
            int iAgainstType = CardList.GetAgainstType(_CardList);

            if (iAgainstType == AgainstType.SpadeSpade_VS_SpadeSpade)
            {
            }
            else if (iAgainstType == AgainstType.SpadeSpade_VS_SpadeHeart)
            {
            }
            else if (iAgainstType == AgainstType.SpadeSpade_VS_HeartHeart)
            {
            }
            else if (iAgainstType == AgainstType.SpadeHeart_VS_SpadeHeart)
            {
            }
            else if (iAgainstType == AgainstType.SpadeSpade_VS_HeartClub)
            {
            }
            else if (iAgainstType == AgainstType.SpadeHeart_VS_SpadeClub)
            {
            }
            else if (iAgainstType == AgainstType.SpadeHeart_VS_ClubDiamond)
            {
            }

            return(0);
        }
Beispiel #5
0
    private void PupolateControls()
    {
        int userId = 0;

        if (Request.QueryString["userId"] != "" && Request.QueryString["userId"] != null)
        {
            userId = Convert.ToInt32(Request.QueryString["userId"]);
        }

        DataTable user = user_bll.GetUserDataTableByUserId(userId);

        UserList.DataSource = user;
        UserList.DataBind();

        OAuthList.DataSource = oauth_bll.GetOAuthListDataTableByUserId(userId);
        OAuthList.DataBind();

        int categoryRate = Convert.ToInt32(user.Rows[0]["CategoryRate"]);

        UserCategoryList.DataSource = cat_bll.GetUserCategoryList(userId, categoryRate);
        UserCategoryList.DataBind();

        ZhuanTiList.DataSource = zt_bll.GetZhuanTiList(userId);
        ZhuanTiList.DataBind();

        CardList.DataSource = card_bll.GetCardList(userId);
        CardList.DataBind();

        List.DataSource = bll.GetItemListByUserId(userId);
        List.DataBind();
    }
Beispiel #6
0
 private void Load(CardList list)
 {
     this.ListId  = list.ListId;
     this.Name    = list.Name;
     this.Color   = list.Color;
     this.BoardId = list.Board.BoardId;
 }
Beispiel #7
0
 /// <summary>
 /// Callback for when elements have been updated
 /// </summary>
 /// <param name="playerElements"></param>
 /// <param name="opponentElements"></param>
 /// <param name="screenWidth"></param>
 /// <param name="screenHeight"></param>
 public void OnElementsUpdate(CardList <CardInPlay> playerElements, CardList <CardInPlay> opponentElements, int screenWidth, int screenHeight)
 {
     if (OverlayWindow != null)
     {
         OverlayWindow.Update(playerElements, opponentElements, screenWidth, screenHeight);
     }
 }
        /// <summary>
        /// Draw new set of elements
        /// </summary>
        /// <param name="playerElements"></param>
        /// <param name="opponentElements"></param>
        /// <param name="screenWidth"></param>
        /// <param name="screenHeight"></param>
        public void Update(CardList <CardInPlay> playerElements, CardList <CardInPlay> opponentElements, int screenWidth, int screenHeight)
        {
            CardList <CardInPlay> playerElementsCopy   = playerElements.Clone();
            CardList <CardInPlay> opponentElementsCopy = opponentElements.Clone();

            if (InvokeRequired)
            {
                this.Invoke(new Action(() =>
                {
                    PlayerElements   = playerElementsCopy;
                    OpponentElements = opponentElementsCopy;
                    ScreenWidth      = screenWidth;
                    ScreenHeight     = screenHeight;
                    Invalidate();
                }));
            }
            else
            {
                PlayerElements   = playerElementsCopy;
                OpponentElements = opponentElementsCopy;
                ScreenWidth      = screenWidth;
                ScreenHeight     = screenHeight;
                Invalidate();
            }
        }
    internal CardList PeekCards()
    {
        var cardList = new CardList();

        cardList.AddRange(_cards.Where(c => c ! != null !).ToList());
        return(cardList);
    }
Beispiel #10
0
        /// <summary>
        /// Get a random card and update activity
        /// </summary>
        private void ShootOnClick()
        {
            nbRandom = GenRandomNumber();

            if (nbRandom != 999)
            {
                Toast.MakeText(this, CardList.getNomCarte(listResId[nbRandom]), ToastLength.Short).Show();
                imgCards.Visibility = Android.Views.ViewStates.Visible;
                imgCards.SetImageResource(listResId[nbRandom]);

                discard.Add(new Card
                {
                    cardName       = CardList.getNomCarte(listResId[nbRandom]),
                    drawCardNb     = listResId[nbRandom],
                    nbCardDirscard = nbDiscardingCards + 1,
                });

                listResId.RemoveAt(nbRandom);
                tvDiscard.Text   = (nbDiscardingCards = nbDiscardingCards + 1).ToString();
                tvCardsLeft.Text = (nbLeftCards = nbLeftCards - 1).ToString();
            }
            else
            {
                Toast.MakeText(this, Resource.String.noCards, ToastLength.Short).Show();
            }
        }
Beispiel #11
0
    public void SetHand(CardList cardsToShow)
    {
        //trim cards diplaying that are not needed
        if (m_Cards.Count > cardsToShow.cards.Count)
        {
            for (int i = cardsToShow.cards.Count; i < m_Cards.Count; i++)
            {
                m_Cards[i].gameObject.SetActive(false);
            }
        }

        //for each of the showing cards
        for (int i = 0; i < cardsToShow.cards.Count; i++)
        {
            //if i < cards displaying count then set new sprite
            if (i < m_Cards.Count)
            {
                m_Cards[i]._Image.sprite = GetSpriteOfCard(cardsToShow.cards[i].Type);
                m_Cards[i]._Index        = i;
                m_Cards[i]._Card         = cardsToShow.cards[i];
                m_Cards[i].gameObject.SetActive(true);
            }
            else
            {
                //add new card
                AddNewCard(cardsToShow.cards[i]);
            }
        }
        m_NumberOfCards = cardsToShow.cards.Count;
        //update spacing
        UpdateRotations();

        //event
        OnHandSet();
    }
Beispiel #12
0
        public void NewGame()
        {
            //
            // Pre-conditions

            EnforceRequiredPlayerCount();

            if (GameState == WarGameState.AtBattle || GameState == WarGameState.WarDeclared)
            {
                throw new InvalidOperationException("Cannot start a new game in mid play.");
            }

            //
            // Reset the deck

            this.cards = CardList.CreateDeck();
            cards.Shuffle();
            battleTracker.Clear();

            //
            // Deal

            players.ForEach(p => p.Cards.Clear());
            while (cards.Count > 0)
            {
                foreach (WarPlayer player in players)
                {
                    cards.DealTo(player.Cards);
                }
            }
        }
Beispiel #13
0
        public static List <CardWithCount> ConvertDeck(CardList <CardInPlay> deck)
        {
            List <CardWithCount> result = new List <CardWithCount>();
            int countFromDeck           = 0;
            int countNotFromDeck        = 0;

            for (int i = 0; i < deck.Count; i++)
            {
                if (deck[i].IsFromDeck)
                {
                    countFromDeck++;
                }
                else
                {
                    countNotFromDeck++;
                }
                if (i + 1 == deck.Count || deck[i].CardCode != deck[i + 1].CardCode)
                {
                    if (countFromDeck > 0)
                    {
                        result.Add(new CardWithCount(deck[i].TheCard, countFromDeck, true));
                    }
                    if (countNotFromDeck > 0)
                    {
                        result.Add(new CardWithCount(deck[i].TheCard, countNotFromDeck, false));
                    }
                    countFromDeck    = 0;
                    countNotFromDeck = 0;
                }
            }
            return(result);
        }
Beispiel #14
0
        public void Pop()
        {
            var card = CardList.First();

            CardList.RemoveAt(0);
            Cut.Insert(0, card);
        }
Beispiel #15
0
        public async Task <IActionResult> CreateList([FromRoute] string tableID, [FromBody] CreateListData data)
        {
            if (string.IsNullOrEmpty(data.Name))
            {
                return(BadRequest());
            }

            User activeUser = await userManager.GetUserAsync(User);

            Table table = TableCollection.FindByUserAndId(activeUser.ID, new ObjectId(tableID));

            if (table == null)
            {
                return(NotFound());
            }

            CardList newList = new CardList();

            newList.Name    = data.Name;
            newList.Table   = table.ID;
            newList.Content = new List <Card>();
            CardListCollection.InsertOne(newList);

            return(Ok(newList));
        }
Beispiel #16
0
        public async Task Chould_Retrieve_Card()
        {
            Card card = await CreateCard();

            RetrieveCardListRequest request = new RetrieveCardListRequest
            {
                Locale         = Locale.TR.ToString(),
                ConversationId = "123456789",
                CardUserKey    = card.CardUserKey
            };

            CardList cardList = await CardList.RetrieveAsync(request, Options);

            PrintResponse(cardList);

            Assert.AreEqual(Status.SUCCESS.ToString(), cardList.Status);
            Assert.AreEqual(Locale.TR.ToString(), cardList.Locale);
            Assert.AreEqual("123456789", cardList.ConversationId);
            Assert.NotNull(cardList.SystemTime);
            Assert.Null(cardList.ErrorCode);
            Assert.Null(cardList.ErrorMessage);
            Assert.Null(cardList.ErrorGroup);
            Assert.NotNull(cardList.CardDetails);
            Assert.False(cardList.CardDetails.Count == 0);
            Assert.NotNull(cardList.CardUserKey);
        }
Beispiel #17
0
        private async void ShowPrices()
        {
            ProgressMessage = "Loading decklist ...";
            IsIndeterminate = true;
            Processing      = true;
            string      html     = RequestHandler.GetContent(DeckUri);
            List <Card> allCards = RequestHandler.GetCards(html).ToList();

            IsIndeterminate = false;
            MaxProgress     = allCards.Count();
            for (int i = 0; i < allCards.Count(); i++)
            {
                ProgressMessage = String.Format("Fetching card prices ({0}/{1})", i + 1, MaxProgress);
                Card card = allCards[i];
                card.Uri = String.Format(RequestHandler.GoatUrl, card.Name.Replace(" ", "-").Replace("'", String.Empty)).ToLower();
                RequestHandler.SetLowestPrice(card);
                CardList.Add(card);
                Progress = CardList.Count;

                if (i == allCards.Count - 1)
                {
                    Processing = false;
                }
                else
                {
                    await Task.Delay(1000);
                }
            }
        }
Beispiel #18
0
        public static void CombinePreList(List <Card> preList, int iNum, DeleCardList deleCardList = null)
        {
            List <Card> retList  = new List <Card>();
            List <Card> poolList = CardList.GetAllCardList();

            for (int i = 0; i < 1; i++)
            {
                if (preList == null)
                {
                    break;
                }
                if (preList.Count == 0)
                {
                    break;
                }
                foreach (var card in preList)
                {
                    Debug.Assert(poolList.Contains(card));
                    poolList.Remove(card);
                    retList.Add(card);
                }
            }

            Combination(poolList, 2, retList, deleCardList);
        }
Beispiel #19
0
        public static void GetAllOppoCardList()
        {
            List <Card>         allCardList     = CardList.GetAllCardList();
            List <List <Card> > allHandCardList = GetAllHandCardList();
            List <List <Card> > allOppoCardList = new List <List <Card> >();

            foreach (var handCardList in allHandCardList)
            {
                List <Card> poolList = CardList.CopyCardList(allCardList);
                foreach (var card in handCardList)
                {
                    if (poolList.Contains(card) == false)
                    {
                        Utility.Log("poolList.Contains(card) == false");
                    }
                    poolList.Remove(card);
                }

                Combination(allCardList, 2, null, (_CardList) =>
                {
                    allHandCardList.Add(_CardList);
                });
            }
            //spade spade VS spade spade
            //spade spade VS heart heart //equal to (club club) (diamond diamond)
            //spade spade VS spade heart //equal to (spade club) (spade diamond)
            //spade spade vs heart club //equal to (heart diamond) (club diamond)
            //spade heart vs club diamond
        }
Beispiel #20
0
 void MoveToList(GameObject card, CardList cardList)
 {
     Transform[] points;
     if (cardList == CardList.PLAYERLIST)
     {
         points = playerArea.GetComponentsInChildren <Transform>();
     }
     else if (cardList == CardList.OPPONENTLIST)
     {
         points = opponentArea.GetComponentsInChildren <Transform>();
     }
     else
     {
         points = null;
     }
     foreach (Transform point in points)
     {
         if (point.transform.childCount == 0 && point.transform.gameObject.name.Contains("point"))
         {
             card.transform.SetParent(point.transform, false);
             card.transform.localPosition = new Vector3(0, 0, 0);
             break;
         }
     }
 }
Beispiel #21
0
 void MoveCardToAreaUI(GameObject card, CardList cardList)
 {
     if (cardList == CardList.GAMELIST)
     {
         card.transform.SetParent(activeCardArea.transform, false);
         card.transform.GetComponent <RectTransform>().anchoredPosition = new Vector2(Random.Range(100, 200), Random.Range(-280, -320));
     }
     else if (cardList == CardList.PLAYERLIST)
     {
         MoveToList(card, cardList);
     }
     else if (cardList == CardList.OPPONENTLIST)
     {
         MoveToList(card, cardList);
     }
     else if (cardList == CardList.CLOSEDLIST)
     {
         card.transform.SetParent(closedCardsArea.transform, false);
     }
     else if (cardList == CardList.PLAYERWINLIST)
     {
         card.transform.SetParent(playerWinArea.transform, false);
     }
     else if (cardList == CardList.OPPONENTWINLIST)
     {
         card.transform.SetParent(opponentWinArea.transform, false);
     }
 }
Beispiel #22
0
        public List <ICard> Draw(int drawNumber)
        {
            List <ICard> drawnCards = _drawDeck.Take(drawNumber).ToList();

            _drawDeck = new CardList(_drawDeck.Skip(drawNumber).ToList());
            return(drawnCards);
        }
        /// <summary>
        /// Generates a default deck based on the list of cards stored in <see cref="_defaultDeck"/>.
        /// </summary>
        private Deck GenerateDefaultDeck(CardList defaultDeck)
        {
            Deck deck = new Deck();

            deck.deckName    = "Default Deck";
            deck.unusedCards = new List <Card>();
            deck.usedCards   = new List <Card>();
            foreach (CardInfo info in defaultDeck.CardInfos)
            {
                Card card = new Card();
                card.cardType = info.CardType;
                card.level    = 1;

                if (deck.usedCards.Count < _deckSize)
                {
                    deck.usedCards.Add(card);
                    card.isUsed = true;
                }
                else
                {
                    deck.unusedCards.Add(card);
                    card.isUsed = false;
                }
            }
            return(deck);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,BoardId")] CardList cardList)
        {
            if (id != cardList.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cardList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CardListExists(cardList.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BoardId"] = new SelectList(_context.Boards, "Id", "Name", cardList.BoardId);
            return(View(cardList));
        }
Beispiel #25
0
 internal FormationDescription(Formation formation, IEnumerable <Card> cards, int score)
 {
     Formation = formation;
     Cards     = new CardList();
     Cards.AddRange(cards);
     Score = score;
 }
Beispiel #26
0
    // TODO à développer
    public Card ChooseAllyCard(CardList hand, CardRank minRank, Deck standardDeck)
    {
        Card heart   = hand.GetCard(CardType.Heart, minRank);
        Card diamond = hand.GetCard(CardType.Diamond, minRank);
        Card spade   = hand.GetCard(CardType.Spade, minRank);
        Card club    = hand.GetCard(CardType.Club, minRank);

        if (heart == null)
        {
            return(standardDeck.GetCard(CardType.Heart, minRank));
        }
        else if (diamond == null)
        {
            return(standardDeck.GetCard(CardType.Diamond, minRank));
        }
        else if (spade == null)
        {
            return(standardDeck.GetCard(CardType.Spade, minRank));
        }
        else if (club == null)
        {
            return(standardDeck.GetCard(CardType.Club, minRank));
        }
        else
        {
            return(standardDeck.GetCard(defaultType, minRank));
        }
    }
        public static IList <Card> MakePack(CardList cardSet, RarityDistribution rarityDistribution = null)
        {
            _random = new Random(DateTime.Now.Millisecond);

            rarityDistribution ??= new RarityDistribution();
            var commons   = cardSet.Data.Where(c => c.Rarity == Rarity.Common);
            var uncommons = cardSet.Data.Where(c => c.Rarity == Rarity.Uncommon);
            var rares     = cardSet.Data.Where(c => c.Rarity == Rarity.Rare);
            var mythics   = cardSet.Data.Where(c => c.Rarity == Rarity.Mythic);

            var gotCards = new List <Card>();

            var commonsList  = commons.ToList();
            var commonsCount = commonsList.Count;

            if (_random.Next(1, 100) / 100.0 < rarityDistribution.ChanceOfFoil)
            {
                for (var i = 0; i < rarityDistribution.NumberOfCommons - 1; i++)
                {
                    gotCards.Add(commonsList.ElementAt(_random.Next(1, commonsCount)));
                }
                gotCards.Add(cardSet.Data.ElementAt(_random.Next(1, cardSet.Data.Count())));
            }
            else
            {
                for (var i = 0; i < rarityDistribution.NumberOfCommons; i++)
                {
                    gotCards.Add(commonsList.ElementAt(_random.Next(1, commonsCount)));
                }
            }

            var uncommonsList  = uncommons.ToList();
            var uncommonsCount = uncommonsList.Count;


            for (int i = 0; i < rarityDistribution.NumberOfUncommons; i++)
            {
                gotCards.Add(uncommonsList.ElementAt(_random.Next(1, uncommonsCount)));
            }

            var mythicsList  = mythics.ToList();
            var mythicsCount = mythicsList.Count;

            var raresList  = rares.ToList();
            var raresCount = mythicsList.Count;

            for (int i = 0; i < rarityDistribution.NumberOfRares; i++)
            {
                if (_random.Next(1, 100) / 100.0 < rarityDistribution.ChanceOfMythic)
                {
                    gotCards.Add(mythicsList.ElementAt(_random.Next(1, mythicsCount)));
                }
                else
                {
                    gotCards.Add(raresList.ElementAt(_random.Next(1, raresCount)));
                }
            }

            return(gotCards);
        }
Beispiel #28
0
    public void SetHand(CardList cardsToShow)
    {
        //trim cards diplaying that are not needed
        if (m_Cards.Count > cardsToShow.cards.Count)
        {
            for (int i = cardsToShow.cards.Count; i < m_Cards.Count; i++)
            {
                m_Cards[i].gameObject.SetActive(false);
            }
        }

        //for each of the showing cards
        for (int i = 0; i < cardsToShow.cards.Count; i++)
        {
            //if i < cards displaying count then set new sprite
            if (i < m_Cards.Count)
            {
                m_Cards[i]._Image.sprite = GetSpriteOfCard(cardsToShow.cards[i].Type);
                m_Cards[i]._Index = i;
                m_Cards[i]._Card = cardsToShow.cards[i];
                m_Cards[i].gameObject.SetActive(true);
            }
            else
            {
                //add new card
                AddNewCard(cardsToShow.cards[i]);
            }
        }
		m_NumberOfCards = cardsToShow.cards.Count;
        //update spacing 
        UpdateRotations();

        //event 
        OnHandSet();
    }
Beispiel #29
0
 internal void init()
 {
     CardList.Clear();
     Point = 0;
     Bet   = 0;
     Stay  = false;
 }
Beispiel #30
0
        public void StartGame(int left, int right, string map, int tile)//初始化游戏
        {
            gameEnd = false;
            BattleManager.Instance.Init();
            BattleManager.Instance.EffectQueue.SetFast();
            BattleManager.Instance.FlowWordQueue.SetFast();
            BattleManager.Instance.PlayerManager.Init(left, right, 1);//temp
            BattleManager.Instance.MemMap = new MemRowColumnMap(map, tile);

            using (CardList cl = new CardList())
            {
                cl.MaxCards = GameConstants.CardSlotMaxCount;
                BattleManager.Instance.PlayerManager.LeftPlayer.CardsDesk = cl;
                BattleManager.Instance.PlayerManager.LeftPlayer.InitialCards();
            }
            using (CardList cl = new CardList())
            {
                cl.MaxCards = GameConstants.CardSlotMaxCount;
                BattleManager.Instance.PlayerManager.RightPlayer.CardsDesk = cl;
                BattleManager.Instance.PlayerManager.RightPlayer.InitialCards();
            }

            roundMark = 0;
            BattleManager.Instance.StatisticData.StartTime = DateTime.Now;

            TimerProc();
        }
Beispiel #31
0
        public BasicCardDTO InsertCard(string username, CreateCardDTO dto)
        {
            //if (!PermissionHelper.HasPermissionOnList(dto.ListId, userId))
            //{
            //    return 0;
            //}

            BasicCardDTO cardDto = null;

            using (UnitOfWork uw = new UnitOfWork())
            {
                CardList list = uw.CardListRepository.GetById(dto.ListId);
                User     user = uw.UserRepository.GetUserByUsername(username);

                Card card = CreateCardDTO.FromDTO(dto);

                if (user != null && list != null)
                {
                    card.User = user;
                    card.List = list;
                    uw.CardRepository.Insert(card);
                    if (uw.Save())
                    {
                        cardDto = new BasicCardDTO(card);
                        RabbitMQService.PublishToExchange(list.Board.ExchangeName,
                                                          new MessageContext(new CardMessageStrategy(cardDto, MessageType.Create, username)));

                        BoardNotificationService.ChangeBoardNotifications(list.Board.BoardId);
                    }
                }
            }
            return(cardDto);
        }
Beispiel #32
0
 public Seat()
 {
     deck = CardList.CreateStandardDeck();
     positions = new CardList[9];
     for (int i = 0; i < 9; i++)
     {
         positions[i] = new CardList();
     }
 }
Beispiel #33
0
 public Game()
 {
     Deck = new Deck();
     PickUpPack = new List<Card>();
     ClearedCards = new CardList();
     Direction = Direction.Forwards;
     Players = new List<Player>();
     CanJoin = true;
 }
        public void CompareUsingSortTest()
        {
            WarCardComparer target = new WarCardComparer(); // TODO: Initialize to an appropriate value

            Card[] unorderedCards = {
                Card.AceOfClubs,
                Card.TwoOfClubs,
                new Card(CardSuit.Clubs, CardFace.King),
                Card.AceOfDiamonds };

            CardList cardList = new CardList(unorderedCards);

            cardList.Sort(new WarCardComparer());

            Assert.AreEqual(cardList[0].Face, CardFace.Two);
            Assert.AreEqual(cardList[1].Face, CardFace.King);
            Assert.AreEqual(cardList[2].Face, CardFace.Ace);
            Assert.AreEqual(cardList[3].Face, CardFace.Ace);
        }
Beispiel #35
0
 public Gamestate()
 {
     score = 0;
     defcon = 5;
     turn = 0;
     round = 0; //headline phase
     usMilOps = 0;
     ussrMilOps = 0;
     usSpaceRace = 0;
     ussrSpaceRace = 0;
     usSrPlayed = false;
     ussrSrPlayed = false;
     usSrSecond = false;
     ussrSrSecond = false;
     gameOver = false;
     victor = "N/A";
     countryLst = new CountryList();
     cards = new CardList();
     //permanent status markers
     DeGualleLeadsFrance = false;
     WarsawPactFormed = false;
     USJapanMutualDefensePact = false;
     NORAD = false;
     MarshallPlan = false;
     NATO = false;
     FormosanResolution = false;
     BearTrap = false;
     WillyBrandt = false;
     CampDavidAccords = false;
     ShuttleDiplomacy = false;
     FlowerPower = false;
     Quagmire = false;
     JohnPaulIIElectedPope = false;
     IranianHostageCrisis = false;
     AnEvilEmpire = false;
     AwacsSaleToSaudis = false;
     TearDownThisWall = false;
     TheIronLady = false;
     NorthSeaOil = false;
     TheReformer = false;
 }
Beispiel #36
0
        public void NewGame()
        {
            deck = CardList.CreateStandardDeck();
            deck.Shuffle();

            for (int i = 0; i < 9; i++)
            {
                positions[i].Clear();
            }
        }
Beispiel #37
0
 public Seat(CardList deck, CardList[] positions)
 {
     this.Deck = deck;
     this.Positions = positions;
 }
Beispiel #38
0
        public void NewGame()
        {
            //
            // Pre-conditions

            EnforceRequiredPlayerCount();

            if (GameState == WarGameState.AtBattle || GameState == WarGameState.WarDeclared)
                throw new InvalidOperationException("Cannot start a new game in mid play.");

            //
            // Reset the deck

            this.cards = CardList.CreateDeck();
            cards.Shuffle();
            battleTracker.Clear();

            //
            // Deal

            players.ForEach(p => p.Cards.Clear());
            while (cards.Count > 0)
            {
                foreach (WarPlayer player in players)
                {
                    cards.DealTo(player.Cards);
                }
            }
        }
Beispiel #39
0
        protected int AwardBattleWinner()
        {
            var winner = battleTracker.Winner;
            if (winner == null)
                throw new InvalidOperationException("No winner for the current battle.");

            int result = 0;

            CardList winStack = new CardList();
            foreach (CardList attack in battleTracker.PlayerAttacks.Values)
            {
                while (attack.Count > 0)
                {
                    attack.DealTo(winStack);
                    result++;
                }
            }
            winStack.Shuffle();
            while (winStack.Count > 0)
                winStack.DealTo(winner.Cards);

            var numberOfCards = players
                .Select(player => player.Cards)
                .Sum(cards => cards.Count);

            Debug.Assert(result > 0, "No cards awarded.");
            Debug.WriteLine(String.Format("{0} cards awarded to {1}", result, winner.Name));

            return result;
        }
Beispiel #40
0
	public void SetCards(CardList newCards)
	{
		Hand.cards = new System.Collections.Generic.List<CardData> (newCards.cards);
	}