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;
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 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 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

View file

@ -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,7 +21,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author anonymous
*/
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");
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()));
@ -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;
}

View file

@ -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) {
if (controller == null) {
return false;
}
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)) {
// 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 (controller.drawCards(1, source.getSourceId(), game) != 1) {
return true;
}
controller.revealCards(source, new CardsImpl(card), game);
if (!card.isLand()) {
controller.discard(card, source, game);
}
return true;
}
return false;
}
}

View file

@ -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 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) {
return true;
}

View file

@ -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) {
if (controller == null) {
return false;
}
Card card = controller.getLibrary().getFromTop(game);
controller.drawCards(1, source.getSourceId(), game);
controller.revealCards("Sindbad", new CardsImpl(card), game);
if (!filter.match(card, 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 (controller.drawCards(1, source.getSourceId(), game) != 1) {
return true;
}
controller.revealCards(source, new CardsImpl(card), game);
if (!card.isLand()) {
controller.discard(card, source, game);
}
return true;
}
return false;
}
}

View file

@ -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,10 +82,14 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
boolean paid = false;
Player player = game.getPlayer(event.getTargetId());
MageObject sourceObject = source.getSourceObject(game);
if (player != null
&& sourceObject != null) {
if (player == null
|| sourceObject == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card != null) {
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);
@ -112,8 +115,8 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
}
}
}
}
}
return false;
// This is still replacing the draw, so we still return true
player.drawCards(1, source.getSourceId(), game, event.getAppliedEffects());
return true;
}
}