From 57dba8c02ac2e821cc5a123b436457be2b11df6d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 27 Aug 2020 12:48:21 -0400 Subject: [PATCH] updated a few cards which replace draws and which draw and reveal --- .../src/mage/cards/b/BreathstealersCrypt.java | 59 ++++++++--------- .../src/mage/cards/e/EnduringRenewal.java | 16 +++-- Mage.Sets/src/mage/cards/f/FaadiyahSeer.java | 25 ++++--- .../src/mage/cards/j/JaceMirrorMage.java | 16 +++-- Mage.Sets/src/mage/cards/s/Sindbad.java | 36 +++++----- Mage.Sets/src/mage/cards/z/ZursWeirding.java | 65 ++++++++++--------- 6 files changed, 114 insertions(+), 103 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java b/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java index 1141259d6b..d5dab3a4b8 100644 --- a/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java +++ b/Mage.Sets/src/mage/cards/b/BreathstealersCrypt.java @@ -1,15 +1,12 @@ - package mage.cards.b; import java.util.UUID; + import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.ReplacementEffectImpl; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.Cards; +import mage.cards.*; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; @@ -19,7 +16,6 @@ import mage.game.events.GameEvent; import mage.players.Player; /** - * * @author jeffwadsworth */ public final class BreathstealersCrypt extends CardImpl { @@ -28,8 +24,7 @@ public final class BreathstealersCrypt extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{B}"); // If a player would draw a card, instead they draw a card and reveals it. If it's a creature card, that player discards it unless they pay 3 life. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BreathstealersCryptEffect())); - + this.addAbility(new SimpleStaticAbility(new BreathstealersCryptEffect())); } public BreathstealersCrypt(final BreathstealersCrypt card) { @@ -44,12 +39,13 @@ public final class BreathstealersCrypt extends CardImpl { class BreathstealersCryptEffect extends ReplacementEffectImpl { - public BreathstealersCryptEffect() { + BreathstealersCryptEffect() { super(Duration.WhileOnBattlefield, Outcome.LoseLife); - staticText = "If a player would draw a card, instead they draw a card and reveal it. If it's a creature card, that player discards it unless they pay 3 life"; + staticText = "If a player would draw a card, instead they draw a card and reveal it. " + + "If it's a creature card, that player discards it unless they pay 3 life"; } - public BreathstealersCryptEffect(final BreathstealersCryptEffect effect) { + private BreathstealersCryptEffect(final BreathstealersCryptEffect effect) { super(effect); } @@ -66,29 +62,28 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); - if (player != null) { - Cards oldHand = player.getHand().copy(); - if (player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()) > 0) { - Cards drawnCards = player.getHand().copy(); - drawnCards.removeAll(oldHand); - player.revealCards(source, "The card drawn from " + player.getName() + "'s library.", drawnCards, game); - for (Card cardDrawn : drawnCards.getCards(game)) { - if (cardDrawn.isCreature()) { - game.informPlayers("The card drawn by " + player.getName() + " is a creature card. He/she must pay 3 life or that card gets discarded."); - PayLifeCost cost = new PayLifeCost(3); - if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Do you wish to pay 3 life to keep the card " + cardDrawn.getIdName() + "? If not, you discard it.", source, game)) { - cost.pay(source, game, source.getSourceId(), player.getId(), true, cost); - } else { - game.informPlayers("The cost of 3 life was not paid by " + player.getName() + ", so " + cardDrawn.getIdName() + " will be discarded."); - player.discard(cardDrawn, source, game); - } - } - } - } + if (player == null) { + return false; + } + Card cardDrawn = player.getLibrary().getFromTop(game); + // Gatherer ruling (2007-02-01) + // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, + // even if the draw is replaced by another draw (such as with Enduring Renewal). + if (cardDrawn == null || player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()) != 1) { return true; } - return false; + player.revealCards(source, new CardsImpl(cardDrawn), game); + if (!cardDrawn.isCreature()) { + return true; + } + game.informPlayers("The card drawn by " + player.getName() + " is a creature card. They discard that card unless they pay 3 life."); + PayLifeCost cost = new PayLifeCost(3); + if (!cost.canPay(source, source.getSourceId(), player.getId(), game) + || !player.chooseUse(outcome, "Pay 3 life or discard " + cardDrawn.getIdName() + "?", null, "Pay 3 life", "Discard", source, game) + || !cost.pay(source, game, source.getSourceId(), player.getId(), true, cost)) { + player.discard(cardDrawn, source, game); + } + return true; } @Override diff --git a/Mage.Sets/src/mage/cards/e/EnduringRenewal.java b/Mage.Sets/src/mage/cards/e/EnduringRenewal.java index 510d9cb83b..3782aca73d 100644 --- a/Mage.Sets/src/mage/cards/e/EnduringRenewal.java +++ b/Mage.Sets/src/mage/cards/e/EnduringRenewal.java @@ -1,7 +1,7 @@ - package mage.cards.e; import java.util.UUID; + import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility; @@ -21,22 +21,21 @@ import mage.game.permanent.Permanent; import mage.players.Player; /** - * * @author anonymous */ public final class EnduringRenewal extends CardImpl { - + private static final FilterPermanent filter = new FilterCreaturePermanent("a creature"); public EnduringRenewal(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}"); // Play with your hand revealed. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithHandRevealedEffect())); - + // If you would draw a card, reveal the top card of your library instead. If it's a creature card, put it into your graveyard. Otherwise, draw a card. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EnduringRenewalReplacementEffect())); - + // Whenever a creature is put into your graveyard from the battlefield, return it to your hand. Effect effect = new ReturnFromGraveyardToHandTargetEffect(); effect.setText("return it to your hand"); @@ -86,8 +85,11 @@ class EnduringRenewalReplacementEffect extends ReplacementEffectImpl { controller.revealCards("Top card of " + controller.getName() + "'s library", cards, game); if (card.isCreature()) { controller.moveCards(card, Zone.GRAVEYARD, source, game); - return true; + } else { + // This is still replacing the draw, so we still return true + controller.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java b/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java index d85c5ef6a5..5ff4423135 100644 --- a/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java +++ b/Mage.Sets/src/mage/cards/f/FaadiyahSeer.java @@ -2,6 +2,7 @@ package mage.cards.f; import java.util.UUID; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -21,13 +22,12 @@ import mage.game.Game; import mage.players.Player; /** - * * @author LevelX2 */ public final class FaadiyahSeer extends CardImpl { public FaadiyahSeer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SHAMAN); @@ -69,15 +69,20 @@ class FaadiyahSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Card card = controller.getLibrary().getFromTop(game); - controller.drawCards(1, source.getSourceId(), game); - controller.revealCards("Fa'adiyah Seer", new CardsImpl(card), game); - if (!filter.match(card, game)) { - controller.discard(card, source, game); - } + if (controller == null) { + return false; + } + Card card = controller.getLibrary().getFromTop(game); + // Gatherer ruling (2007-02-01) + // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, + // even if the draw is replaced by another draw (such as with Enduring Renewal). + if (controller.drawCards(1, source.getSourceId(), game) != 1) { return true; } - return false; + controller.revealCards(source, new CardsImpl(card), game); + if (!card.isLand()) { + controller.discard(card, source, game); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java b/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java index 4e663ea29b..39f3ce3ea5 100644 --- a/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java +++ b/Mage.Sets/src/mage/cards/j/JaceMirrorMage.java @@ -113,14 +113,18 @@ class JaceMirrorMageDrawEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - // TODO: Make this and similar effects work with draw replacement correctly - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { return false; } - Card card = player.getLibrary().getFromTop(game); - player.drawCards(1, source.getSourceId(), game); - player.revealCards(source, new CardsImpl(card), game); + Card card = controller.getLibrary().getFromTop(game); + // Gatherer ruling (2007-02-01) + // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, + // even if the draw is replaced by another draw (such as with Enduring Renewal). + if (controller.drawCards(1, source.getSourceId(), game) != 1) { + return true; + } + controller.revealCards(source, new CardsImpl(card), game); if (card == null || card.getConvertedManaCost() == 0) { return true; } diff --git a/Mage.Sets/src/mage/cards/s/Sindbad.java b/Mage.Sets/src/mage/cards/s/Sindbad.java index acdee2cf53..16be022934 100644 --- a/Mage.Sets/src/mage/cards/s/Sindbad.java +++ b/Mage.Sets/src/mage/cards/s/Sindbad.java @@ -1,7 +1,7 @@ - package mage.cards.s; import java.util.UUID; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -21,20 +21,18 @@ import mage.game.Game; import mage.players.Player; /** - * * @author MarcoMarin */ public final class Sindbad extends CardImpl { public Sindbad(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.HUMAN); this.power = new MageInt(1); this.toughness = new MageInt(1); // {tap}: Draw a card and reveal it. If it isn't a land card, discard it. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SindbadEffect(), new TapSourceCost())); - } public Sindbad(final Sindbad card) { @@ -46,16 +44,15 @@ public final class Sindbad extends CardImpl { return new Sindbad(this); } } + class SindbadEffect extends OneShotEffect { - private static final FilterCard filter = new FilterLandCard(); - - public SindbadEffect() { + SindbadEffect() { super(Outcome.DrawCard); this.staticText = "Draw a card and reveal it. If it isn't a land card, discard it"; } - public SindbadEffect(final SindbadEffect effect) { + private SindbadEffect(final SindbadEffect effect) { super(effect); } @@ -67,15 +64,20 @@ class SindbadEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Card card = controller.getLibrary().getFromTop(game); - controller.drawCards(1, source.getSourceId(), game); - controller.revealCards("Sindbad", new CardsImpl(card), game); - if (!filter.match(card, game)) { - controller.discard(card, source, game); - } + if (controller == null) { + return false; + } + Card card = controller.getLibrary().getFromTop(game); + // Gatherer ruling (2007-02-01) + // If the draw is replaced by another effect, none of the rest of Fa’adiyah Seer’s ability applies, + // even if the draw is replaced by another draw (such as with Enduring Renewal). + if (controller.drawCards(1, source.getSourceId(), game) != 1) { return true; } - return false; + controller.revealCards(source, new CardsImpl(card), game); + if (!card.isLand()) { + controller.discard(card, source, game); + } + return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/z/ZursWeirding.java b/Mage.Sets/src/mage/cards/z/ZursWeirding.java index ea6fe4bbd8..0f2a3035b4 100644 --- a/Mage.Sets/src/mage/cards/z/ZursWeirding.java +++ b/Mage.Sets/src/mage/cards/z/ZursWeirding.java @@ -1,7 +1,7 @@ - package mage.cards.z; import java.util.UUID; + import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -22,7 +22,6 @@ import mage.game.events.GameEvent; import mage.players.Player; /** - * * @author Quercitron */ public final class ZursWeirding extends CardImpl { @@ -49,12 +48,12 @@ public final class ZursWeirding extends CardImpl { class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { - public ZursWeirdingReplacementEffect() { + ZursWeirdingReplacementEffect() { super(Duration.WhileOnBattlefield, Outcome.Neutral); this.staticText = "If a player would draw a card, they reveal it instead. Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard. Otherwise, that player draws a card."; } - public ZursWeirdingReplacementEffect(final ZursWeirdingReplacementEffect effect) { + private ZursWeirdingReplacementEffect(final ZursWeirdingReplacementEffect effect) { super(effect); } @@ -83,37 +82,41 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { boolean paid = false; Player player = game.getPlayer(event.getTargetId()); MageObject sourceObject = source.getSourceObject(game); - if (player != null - && sourceObject != null) { - Card card = player.getLibrary().getFromTop(game); - if (card != null) { - // Reveals it instead - player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); + if (player == null + || sourceObject == null) { + return false; + } + Card card = player.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + // Reveals it instead + player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); - // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard - String message = "Pay 2 life to put " + card.getLogName() + " into " + player.getLogName() + " graveyard?"; + // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard + String message = "Pay 2 life to put " + card.getLogName() + " into " + player.getLogName() + " graveyard?"; - for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { - if (playerId.equals(player.getId())) { - continue; - } - Player otherPlayer = game.getPlayer(playerId); - if (otherPlayer.canPayLifeCost(source) - && otherPlayer.getLife() >= 2) { - PayLifeCost lifeCost = new PayLifeCost(2); - while (otherPlayer.canRespond() - && !paid - && otherPlayer.chooseUse(Outcome.Benefit, message, source, game)) { - paid = lifeCost.pay(source, game, source.getSourceId(), otherPlayer.getId(), false, null); - } - if (paid) { - player.moveCards(card, Zone.GRAVEYARD, source, game); - return true; - } - } + for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { + if (playerId.equals(player.getId())) { + continue; + } + Player otherPlayer = game.getPlayer(playerId); + if (otherPlayer.canPayLifeCost(source) + && otherPlayer.getLife() >= 2) { + PayLifeCost lifeCost = new PayLifeCost(2); + while (otherPlayer.canRespond() + && !paid + && otherPlayer.chooseUse(Outcome.Benefit, message, source, game)) { + paid = lifeCost.pay(source, game, source.getSourceId(), otherPlayer.getId(), false, null); + } + if (paid) { + player.moveCards(card, Zone.GRAVEYARD, source, game); + return true; } } } - return false; + // This is still replacing the draw, so we still return true + player.drawCards(1, source.getSourceId(), game, event.getAppliedEffects()); + return true; } }