From fe0557127b8a91485bd2e719a44c81436dc0e122 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 28 Feb 2020 16:52:54 -0600 Subject: [PATCH] - Fixed #6321 and #6320 --- .../src/mage/cards/a/ArgothianPixies.java | 36 ++++++++++--------- .../src/mage/cards/c/CreamOfTheCrop.java | 23 ++++++++---- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ArgothianPixies.java b/Mage.Sets/src/mage/cards/a/ArgothianPixies.java index 9cf92a53d5..961162bc6b 100644 --- a/Mage.Sets/src/mage/cards/a/ArgothianPixies.java +++ b/Mage.Sets/src/mage/cards/a/ArgothianPixies.java @@ -1,4 +1,3 @@ - package mage.cards.a; import java.util.UUID; @@ -6,7 +5,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleEvasionAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.common.PreventAllDamageToSourceEffect; +import mage.abilities.effects.PreventionEffectImpl; import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -37,9 +36,13 @@ public final class ArgothianPixies extends CardImpl { this.toughness = new MageInt(1); // Argothian Pixies can't be blocked by artifact creatures. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventDamageToSourceByCardTypeEffect2(CardType.ARTIFACT))); + this.addAbility(new SimpleEvasionAbility( + new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + // Prevent all damage that would be dealt to Argothian Pixies by artifact creatures. - this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new ArgothianPixiesPreventDamageFromArtifactsEffect(Duration.WhileOnBattlefield))); + } public ArgothianPixies(final ArgothianPixies card) { @@ -52,26 +55,27 @@ public final class ArgothianPixies extends CardImpl { } } -class PreventDamageToSourceByCardTypeEffect2 extends PreventAllDamageToSourceEffect { +class ArgothianPixiesPreventDamageFromArtifactsEffect extends PreventionEffectImpl { - private CardType cardType; - - public PreventDamageToSourceByCardTypeEffect2() { - this(null); + public ArgothianPixiesPreventDamageFromArtifactsEffect(Duration duration) { + super(duration); + staticText = "Prevent all combat damage that would be dealt to {this} by artifact creatures"; } - public PreventDamageToSourceByCardTypeEffect2(CardType cardT) { - super(Duration.WhileOnBattlefield); - cardType = cardT; + public ArgothianPixiesPreventDamageFromArtifactsEffect(final ArgothianPixiesPreventDamageFromArtifactsEffect effect) { + super(effect); + } + + @Override + public ArgothianPixiesPreventDamageFromArtifactsEffect copy() { + return new ArgothianPixiesPreventDamageFromArtifactsEffect(this); } @Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { - if (game.getObject(event.getSourceId()).getCardType().contains(cardType)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } + if (game.getObject(event.getSourceId()).getCardType().contains(CardType.ARTIFACT)) { + return (event.getTargetId().equals(source.getSourceId())); } } return false; diff --git a/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java b/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java index 8a86dc44b6..dbf1c4d519 100644 --- a/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java +++ b/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java @@ -1,4 +1,3 @@ - package mage.cards.c; import java.util.UUID; @@ -16,7 +15,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetCard; -import mage.target.common.TargetCardInHand; import mage.target.targetpointer.FixedTarget; /** @@ -28,11 +26,18 @@ public final class CreamOfTheCrop extends CardImpl { public CreamOfTheCrop(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); - // Whenever a creature enters the battlefield under your control, you may look at the top X cards of your library, where X is that creature's power. If you do, put one of those cards on top of your library and the rest on the bottom of your library in any order. + // Whenever a creature enters the battlefield under your control, + // you may look at the top X cards of your library, where X is that + // creature's power. If you do, put one of those cards on top of your + // library and the rest on the bottom of your library in any order. this.addAbility(new EntersBattlefieldControlledTriggeredAbility( Zone.BATTLEFIELD, new CreamOfTheCropEffect(), StaticFilters.FILTER_PERMANENT_CREATURE, true, SetTargetPointer.PERMANENT, - "Whenever a creature enters the battlefield under your control, you may look at the top X cards of your library, where X is that creature's power. If you do, put one of those cards on top of your library and the rest on the bottom of your library in any order")); + "Whenever a creature enters the battlefield under your control, " + + "you may look at the top X cards of your library, where X " + + "is that creature's power. If you do, put one of those cards " + + "on top of your library and the rest on the bottom of " + + "your library in any order")); } public CreamOfTheCrop(final CreamOfTheCrop card) { @@ -49,7 +54,10 @@ class CreamOfTheCropEffect extends OneShotEffect { CreamOfTheCropEffect() { super(Outcome.Benefit); - this.staticText = "look at the top X cards of your library, where X is that creature's power. If you do, put one of those cards on top of your library and the rest on the bottom of your library in any order"; + this.staticText = "look at the top X cards of your library, " + + "where X is that creature's power. If you do, put " + + "one of those cards on top of your library and the " + + "rest on the bottom of your library in any order"; } CreamOfTheCropEffect(final CreamOfTheCropEffect effect) { @@ -68,8 +76,9 @@ class CreamOfTheCropEffect extends OneShotEffect { if (controller != null && permanent != null) { Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, permanent.getPower().getValue())); if (!cards.isEmpty()) { - TargetCard target = new TargetCardInHand(new FilterCard("card to put on top of your library")); - controller.choose(Outcome.Benefit, cards, target, game); + TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on top of your library")); + target.setNotTarget(true); + controller.chooseTarget(Outcome.Benefit, cards, target, source, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card);