[SNC] Implemented Extract the Truth

This commit is contained in:
Daniel Bomar 2022-04-15 16:43:36 -05:00
parent b4af1c3473
commit 8eccb669f9
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 69 additions and 3 deletions

View file

@ -0,0 +1,50 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Mode;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.target.common.TargetOpponent;
/**
*
* @author weirddan455
*/
public final class ExtractTheTruth extends CardImpl {
private static final FilterCard filter = new FilterCard("creature, enchantment, or planeswalker card");
static {
filter.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.ENCHANTMENT.getPredicate(), CardType.PLANESWALKER.getPredicate()));
}
public ExtractTheTruth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
// Choose one
// Target opponent reveals their hand. You may choose a creature, enchantment, or planeswalker card from it. That player discards that card.
DiscardCardYouChooseTargetEffect effect = new DiscardCardYouChooseTargetEffect(filter);
effect.setOptional(true);
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetOpponent());
// Target opponent sacrifices an enchantment.
this.getSpellAbility().addMode(new Mode(new SacrificeEffect(StaticFilters.FILTER_PERMANENT_ENCHANTMENT, 1, "Target opponent")).addTarget(new TargetOpponent()));
}
private ExtractTheTruth(final ExtractTheTruth card) {
super(card);
}
@Override
public ExtractTheTruth copy() {
return new ExtractTheTruth(this);
}
}

View file

@ -91,6 +91,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Evolving Door", 144, Rarity.RARE, mage.cards.e.EvolvingDoor.class));
cards.add(new SetCardInfo("Exhibition Magician", 106, Rarity.COMMON, mage.cards.e.ExhibitionMagician.class));
cards.add(new SetCardInfo("Exotic Pets", 185, Rarity.UNCOMMON, mage.cards.e.ExoticPets.class));
cards.add(new SetCardInfo("Extract the Truth", 78, Rarity.COMMON, mage.cards.e.ExtractTheTruth.class));
cards.add(new SetCardInfo("Faerie Vandal", 44, Rarity.UNCOMMON, mage.cards.f.FaerieVandal.class));
cards.add(new SetCardInfo("Fatal Grudge", 187, Rarity.UNCOMMON, mage.cards.f.FatalGrudge.class));
cards.add(new SetCardInfo("Fight Rigging", 145, Rarity.RARE, mage.cards.f.FightRigging.class));

View file

@ -30,6 +30,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
private DynamicValue numberCardsToReveal;
private final DynamicValue numberCardsToDiscard;
private boolean revealAllCards;
private boolean optional = false;
public DiscardCardYouChooseTargetEffect() {
this(StaticFilters.FILTER_CARD_A);
@ -99,6 +100,12 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
this.numberCardsToDiscard = effect.numberCardsToDiscard;
this.numberCardsToReveal = effect.numberCardsToReveal;
this.revealAllCards = effect.revealAllCards;
this.optional = effect.optional;
}
public void setOptional(boolean optional) {
this.optional = optional;
staticText = this.setText();
}
@Override
@ -147,7 +154,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
if (numberToDiscard <= 0) {
return result;
}
TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter);
TargetCard target = new TargetCard(optional ? 0 : numberToDiscard, numberToDiscard, Zone.HAND, filter);
if (!controller.choose(Outcome.Benefit, revealedCards, target, game)) {
return result;
}
@ -175,7 +182,11 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
}
sb.append(" reveals ");
if (revealAllCards) {
sb.append("their hand. You choose ");
sb.append("their hand. You ");
if (optional) {
sb.append("may ");
}
sb.append("choose ");
if (discardMultipleCards) {
sb.append(numberCardsToDiscard).append(' ').append(filter.getMessage());
} else {
@ -194,7 +205,11 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
sb.append("a number of cards from their hand equal to ");
sb.append(numberCardsToReveal.getMessage());
}
sb.append(". You choose ");
sb.append(". You ");
if (optional) {
sb.append("may ");
}
sb.append("choose ");
if (numberCardsToDiscard instanceof StaticValue) {
sb.append(CardUtil.numberToText(((StaticValue) numberCardsToDiscard).getValue()));
} else {