Ejemplo n.º 1
0
    /* Builds a deck given the types and their respective quantities in the array arguments.
     * NOTE: types and weights MUST be of the same length!
     * Also, there should be no null values in types and weights should contain no nonpositive values either! */
    public DeckManager(CardScript.CardType[] types, int[] weights)
    {
        deck = new CardCollection ();
        // Adds a number of each card type equal to their respective weights
        for (int idx = 0; idx < types.Length; ++idx) {
            for (int qty = 0; qty < weights[idx]; ++qty) {
                deck.add(new CardScript(types[idx]));
            }
        }

        hand = new CardCollection();
        discardPile = new CardCollection();
    }