Implement cards: Doomsday Specter, Marsh Crocodile, Natural Emergence, Razing Snidd, and Sparkcaster

This commit is contained in:
LoneFox 2015-07-03 15:38:15 +03:00
parent 25ca463520
commit 042efb9c22
6 changed files with 427 additions and 16 deletions

View file

@ -73,9 +73,9 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
public DiscardCardYouChooseTargetEffect(FilterCard filter) {
this(filter, TargetController.OPPONENT);
}
public DiscardCardYouChooseTargetEffect(TargetController targetController, int numberCardsToReveal) {
this(new FilterCard("one card"), targetController,
this(new FilterCard("one card"), targetController,
new StaticValue(numberCardsToReveal, new StringBuilder(CardUtil.numberToText(numberCardsToReveal)).append(" cards").toString()));
}
@ -87,28 +87,28 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
super(Outcome.Discard);
this.targetController = targetController;
this.filter = filter;
this.revealAllCards = false;
this.numberCardsToReveal = numberCardsToReveal;
this.numberCardsToDiscard = new StaticValue(1);
staticText = this.setText();
staticText = this.setText();
}
public DiscardCardYouChooseTargetEffect(FilterCard filter, TargetController targetController) {
this(new StaticValue(1), filter, targetController);
}
public DiscardCardYouChooseTargetEffect(DynamicValue numberCardsToDiscard, FilterCard filter, TargetController targetController) {
super(Outcome.Discard);
this.targetController = targetController;
this.filter = filter;
this.numberCardsToDiscard = numberCardsToDiscard;
this.numberCardsToReveal = null;
this.revealAllCards = true;
staticText = this.setText();
staticText = this.setText();
}
public DiscardCardYouChooseTargetEffect(final DiscardCardYouChooseTargetEffect effect) {
@ -117,12 +117,12 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
this.targetController = effect.targetController;
this.numberCardsToDiscard = effect.numberCardsToDiscard;
this.numberCardsToReveal = effect.numberCardsToReveal;
this.revealAllCards = effect.revealAllCards;
this.revealAllCards = effect.revealAllCards;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(targetPointer.getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (player != null && controller != null) {
@ -131,7 +131,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
}
int numberToReveal = this.numberCardsToReveal.calculate(game, source, this);
if (numberToReveal > 0) {
Cards revealedCards = new CardsImpl(Zone.HAND);
Cards revealedCards = new CardsImpl(Zone.HAND);
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
if (player.getHand().size() > numberToReveal) {
TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in "+ player.getLogName() +"'s hand"));
@ -149,10 +149,10 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
}
} else {
revealedCards.addAll(player.getHand());
}
}
player.revealCards(sourceCard != null ? sourceCard.getName() :"Discard", revealedCards, game);
boolean result = true;
int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game);
int numberToDiscard = Math.min(this.numberCardsToDiscard.calculate(game, source, this), filteredCardsCount);
@ -220,7 +220,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
} else {
sb.append(" of them.");
}
sb.append(" That player discards ").append(discardMultipleCards ? "those cards" : "that card").toString();
return sb.toString();
}