This commit is contained in:
Jeff 2020-02-28 16:52:54 -06:00
parent a06cacb462
commit fe0557127b
2 changed files with 36 additions and 23 deletions

View file

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

View file

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