/// <summary> /// Draws out initial hand from the selected deck. /// </summary> /// <param name="deck">deck to draw the hand from</param> public Hand(Deck deck) { //loops until we reach the default hand size for (int i = 0; i < defaultHandSize; i++) { //draw a card hand.Add(deck.drawCard()); } }
/// <summary> /// Method used to draw cards from the deck /// </summary> /// <param name="myDeck">a deck object</param> public void DrawCards(Deck myDeck) { bool attackerDraw = true; string filePath = @"../../GameLog.txt"; string tempString = ""; //check the remaining deck size while (attackerDraw) { //check to see if there are still cards in the deck if (myDeck.getCardsRemaining() > 0) { //check if the attacker's hand is greater than 6 (standard hand size) int attackerHandSize = this.playerHand.gethandSize(); if (attackerHandSize < 6) { Card drawnCard = myDeck.drawCard(); tempString += " " + drawnCard.ToString(); //output what card the player drew this.playerHand.addCard(drawnCard); } else { attackerDraw = false; } } else { attackerDraw = false; } } if (tempString != "") { using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine(this.playerName + " drew:" + tempString); } } }