diff --git a/Mage.Sets/src/mage/cards/a/AetherGust.java b/Mage.Sets/src/mage/cards/a/AetherGust.java new file mode 100644 index 0000000000..65154445b4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AetherGust.java @@ -0,0 +1,85 @@ +package mage.cards.a; + +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.common.FilterSpellOrPermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetSpellOrPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AetherGust extends CardImpl { + + private static final FilterSpellOrPermanent filter + = new FilterSpellOrPermanent("spell or permanent that's red or green"); + private static final Predicate predicate = Predicates.or( + new ColorPredicate(ObjectColor.RED), + new ColorPredicate(ObjectColor.GREEN) + ); + + static { + filter.getPermanentFilter().add(predicate); + filter.getSpellFilter().add(predicate); + } + + public AetherGust(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); + + // Choose target spell or permanent that's red or green. Its owner puts it on the top or bottom of their library. + this.getSpellAbility().addEffect(new AetherGustEffect()); + this.getSpellAbility().addTarget(new TargetSpellOrPermanent(1, 1, filter, false)); + } + + private AetherGust(final AetherGust card) { + super(card); + } + + @Override + public AetherGust copy() { + return new AetherGust(this); + } +} + +class AetherGustEffect extends OneShotEffect { + + AetherGustEffect() { + super(Outcome.Benefit); + staticText = "Choose target spell or permanent that's red or green. " + + "Its owner puts it on the top or bottom of their library."; + } + + private AetherGustEffect(final AetherGustEffect effect) { + super(effect); + } + + @Override + public AetherGustEffect copy() { + return new AetherGustEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(game.getOwnerId(source.getFirstTarget())); + if (player == null) { + return false; + } + if (player.chooseUse(outcome, "Put the targeted object on the top or bottom of your library?", + "", "Top", "Bottom", source, game)) { + return new PutOnLibraryTargetEffect(true).apply(game, source); + } + return new PutOnLibraryTargetEffect(false).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 46b9c229ac..eb5fd36016 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -43,6 +43,7 @@ public final class CoreSet2020 extends ExpansionSet { this.ratioBoosterSpecialLandNumerator = 5; cards.add(new SetCardInfo("Aerial Assault", 1, Rarity.COMMON, mage.cards.a.AerialAssault.class)); + cards.add(new SetCardInfo("Aether Gust", 42, Rarity.UNCOMMON, mage.cards.a.AetherGust.class)); cards.add(new SetCardInfo("Agent of Treachery", 43, Rarity.RARE, mage.cards.a.AgentOfTreachery.class)); cards.add(new SetCardInfo("Ajani, Inspiring Leader", 282, Rarity.MYTHIC, mage.cards.a.AjaniInspiringLeader.class)); cards.add(new SetCardInfo("Ajani, Strength of the Pride", 2, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java index f0cd06bc60..ff8475399f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java @@ -1,10 +1,6 @@ package mage.abilities.effects.common; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; @@ -12,13 +8,17 @@ import mage.cards.Card; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.Outcome; -import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; import mage.util.CardUtil; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + /** * @author BetaSteward_at_googlemail.com */ @@ -62,8 +62,9 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { } break; case GRAVEYARD: + case STACK: Card card = game.getCard(targetId); - if (card != null && game.getState().getZone(targetId) == Zone.GRAVEYARD) { + if (card != null) { cards.add(card); } break; @@ -76,7 +77,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { if (card != null) { Player owner = game.getPlayer(card.getOwnerId()); Cards cardsPlayer = new CardsImpl(); - for (Iterator iterator = cards.iterator(); iterator.hasNext();) { + for (Iterator iterator = cards.iterator(); iterator.hasNext(); ) { Card next = iterator.next(); if (next.isOwnedBy(owner.getId())) { cardsPlayer.add(next); @@ -95,7 +96,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { if (permanent != null) { Player owner = game.getPlayer(permanent.getOwnerId()); Cards cardsPlayer = new CardsImpl(); - for (Iterator iterator = permanents.iterator(); iterator.hasNext();) { + for (Iterator iterator = permanents.iterator(); iterator.hasNext(); ) { Permanent next = iterator.next(); if (next.isOwnedBy(owner.getId())) { cardsPlayer.add(next);