Example #1
0
 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;
 }
Example #2
0
 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());
 }
Example #3
0
 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;
 }