Exemplo n.º 1
0
        //Passing in null counts as it being false, don't want to trash because they have the option
        public StatusObject trashACopperForCurrencyBonus(Card aCard)
        {
            StatusObject retVal = new StatusObject(false);
            if (this.trashesNeeded <= 0 || !this.myHand.contains(CardMother.Copper()))
            {
                this.trashesNeeded = 0;
                retVal.setCopperTrashedForCurrency(true);
                return retVal;
            }
            if (aCard == null)
            {
                retVal.setCopperTrashedForCurrency(true);
                return retVal;
            }
            if (!aCard.Equals(CardMother.Copper()))
            {
                return retVal;
            }

            if (!this.getHand().contains(aCard))
            {
                return retVal;
            }

            this.getHand().remove(aCard);
            this.bonusCurrencyForBuy += this.trashCurrencyBonus;
            this.trashesNeeded--;
            if (trashesNeeded == 0)
            {
                retVal.setCopperTrashedForCurrency(true);
            }
            else
            {
                retVal.setTrashACopperForCurrency(true);
            }
            return retVal;
        }
Exemplo n.º 2
0
 public void testEquals()
 {
     Card test = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Card estate = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Object generic = new Object();
     Assert.True(test.Equals(estate));
     Assert.False(test.Equals(generic));
     Card oneoff = new Card(1, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     oneoff = new Card(0, 1, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 1, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 1, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 0, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 1, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 1, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Not Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Changed Description", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 0, "Null");
     Assert.False(test.Equals(oneoff));
 }
Exemplo n.º 3
0
        public StatusObject mineATreasureCard(Card c)
        {
            StatusObject retVal = new StatusObject(false);
            if (c == null)
            {
                return retVal;
            }
            if (this.trashesNeeded <= 0 || (!this.myHand.contains(CardMother.Copper()) && !this.myHand.contains(CardMother.Silver())))
            {
                retVal.setMinedCorrectly(true);
                this.trashesNeeded = 0;
                return retVal;
            }
            if (c.Equals(CardMother.Copper()) || c.Equals(CardMother.Silver()))
            {
                if (c.Equals(CardMother.Copper()))
                {
                    this.getHand().getHand().Remove(c);
                    this.getHand().getHand().Add(CardMother.Silver());
                    retVal.setMinedCorrectly(true);
                    this.trashesNeeded--;
                }

                else
                {
                    this.getHand().getHand().Remove(c);
                    this.getHand().getHand().Add(CardMother.Gold());
                    retVal.setMinedCorrectly(true);
                    this.trashesNeeded--;
                }
                if (this.trashesNeeded > 0)
                {
                    retVal.setMinedCorrectly(false);
                    retVal.setMineTreasure(true);
                }
                return retVal;
            }
            else
            {
                return retVal;
            }
        }