Esempio n. 1
0
        public void TestDiscard_Fail()
        {
            DiscardPile discardPile = new DiscardPile();
            Card        card1       = new Card(new CardIdType(0), new CardIndexType(0), CardColorType.Blue, CardValueType.Value1);
            Card        card2       = new Card(new CardIdType(0), new CardIndexType(0), CardColorType.Blue, CardValueType.Value1);

            Debug.Assert(discardPile.Discard(card1));
            Debug.Assert(!discardPile.Discard(card2));
        }
Esempio n. 2
0
    public void DealCards(List <Player> players)
    {
        //loop through each player
        foreach (Player player in players)
        {
            // Add 5-8 cards to the players hand
            for (int card = 0; card < PlayerPrefs.GetInt("cards"); card++)
            {
                player.AddCard(pickupDeck[pickupDeck.Count - 1]); // add card to hand
                pickupDeck.RemoveAt(pickupDeck.Count - 1);        // remove card from pickup deck
            }
        }

        int[] powerCards = { 1, 2, 8, 10, 11 };

        //start looping through the pickup deck
        for (int cardIndex = pickupDeck.Count - 1; cardIndex > 0; cardIndex--)
        {
            // if the card is not a power card
            if (!powerCards.Contains(pickupDeck[cardIndex].value))
            {
                // add the card to the discard pile
                discardPile.Discard(pickupDeck[cardIndex]);

                // remove the card from the pickup deck
                pickupDeck.RemoveAt(cardIndex);
                break;
            }
        }
    }
Esempio n. 3
0
        public void TestDiscard_Success()
        {
            DiscardPile discardPile = new DiscardPile();
            Card        card        = new Card(new CardIdType(0), new CardIndexType(0), CardColorType.Blue, CardValueType.Value1);

            Debug.Assert(discardPile.Discard(card));
        }
Esempio n. 4
0
 public void DiscardInto(DiscardPile discardPile, IActionScope turnScope)
 {
     this.ToList().ForEach(card =>
     {
         Remove(card);
         discardPile.Discard(card, turnScope);
     });
 }
Esempio n. 5
0
    public void Discard(int cardIndex)
    {
        CardObject cardToDiscard = hand[cardIndex];

        // add the card to the discard pile
        discardPile.Discard(cardToDiscard.GetCard());

        //Check if the card was a power card
        UsePowerCard(cardIndex);

        // remove the card from the hand list
        hand.RemoveAt(cardIndex);

        // destroy the gameobject
        Destroy(cardToDiscard.gameObject);

        //if the card being discarded is not an Ace
        if (discardPile.GetTopCard().value != 1)
        {
            EndTurn();
        }
    }
Esempio n. 6
0
    protected void DisCard()
    {
        CardBehaviour.Instance.RemoveCard(this);

        if (CardBehaviour.Instance.selectingCard == this)
        {
            CardBehaviour.Instance.selectingCard = null;
        }

        DiscardPile discardPile = null;

        if (isController)
        {
            if (info.type == Card.Type.bonus)
            {
                discardPile = Game.Instance.controller.piles.bonusPile.discardPile;
            }
            else if (info.type == Card.Type.mogi)
            {
                discardPile = Game.Instance.controller.piles.mogiPile.discardPile;
            }
        }
        else
        {
            if (info.type == Card.Type.bonus)
            {
                discardPile = Game.Instance.opponent.piles.bonusPile.discardPile;
            }
            else if (info.type == Card.Type.mogi)
            {
                discardPile = Game.Instance.opponent.piles.mogiPile.discardPile;
            }
        }

        discardPile.Discard(name);

        onDiscard?.Invoke();
    }