Improve WishEffect text and refactor ctors (if filter exists, wished for card must be revealed)

This commit is contained in:
Alex W. Jackson 2022-01-28 23:54:32 -05:00
parent 8376e7a1a3
commit 140be70fb8
15 changed files with 54 additions and 49 deletions

View file

@ -16,7 +16,7 @@ import mage.filter.FilterCard;
*/ */
public final class BurningWish extends CardImpl { public final class BurningWish extends CardImpl {
private static final FilterCard filter = new FilterCard("a sorcery card"); private static final FilterCard filter = new FilterCard("sorcery card");
static { static {
filter.add(CardType.SORCERY.getPredicate()); filter.add(CardType.SORCERY.getPredicate());
@ -25,7 +25,7 @@ public final class BurningWish extends CardImpl {
public BurningWish(UUID ownerId, CardSetInfo setInfo) { public BurningWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}");
// You may choose a sorcery card you own from outside the game, reveal that card, and put it into your hand. // You may reveal a sorcery card you own from outside the game and put it into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter)); this.getSpellAbility().addEffect(new WishEffect(filter));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);

View file

@ -16,7 +16,7 @@ import mage.filter.FilterCard;
*/ */
public final class CoaxFromTheBlindEternities extends CardImpl { public final class CoaxFromTheBlindEternities extends CardImpl {
private static final FilterCard filter = new FilterCard("an Eldrazi card"); private static final FilterCard filter = new FilterCard("Eldrazi card");
static { static {
filter.add(SubType.ELDRAZI.getPredicate()); filter.add(SubType.ELDRAZI.getPredicate());
@ -25,8 +25,10 @@ public final class CoaxFromTheBlindEternities extends CardImpl {
public CoaxFromTheBlindEternities(UUID ownerId, CardSetInfo setInfo) { public CoaxFromTheBlindEternities(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
// You may choose an Eldrazi card you own from outside the game or in exile, reveal that card, and put it into your hand. // You may reveal an Eldrazi card you own from outside the game
this.getSpellAbility().addEffect(new WishEffect(filter, true, true)); // or choose a face-up Eldrazi card you own in exile.
// Put that card into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter, true));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);
} }

View file

@ -16,7 +16,7 @@ import mage.filter.FilterCard;
*/ */
public final class CunningWish extends CardImpl { public final class CunningWish extends CardImpl {
private static final FilterCard filter = new FilterCard("an instant card"); private static final FilterCard filter = new FilterCard("instant card");
static { static {
filter.add(CardType.INSTANT.getPredicate()); filter.add(CardType.INSTANT.getPredicate());
@ -25,7 +25,7 @@ public final class CunningWish extends CardImpl {
public CunningWish(UUID ownerId, CardSetInfo setInfo) { public CunningWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
// You may choose an instant card you own from outside the game, reveal that card, and put it into your hand. // You may reveal an instant card you own from outside the game and put it into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter)); this.getSpellAbility().addEffect(new WishEffect(filter));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);

View file

@ -7,7 +7,6 @@ import mage.abilities.hint.common.OpenSideboardHint;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters;
import java.util.UUID; import java.util.UUID;
@ -19,8 +18,8 @@ public final class DeathWish extends CardImpl {
public DeathWish(UUID ownerId, CardSetInfo setInfo) { public DeathWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// You may choose a card you own from outside the game and put it into your hand. // You may put a card you own from outside the game into your hand.
this.getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_A, false)); this.getSpellAbility().addEffect(new WishEffect());
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);
// You lose half your life, rounded up. // You lose half your life, rounded up.

View file

@ -45,7 +45,7 @@ public final class FaeOfWishes extends AdventureCard {
this.addAbility(ability); this.addAbility(ability);
// Granted // Granted
// You may choose a noncreature card you own from outside the game, reveal it, and put it into your hand. // You may reveal a noncreature card you own from outside the game and put it into your hand.
this.getSpellCard().getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_A_NON_CREATURE)); this.getSpellCard().getSpellAbility().addEffect(new WishEffect(StaticFilters.FILTER_CARD_A_NON_CREATURE));
this.getSpellCard().getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellCard().getSpellAbility().addHint(OpenSideboardHint.instance);
} }

View file

@ -17,7 +17,7 @@ import mage.filter.predicate.mageobject.MulticoloredPredicate;
*/ */
public final class GlitteringWish extends CardImpl { public final class GlitteringWish extends CardImpl {
private static final FilterCard filter = new FilterCard("a multicolored card"); private static final FilterCard filter = new FilterCard("multicolored card");
static { static {
filter.add(MulticoloredPredicate.instance); filter.add(MulticoloredPredicate.instance);
@ -26,7 +26,7 @@ public final class GlitteringWish extends CardImpl {
public GlitteringWish(UUID ownerId, CardSetInfo setInfo) { public GlitteringWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{W}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{W}");
// You may choose a multicolored card you own from outside the game, reveal that card, and put it into your hand. // You may reveal a multicolored card you own from outside the game and put it into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter)); this.getSpellAbility().addEffect(new WishEffect(filter));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);

View file

@ -17,7 +17,7 @@ import mage.filter.predicate.Predicates;
*/ */
public final class GoldenWish extends CardImpl { public final class GoldenWish extends CardImpl {
private static final FilterCard filter = new FilterCard("an artifact or enchantment card"); private static final FilterCard filter = new FilterCard("artifact or enchantment card");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(

View file

@ -48,9 +48,9 @@ public final class KarnTheGreatCreator extends CardImpl {
ability.addTarget(new TargetPermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter, false));
this.addAbility(ability); this.addAbility(ability);
// -2: You may choose an artifact card you own from outside the game or in exile, reveal that card, and put it into your hand. // -2: You may reveal an artifact card you own from outside the game or choose a face-up artifact card you own in exile. Put that card into your hand.
this.addAbility(new LoyaltyAbility(new WishEffect( this.addAbility(new LoyaltyAbility(new WishEffect(
StaticFilters.FILTER_CARD_ARTIFACT_AN, true, true StaticFilters.FILTER_CARD_ARTIFACT, true
), -2).addHint(OpenSideboardHint.instance)); ), -2).addHint(OpenSideboardHint.instance));
} }

View file

@ -37,7 +37,7 @@ public final class LegionAngel extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Legion Angel enters the battlefield, you may reveal a card you own named Legion Angel from outside the game and put it into your hand. // When Legion Angel enters the battlefield, you may reveal a card you own named Legion Angel from outside the game and put it into your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new WishEffect(filter, true, false) this.addAbility(new EntersBattlefieldTriggeredAbility(new WishEffect(filter)
.setText("you may reveal a card you own named Legion Angel from outside the game and put it into your hand")) .setText("you may reveal a card you own named Legion Angel from outside the game and put it into your hand"))
.addHint(OpenSideboardHint.instance)); .addHint(OpenSideboardHint.instance));
} }

View file

@ -17,7 +17,7 @@ import mage.filter.predicate.Predicates;
*/ */
public final class LivingWish extends CardImpl { public final class LivingWish extends CardImpl {
private static final FilterCard filter = new FilterCard("a creature or land card"); private static final FilterCard filter = new FilterCard("creature or land card");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
@ -28,7 +28,7 @@ public final class LivingWish extends CardImpl {
public LivingWish(UUID ownerId, CardSetInfo setInfo) { public LivingWish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// You may choose a creature or land card you own from outside the game, reveal that card, and put it into your hand. // You may reveal a creature or land card you own from outside the game and put it into your hand.
this.getSpellAbility().addEffect(new WishEffect(filter)); this.getSpellAbility().addEffect(new WishEffect(filter));
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);

View file

@ -7,7 +7,6 @@ import mage.abilities.hint.common.OpenSideboardHint;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
@ -24,9 +23,8 @@ public final class MastermindsAcquisition extends CardImpl {
// Search your library for a card and put that card into your hand. Then shuffle your library. // Search your library for a card and put that card into your hand. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary())); this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary()));
// Choose a card you own from outside the game and put it into your hand. // Put a card you own from outside the game into your hand.
Mode mode = new Mode(new WishEffect(StaticFilters.FILTER_CARD_A, false) Mode mode = new Mode(new WishEffect().setText("put a card you own from outside the game into your hand"));
.setText("Put a card you own from outside the game into your hand"));
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
this.getSpellAbility().addHint(OpenSideboardHint.instance); this.getSpellAbility().addHint(OpenSideboardHint.instance);
} }

View file

@ -16,7 +16,6 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
@ -68,7 +67,7 @@ class RingOfMarufEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
new WishEffect(new FilterCard(), false).apply(game, source); new WishEffect().apply(game, source);
this.discard(); this.discard();
return true; return true;
} }

View file

@ -15,7 +15,6 @@ import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -50,7 +49,7 @@ public final class TheRavensWarning extends CardImpl {
// III You may put a card you own from outside the game on top of your library. // III You may put a card you own from outside the game on top of your library.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III,
new WishEffect(StaticFilters.FILTER_CARD_A, false, false, true) new WishEffect(true)
); );
sagaAbility.addHint(OpenSideboardHint.instance); sagaAbility.addHint(OpenSideboardHint.instance);
this.addAbility(sagaAbility); this.addAbility(sagaAbility);

View file

@ -58,8 +58,8 @@ public final class VivienArkbowRanger extends CardImpl {
ability.addTarget(new TargetCreatureOrPlaneswalker()); ability.addTarget(new TargetCreatureOrPlaneswalker());
this.addAbility(ability); this.addAbility(ability);
// 5: You may choose a creature card you own from outside the game, reveal it, and put it into your hand. // 5: You may reveal a creature card you own from outside the game and put it into your hand.
this.addAbility(new LoyaltyAbility(new WishEffect(StaticFilters.FILTER_CARD_CREATURE_A), -5) this.addAbility(new LoyaltyAbility(new WishEffect(StaticFilters.FILTER_CARD_CREATURE), -5)
.addHint(OpenSideboardHint.instance)); .addHint(OpenSideboardHint.instance));
} }

View file

@ -9,9 +9,11 @@ import mage.cards.CardsImpl;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.util.CardUtil;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -24,35 +26,41 @@ public class WishEffect extends OneShotEffect {
private final FilterCard filter; private final FilterCard filter;
private final boolean reveal; private final boolean reveal;
private final boolean alsoFromExile; private final boolean alsoFromExile;
private final String choiceText;
private final boolean topOfLibrary; private final boolean topOfLibrary;
private final String choiceText;
public WishEffect() {
this(false);
}
public WishEffect(boolean topOfLibrary) {
super(Outcome.DrawCard);
this.filter = StaticFilters.FILTER_CARD;
this.reveal = false;
this.alsoFromExile = false;
this.topOfLibrary = topOfLibrary;
choiceText = "Put a card you own from outside the game " +
(topOfLibrary ? "on top of your library?" : "into your hand?");
staticText = "You may " + Character.toLowerCase(choiceText.charAt(0)) + choiceText.substring(1, choiceText.length() - 1);
}
public WishEffect(FilterCard filter) { public WishEffect(FilterCard filter) {
this(filter, true); this(filter, false);
} }
public WishEffect(FilterCard filter, boolean reveal) { public WishEffect(FilterCard filter, boolean alsoFromExile) {
this(filter, reveal, false); this(filter, alsoFromExile, false);
} }
public WishEffect(FilterCard filter, boolean reveal, boolean alsoFromExile) { public WishEffect(FilterCard filter, boolean alsoFromExile, boolean topOfLibrary) {
this(filter, reveal, alsoFromExile, false);
}
public WishEffect(FilterCard filter, boolean reveal, boolean alsoFromExile, boolean topOfLibrary) {
super(Outcome.DrawCard); super(Outcome.DrawCard);
this.filter = filter; this.filter = filter;
this.reveal = true;
this.alsoFromExile = alsoFromExile; this.alsoFromExile = alsoFromExile;
this.reveal = reveal;
this.topOfLibrary = topOfLibrary; this.topOfLibrary = topOfLibrary;
if (!reveal) { choiceText = "Reveal " + CardUtil.addArticle(filter.getMessage()) + " you own from outside the game "
choiceText = "Put a card you own from outside the game " + (alsoFromExile ? "or choose " + makeExileText(filter) + " you own in exile. Put that card" : "and put it")
+ (topOfLibrary ? "on top of your library." : "into your hand."); + (topOfLibrary ? " on top of your library?" : " into your hand?");
} else {
choiceText = (topOfLibrary ? "Put " : "Reveal ") + filter.getMessage() + " you own from outside the game"
+ (alsoFromExile ? " or choose " + makeExileText(filter)
+ " you own in exile. Put that card into your hand." : " and put it into your hand.");
}
staticText = "You may " + Character.toLowerCase(choiceText.charAt(0)) + choiceText.substring(1, choiceText.length() - 1); staticText = "You may " + Character.toLowerCase(choiceText.charAt(0)) + choiceText.substring(1, choiceText.length() - 1);
} }
@ -69,10 +77,10 @@ public class WishEffect extends OneShotEffect {
public WishEffect(final WishEffect effect) { public WishEffect(final WishEffect effect) {
super(effect); super(effect);
this.filter = effect.filter; this.filter = effect.filter;
this.alsoFromExile = effect.alsoFromExile;
this.reveal = effect.reveal; this.reveal = effect.reveal;
this.choiceText = effect.choiceText; this.alsoFromExile = effect.alsoFromExile;
this.topOfLibrary = effect.topOfLibrary; this.topOfLibrary = effect.topOfLibrary;
this.choiceText = effect.choiceText;
} }
@Override @Override