From 31d24055c5bcc8c845466086877f5837d0fd35f5 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 7 Jan 2026 10:16:30 -0500 Subject: [PATCH] [ECL] Implement Swat Away --- Mage.Sets/src/mage/cards/s/SwatAway.java | 53 +++++++++++++++++++++ Mage.Sets/src/mage/sets/LorwynEclipsed.java | 1 + 2 files changed, 54 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SwatAway.java diff --git a/Mage.Sets/src/mage/cards/s/SwatAway.java b/Mage.Sets/src/mage/cards/s/SwatAway.java new file mode 100644 index 00000000000..e7f42facf75 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SwatAway.java @@ -0,0 +1,53 @@ +package mage.cards.s; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.effects.common.PutOnTopOrBottomLibraryTargetEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureAttackingYou; +import mage.filter.common.FilterSpellOrPermanent; +import mage.target.common.TargetSpellOrPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SwatAway extends CardImpl { + + private static final Condition condition = new PermanentsOnTheBattlefieldCondition( + new FilterCreatureAttackingYou("a creature is attacking you") + ); + private static final FilterSpellOrPermanent filter = new FilterSpellOrPermanent("spell or creature"); + + static { + filter.getPermanentFilter().add(CardType.CREATURE.getPredicate()); + } + + public SwatAway(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); + + // This spell costs {2} less to cast if a creature is attacking you. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(2, condition).setCanWorksOnStackOnly(true) + ).setRuleAtTheTop(true)); + + // The owner of target spell or creature puts it on their choice of the top or bottom of their library. + this.getSpellAbility().addEffect(new PutOnTopOrBottomLibraryTargetEffect(true)); + this.getSpellAbility().addTarget(new TargetSpellOrPermanent(filter)); + } + + private SwatAway(final SwatAway card) { + super(card); + } + + @Override + public SwatAway copy() { + return new SwatAway(this); + } +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsed.java b/Mage.Sets/src/mage/sets/LorwynEclipsed.java index 1ceee757207..e2500dd0622 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsed.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsed.java @@ -149,6 +149,7 @@ public final class LorwynEclipsed extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 271, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 276, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 281, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Swat Away", 75, Rarity.UNCOMMON, mage.cards.s.SwatAway.class)); cards.add(new SetCardInfo("Sygg, Wanderwine Wisdom", 288, Rarity.RARE, mage.cards.s.SyggWanderwineWisdom.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sygg, Wanderwine Wisdom", 76, Rarity.RARE, mage.cards.s.SyggWanderwineWisdom.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Temple Garden", "351b", Rarity.RARE, mage.cards.t.TempleGarden.class, NON_FULL_USE_VARIOUS));