Esempio n. 1
0
        //Only event I care about tbh
        private void CardBanner_Click(object sender, EventArgs e)
        {
            //
            SVTracker  target = (SVTracker)Parent.Parent;
            CardBanner banner = new CardBanner(cardId, cardName, cardCost, cardRarityId, cardCount, isInDeck);

            if (isInDeck)
            {
                banner.isInDeck = false;
                banner.countLabel.ResetText();
                target.AddToHand(banner.cardId, true);
                if (cardCount > 1)
                {
                    cardCount--;
                    countLabel.Text = "×" + cardCount;
                }
                else
                {
                    Dispose();
                }
            }
            else
            {
                Dispose();
                target.PlayCard(banner.cardId);
            }
            banner.Dispose();
        }
Esempio n. 2
0
        //Adds a card to the player's deck
        public void AddToDeck(int targetId)
        {
            //control variable, it makes sense dw
            bool notInDeck = true;

            //Create instance of the card we're adding
            Card targetCard = cards.Find(x => x.CardId == targetId);

            //Check to see if the card is already in the deck
            //If it is, simply increase its count by 1
            foreach (CardBanner control in deckBannerList.Controls)
            {
                if (control.cardId == targetCard.CardId)
                {
                    control.cardCount++;
                    control.countLabel.Text = "×" + control.cardCount;
                    notInDeck = false;
                }
            }
            //If it isn't, add a new banner for it
            if (notInDeck)
            {
                CardBanner banner = new CardBanner(targetCard.CardId, targetCard.CardName, targetCard.Cost, targetCard.RarityId, 1, true);
                deckBannerList.Controls.Add(banner);
            }

            //Update numbers I guess
            cardsInDeck++;
            numberInDeckLabel.Text = "Cards in deck: " + cardsInDeck;
            ResonanceCheck();
        }
Esempio n. 3
0
        //Adds a card to the player's hand
        public void AddToHand(int targetId, bool isDraw)
        {
            //Create instance of card to add
            Card targetCard = cards.Find(x => x.CardId == targetId);

            //Check hand size
            if (cardsInHand < 9)
            {
                CardBanner banner = new CardBanner(targetCard.CardId, targetCard.CardName, targetCard.Cost, targetCard.RarityId, 1, false);

                //Each card is a separate banner, even if a player draws into multiples
                banner.countLabel.ResetText();

                //Put newly created CardBanner in hand
                handBannerList.Controls.Add(banner);
                if (isDraw)
                {
                    infoBox.AppendText("\r\nDrew " + targetCard.CardName + ".");
                }

                //Update numbers I guess
                cardsInHand++;
                numberInHandLabel.Text = "Cards in hand: " + cardsInHand;
            }
            //If hand was too full...
            else
            {
                shadowCount++;
                infoBox.AppendText("\r\nHand is too full! Overdrew " + targetCard.CardName + ".");
                shadowCountLabel.Text = "Shadows: " + shadowCount;
            }

            if (isDraw)
            {
                cardsInDeck--;
                numberInDeckLabel.Text = "Cards in deck: " + cardsInDeck;
                ResonanceCheck();
            }
        }
Esempio n. 4
0
        public static void DeckFilter(Deck deck, FlowLayoutPanel target)
        {
            target.Controls.Clear();

            string      json     = File.ReadAllText(JsonPathLocal);
            RootObject  database = JsonConvert.DeserializeObject <RootObject>(json);
            List <Card> cards    = database.Data.Cards; //we only want a list of Card objects

            //Group duplicates
            var dup = deck.Cards
                      .GroupBy(x => new { x.CardId })
                      .Select(group => new { ID = group.Key, Count = group.Count() });

            //Show deck's contents
            target.Hide();
            foreach (var basex in dup)
            {
                Card       targetCard = cards.Find(x => x.CardId == basex.ID.CardId);
                CardBanner banner     = new CardBanner(targetCard.CardId, targetCard.CardName, targetCard.Cost, targetCard.RarityId, basex.Count, true);
                target.Controls.Add(banner);
            }
            target.Show();
        }