Esempio n. 1
0
 public Player(int id)
 {
     this.gain = false;
     this.currencyForGain = 0;
     this.currencyForGainBonus = 0;
     this.gainsLeft = 0;
     this.playMultipleTimes = false;
     this.timesToPlayLeft = 1;
     this.timesToPlayNextCard = 1;
     this.id = id;
     myDeck = new Deck();
     myDeck.reshuffle();
     myHand = new Hand();
     for (int i = 0; i < 5; i++)
     {
         myHand.draw(myDeck);
     }
     timesPlayed = new List<int>();
     played = new List<Card>();
     victoryPts = 3;
     this.buysLeft = 1;
     this.currencyAvailable = 0;
     this.actionsLeft = 1;
     this.name = null;
     this.game = null;
     this.lastPlayedCard = null;
     this.trashesNeeded = 0;
     this.trashCurrencyBonus = 0;
     this.bonusCurrencyForBuy = 0;
     this.possibleTrashes = 0;
     this.otherPlayers = new List<Player>();
     this.functionsToCall = new Queue<DelayedFunction>();
     this.thiefList = new List<List<Card>>();
 }
Esempio n. 2
0
 public Player()
 {
     deck = new List<Card>();
     discard = new List<Card>();
     hand = new Hand();
     canSelectHand = false;
     canSelectStore = false;
 }
Esempio n. 3
0
 public void testDiscard()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     test.draw(d);
     Assert.AreEqual(1, test.getHand().Count);
     test.discard(test.getHand()[0], d);
     Assert.AreEqual(0, test.getHand().Count);
     Assert.AreEqual(1, d.getInDiscard().Count);
     Assert.IsFalse(test.discard(new Card(0, 0, 0, 0, 0, 0, 0, "Null", "Null", 0, "Null"), d));
     Assert.AreEqual(1, d.getInDiscard().Count);
 }
Esempio n. 4
0
 public void testGetCurrency()
 {
     Hand test = new Hand();
     Deck d = new Deck();//default with seven coppers in front.
     Assert.AreEqual(0, test.getCurrency());
     test.draw(d);
     Assert.AreEqual(1, test.getCurrency());
     for (int i = 0; i < 6; i++)
     {
         test.draw(d);
     }
     Assert.AreEqual(7, test.getCurrency());
     test.draw(d);
     Assert.AreEqual(7, test.getCurrency());
 }
Esempio n. 5
0
 public void testDraw()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     Assert.AreEqual(0, test.getHand().Count);
     test.draw(d);
     Assert.AreEqual(1, test.getHand().Count);
     while (d.cardsLeft() > 0)
     {
         test.draw(d);
     }
     Assert.AreEqual(10, test.getHand().Count);
     Assert.IsFalse(test.draw(d));
     Assert.AreEqual(10, test.getHand().Count);
 }
Esempio n. 6
0
 public void testContains()
 {
     Hand test = new Hand();
     Card estate = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "1 Victory Point", 2, "Estate");
     Card copper = new Card(1, 1, 0, 0, 0, 0, 0, "Copper", "1 Currency", 0, "Copper");
     Card other = new Card(0, 0, 0, 0, 0, 0, 0, "NULL", "NULL", 0, "Null");
     List<Card> smallDeck = new List<Card>();
     smallDeck.Add(estate);
     smallDeck.Add(copper);
     Deck toDraw = new Deck(smallDeck);
     Assert.IsFalse(test.contains(estate));
     test.draw(toDraw);
     Assert.IsTrue(test.contains(estate));
     Assert.IsFalse(test.contains(copper));
     test.draw(toDraw);
     Assert.IsTrue(test.contains(copper));
     Assert.IsFalse(test.contains(other));
 }
Esempio n. 7
0
 public void testGetFirstVictoryCard()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     test.draw(d);
     test.draw(d);
     test.getHand().Add(CardMother.Duchy());
     test.getHand().Add(CardMother.Estate());
     Assert.AreEqual(CardMother.Duchy(), test.getFirstVictoryCard());
 }
Esempio n. 8
0
 public void testSize()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     Assert.AreEqual(0,test.size());
     test.draw(d);
     Assert.AreEqual(1, test.size());
 }
Esempio n. 9
0
 public void testRemoveCardNotInHand()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     test.draw(d);
     Card copper = CardMother.Copper();
     Assert.AreEqual(copper, test.remove(copper));
     Assert.IsNull(test.remove(copper));
     test.draw(d);
     Card estate = CardMother.Estate();
     Assert.IsNull(test.remove(estate));
 }
Esempio n. 10
0
 public void testInintializes()
 {
     Hand test = new Hand();
     Assert.NotNull(test);
 }
Esempio n. 11
0
 public void testGetFirstVictoryCardNoVictory()
 {
     Hand test = new Hand();
     Deck d = new Deck();
     test.draw(d);
     test.draw(d);
     Assert.IsNull(test.getFirstVictoryCard());
 }
Esempio n. 12
0
 public void cleanUp()
 {
     foreach (Card c in myHand.getHand())
     {
         myDeck.discard(c);
     }
     foreach (Card c in this.played)
     {
         myDeck.discard(c);
     }
     myHand = new Hand();
     for (int i = 0; i < 5; i++)
     {
         myHand.draw(myDeck);
     }
     this.buysLeft = 1;
     this.actionsLeft = 1;
     this.played = new List<Card>();
     this.timesPlayed = new List<int>();
     this.gain = false;
     this.gainsLeft = 0;
     this.playMultipleTimes = false;
     this.timesToPlayLeft = 1;
 }
Esempio n. 13
0
 public void moveCard(Card c, Hand origin, List<Card> destination)
 {
     destination.Add(c);
     origin.Remove(c);
 }