public void testBuyAndVictory() { CardStack s = new CardStack(5, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 0, "Null")); p.buy(s); p.setVictoryPts(); Assert.AreEqual(5, p.getVictoryPts()); }
public void testAddBuysAndMultipleBuy() { p.addBuys(1); CardStack c = new CardStack(120,CardMother.Copper()); Assert.IsTrue(p.buy(c)); Assert.IsTrue(p.buy(c)); Assert.IsFalse(p.buy(c)); }
public void testPlayingWorkshop() { p.getHand().getHand().Add(CardMother.Workshop()); Assert.IsTrue(p.play(CardMother.Workshop()).wasPlayedProperly()); CardStack feast = new CardStack(1, CardMother.Feast()); Assert.IsTrue(p.getGain()); Assert.IsTrue(p.gainCard(feast).getGainedProperly()); Assert.AreEqual(CardMother.Feast(), p.getDeck().getInDiscard()[0]); }
public void testPlayingFeast() { p.getHand().getHand().Add(CardMother.Feast()); Assert.IsTrue(p.play(CardMother.Feast()).wasPlayedProperly()); CardStack duchy = new CardStack(1, CardMother.Duchy()); Assert.IsTrue(p.gainCard(duchy).getGainedProperly()); Assert.AreEqual(CardMother.Duchy(), p.getDeck().getInDiscard()[0]); Assert.IsFalse(p.getPlayed().Contains(CardMother.Feast())); }
public void testGainPass() { Assert.IsFalse(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); p.setGain(true); p.setCurrencyForGainBonus(2); Assert.IsTrue(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); Assert.AreEqual(2, p.getCurrencyForGain()); Assert.IsTrue(p.getGain()); p.setGainsLeft(1); CardStack estate = new CardStack(1, CardMother.Estate()); Assert.IsTrue(p.gainCard(estate).getGainedProperly()); Assert.AreEqual(CardMother.Estate(),p.getDeck().getInDiscard()[0]); Assert.IsFalse(p.getGain()); Assert.AreEqual(0, p.getCurrencyForGain()); }
public void testGainFailNotGainInPlayer() { Assert.IsFalse(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); p.setGain(true); p.setCurrencyForGainBonus(2); Assert.IsTrue(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); Assert.AreEqual(2, p.getCurrencyForGain()); Assert.IsTrue(p.getGain()); p.setGain(false); CardStack copper = new CardStack(1, CardMother.Copper()); Assert.IsFalse(p.gainCard(copper).getGainedProperly()); }
public StatusObject gainCard(CardStack cs) { StatusObject o = new StatusObject(false); if (cs.isEmpty()) { o.setMessage(Internationalizer.getMessage("StackEmpty")); return o; } if (!this.gain) { o.setMessage(Internationalizer.getMessage("NotGain")); return o; } if (this.gainsLeft <= 0) { o.setMessage(Internationalizer.getMessage("NoGainsLeft")); return o; } if (this.currencyForGain >= cs.getCard().getCost()) { this.getDeck().discard(cs.buyOne()); this.gainsLeft--; if (this.gainsLeft == 0) { this.currencyForGain = 0; this.gain = false; } else { if (this.lastPlayedCard.Equals(CardMother.Remodel())) { o.setMessage(Internationalizer.getMessage("WasRemodel")); o.setTrashForGain(true); } else { o.setMessage(Internationalizer.getMessage("GainsLeft")); o.setTrashedCorrectly(true); } } o.setGainedProperly(true); } else { o.setMessage(Internationalizer.getMessage("NotEnoughCur") + this.currencyForGain); } return o; }
public void testEmpty() { CardStack s = new CardStack(0, new Card(0, 0, 0, 0, 0, 0, 0, "Null", "Null", 0, "Null")); Assert.True(s.isEmpty()); s = new CardStack(1, new Card(0, 0, 0, 0, 0, 0, 0, "Null", "Null", 0, "Null")); Assert.False(s.isEmpty()); }
public void testFailBuyEmptyStack() { CardStack s = new CardStack(0, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 0, "Null")); Assert.IsFalse(p.buy(s)); s = new CardStack(1, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 0, "Null")); Assert.IsTrue(p.buy(s)); Assert.IsFalse(p.buy(s)); }
public void testThroneRoomAndWorkshop() { p.getHand().getHand().Add(CardMother.ThroneRoom()); p.getHand().getHand().Add(CardMother.Workshop()); p.play(CardMother.ThroneRoom()); p.play(CardMother.Workshop()); Assert.AreEqual(2, p.getGainsLeft()); CardStack silver = new CardStack(2, CardMother.Silver()); StatusObject o = p.gainCard(silver); Assert.IsTrue(o.getGainedProperly()); Assert.IsTrue(o.wasTrashedCorrectly()); CardStack gold = new CardStack(1, CardMother.Gold()); o = p.gainCard(gold); Assert.IsFalse(o.getGainedProperly()); o = p.gainCard(silver); Assert.IsTrue(o.getGainedProperly()); Assert.IsFalse(o.wasTrashedCorrectly()); }
public void testThroneRoomAndRemodel() { p.getHand().getHand().Add(CardMother.ThroneRoom()); p.getHand().getHand().Add(CardMother.Remodel()); Assert.IsTrue(p.play(CardMother.ThroneRoom()).wasPlayedProperly()); Assert.AreEqual(1, p.getActionsLeft()); Assert.AreEqual(2, p.getPlaysOfNextCardLeft()); StatusObject o = p.play(CardMother.Remodel()); Assert.IsTrue(o.wasPlayedProperly()); Assert.IsTrue(o.trashForGainCheck()); Assert.AreEqual(2,p.getGainsLeft()); CardStack estate = new CardStack(2, CardMother.Estate()); o = p.trashForGain(CardMother.Copper()); Assert.IsTrue(o.wasTrashedCorrectly()); o = p.gainCard(estate); Assert.AreEqual(1, p.getGainsLeft()); Assert.IsTrue(o.trashForGainCheck());//still have gains left //so signal to trashForGain from remodel o = p.trashForGain(CardMother.Copper()); Assert.IsTrue(o.wasTrashedCorrectly()); o = p.gainCard(estate); //Console.Write(o.getMessage()); Assert.IsTrue(o.getGainedProperly()); Assert.IsFalse(o.wasTrashedCorrectly()); Assert.IsFalse(o.trashForGainCheck()); }
public void testThroneRoomAndFeast() { p.getHand().getHand().Add(CardMother.ThroneRoom()); p.getHand().getHand().Add(CardMother.Feast()); p.play(CardMother.ThroneRoom()); p.play(CardMother.Feast()); Assert.AreEqual(2, p.getGainsLeft()); CardStack lab = new CardStack(2, CardMother.Laboratory()); StatusObject o = p.gainCard(lab); Assert.IsTrue(o.getGainedProperly()); Assert.IsTrue(o.wasTrashedCorrectly()); o = p.gainCard(lab); Assert.IsTrue(o.getGainedProperly()); Assert.IsFalse(o.wasTrashedCorrectly()); }
public void testRemodelSequenceWorthMore() { p.getHand().getHand().Add(CardMother.Remodel()); p.getHand().getHand().Add(CardMother.Remodel()); Assert.IsTrue(p.play(CardMother.Remodel()).wasPlayedProperly()); CardStack gold = new CardStack(1, CardMother.Gold()); Assert.IsTrue(p.trashForGain(CardMother.Remodel()).wasTrashedCorrectly()); Assert.IsTrue(p.gainCard(gold).getGainedProperly()); Assert.AreEqual(CardMother.Gold(), p.getDeck().getInDiscard()[0]); }
public void testRemodelSequence() { p.getHand().getHand().Add(CardMother.Remodel()); Assert.IsTrue(p.play(CardMother.Remodel()).wasPlayedProperly()); Assert.AreEqual(1, p.getGainsLeft()); CardStack estate = new CardStack(1, CardMother.Estate()); Assert.IsTrue(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); Assert.IsTrue(p.gainCard(estate).getGainedProperly()); Assert.AreEqual(CardMother.Estate(),p.getDeck().getInDiscard()[0]); Assert.AreEqual(0, p.getGainsLeft()); Assert.IsFalse(p.getGain()); }
public void testBuyFailureBecauseOfCurrency() { CardStack s = new CardStack(5, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 10, "Null")); Assert.IsFalse(p.buy(s)); }
public void testFailMultipleBuys() { CardStack s = new CardStack(5, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 0, "Null")); Assert.IsTrue(p.buy(s)); Assert.IsFalse(p.buy(s)); }
public void testbuyandvictorywithgame() { CardStack s = new CardStack(5, new Card(0, 0, 0, 0, 2, 0, 0, "Test", "Null", 0, "Null")); Player p = game.getCurrentPlayer(); p.buy(s); p.setVictoryPts(); Assert.AreEqual(5, p.getVictoryPts()); }
public void testGainFailNoGainsLeft() { Assert.IsFalse(p.trashForGain(CardMother.Copper()).wasTrashedCorrectly()); p.setGain(true); CardStack copper = new CardStack(1, CardMother.Copper()); Assert.IsFalse(p.gainCard(copper).getGainedProperly()); }
public void setUp() { this.stackDefault = new CardStack(new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Estate")); this.stackFive = new CardStack(5, new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Estate")); this.stackOne = new CardStack(1, new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Estate")); }
public Boolean buy(CardStack aStack) { this.bonusCurrencyForBuy = 0;//reset it at the buy. This allows the bonus to be kept through multiple getCurrency calls int cost = aStack.getCard().getCost(); int currency = this.currencyAvailable; if (!(aStack.isEmpty()) && (cost <= currency) && (this.buysLeft > 0)) { this.myDeck.discard(aStack.buyOne()); this.buysLeft--; this.currencyAvailable -= aStack.getCard().getCost(); if (this.game != null) { this.game.addToGameMessage(this.name + Internationalizer.getMessage("Bought") + aStack.getCard().getName()); } return true; } return false; }