updated a few cards which replace draws and which draw and reveal

This commit is contained in:
Evan Kranzler 2020-08-27 12:48:21 -04:00
parent f4da18df89
commit 57dba8c02a
6 changed files with 114 additions and 103 deletions

View file

@ -1,15 +1,12 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -19,7 +16,6 @@ import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class BreathstealersCrypt extends CardImpl { 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}"); 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. // 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) { public BreathstealersCrypt(final BreathstealersCrypt card) {
@ -44,12 +39,13 @@ public final class BreathstealersCrypt extends CardImpl {
class BreathstealersCryptEffect extends ReplacementEffectImpl { class BreathstealersCryptEffect extends ReplacementEffectImpl {
public BreathstealersCryptEffect() { BreathstealersCryptEffect() {
super(Duration.WhileOnBattlefield, Outcome.LoseLife); 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); super(effect);
} }
@ -66,29 +62,28 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId()); Player player = game.getPlayer(event.getPlayerId());
if (player != null) { if (player == null) {
Cards oldHand = player.getHand().copy(); return false;
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);
}
}
}
} }
Card cardDrawn = player.getLibrary().getFromTop(game);
// Gatherer ruling (2007-02-01)
// If the draw is replaced by another effect, none of the rest of Faadiyah Seers 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 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 @Override

View file

@ -1,7 +1,7 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility; import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
@ -21,7 +21,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author anonymous * @author anonymous
*/ */
public final class EnduringRenewal extends CardImpl { public final class EnduringRenewal extends CardImpl {
@ -29,7 +28,7 @@ public final class EnduringRenewal extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("a creature"); private static final FilterPermanent filter = new FilterCreaturePermanent("a creature");
public EnduringRenewal(UUID ownerId, CardSetInfo setInfo) { 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. // Play with your hand revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithHandRevealedEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithHandRevealedEffect()));
@ -86,8 +85,11 @@ class EnduringRenewalReplacementEffect extends ReplacementEffectImpl {
controller.revealCards("Top card of " + controller.getName() + "'s library", cards, game); controller.revealCards("Top card of " + controller.getName() + "'s library", cards, game);
if (card.isCreature()) { if (card.isCreature()) {
controller.moveCards(card, Zone.GRAVEYARD, source, game); 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; return false;
} }

View file

@ -2,6 +2,7 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -21,13 +22,12 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class FaadiyahSeer extends CardImpl { public final class FaadiyahSeer extends CardImpl {
public FaadiyahSeer(UUID ownerId, CardSetInfo setInfo) { 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.HUMAN);
this.subtype.add(SubType.SHAMAN); this.subtype.add(SubType.SHAMAN);
@ -69,15 +69,20 @@ class FaadiyahSeerEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller == null) {
return false;
}
Card card = controller.getLibrary().getFromTop(game); Card card = controller.getLibrary().getFromTop(game);
controller.drawCards(1, source.getSourceId(), game); // Gatherer ruling (2007-02-01)
controller.revealCards("Fa'adiyah Seer", new CardsImpl(card), game); // If the draw is replaced by another effect, none of the rest of Faadiyah Seers ability applies,
if (!filter.match(card, game)) { // 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.isLand()) {
controller.discard(card, source, game); controller.discard(card, source, game);
} }
return true; return true;
} }
return false;
}
} }

View file

@ -113,14 +113,18 @@ class JaceMirrorMageDrawEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
// TODO: Make this and similar effects work with draw replacement correctly Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getControllerId()); if (controller == null) {
if (player == null) {
return false; return false;
} }
Card card = player.getLibrary().getFromTop(game); Card card = controller.getLibrary().getFromTop(game);
player.drawCards(1, source.getSourceId(), game); // Gatherer ruling (2007-02-01)
player.revealCards(source, new CardsImpl(card), game); // If the draw is replaced by another effect, none of the rest of Faadiyah Seers 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) { if (card == null || card.getConvertedManaCost() == 0) {
return true; return true;
} }

View file

@ -1,7 +1,7 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -21,20 +21,18 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author MarcoMarin * @author MarcoMarin
*/ */
public final class Sindbad extends CardImpl { public final class Sindbad extends CardImpl {
public Sindbad(UUID ownerId, CardSetInfo setInfo) { 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.subtype.add(SubType.HUMAN);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {tap}: Draw a card and reveal it. If it isn't a land card, discard it. // {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())); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SindbadEffect(), new TapSourceCost()));
} }
public Sindbad(final Sindbad card) { public Sindbad(final Sindbad card) {
@ -46,16 +44,15 @@ public final class Sindbad extends CardImpl {
return new Sindbad(this); return new Sindbad(this);
} }
} }
class SindbadEffect extends OneShotEffect { class SindbadEffect extends OneShotEffect {
private static final FilterCard filter = new FilterLandCard(); SindbadEffect() {
public SindbadEffect() {
super(Outcome.DrawCard); super(Outcome.DrawCard);
this.staticText = "Draw a card and reveal it. If it isn't a land card, discard it"; 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); super(effect);
} }
@ -67,15 +64,20 @@ class SindbadEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller == null) {
return false;
}
Card card = controller.getLibrary().getFromTop(game); Card card = controller.getLibrary().getFromTop(game);
controller.drawCards(1, source.getSourceId(), game); // Gatherer ruling (2007-02-01)
controller.revealCards("Sindbad", new CardsImpl(card), game); // If the draw is replaced by another effect, none of the rest of Faadiyah Seers ability applies,
if (!filter.match(card, game)) { // 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.isLand()) {
controller.discard(card, source, game); controller.discard(card, source, game);
} }
return true; return true;
} }
return false;
}
} }

View file

@ -1,7 +1,7 @@
package mage.cards.z; package mage.cards.z;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -22,7 +22,6 @@ import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class ZursWeirding extends CardImpl { public final class ZursWeirding extends CardImpl {
@ -49,12 +48,12 @@ public final class ZursWeirding extends CardImpl {
class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
public ZursWeirdingReplacementEffect() { ZursWeirdingReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral); 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."; 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); super(effect);
} }
@ -83,10 +82,14 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
boolean paid = false; boolean paid = false;
Player player = game.getPlayer(event.getTargetId()); Player player = game.getPlayer(event.getTargetId());
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
if (player != null if (player == null
&& sourceObject != null) { || sourceObject == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game); Card card = player.getLibrary().getFromTop(game);
if (card != null) { if (card == null) {
return false;
}
// Reveals it instead // Reveals it instead
player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game);
@ -112,8 +115,8 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
} }
} }
} }
} // This is still replacing the draw, so we still return true
} player.drawCards(1, source.getSourceId(), game, event.getAppliedEffects());
return false; return true;
} }
} }