Implemented Aether Gust

This commit is contained in:
Evan Kranzler 2019-06-22 20:36:02 -04:00
parent 05ae5d7864
commit 5c36acd190
3 changed files with 95 additions and 8 deletions

View file

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

View file

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

View file

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