From ba485d9ea3eb55a33a527a56912b98a6f78cfe5d Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 2 Apr 2024 15:47:19 -0400 Subject: [PATCH] [OTJ] Implement Stop Cold --- Mage.Sets/src/mage/cards/s/StopCold.java | 84 +++++++++++++++++++ .../mage/sets/OutlawsOfThunderJunction.java | 1 + 2 files changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StopCold.java diff --git a/Mage.Sets/src/mage/cards/s/StopCold.java b/Mage.Sets/src/mage/cards/s/StopCold.java new file mode 100644 index 00000000000..3d77d8e0c90 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StopCold.java @@ -0,0 +1,84 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +import mage.abilities.effects.common.TapEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class StopCold extends CardImpl { + + public StopCold(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Enchant artifact or creature + TargetPermanent auraTarget = new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget)); + + // When Stop Cold enters the battlefield, tap enchanted permanent. + this.addAbility(new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect())); + + // Enchanted permanent loses all abilities and doesn't untap during its controller's untap step. + Ability ability = new SimpleStaticAbility(new StopColdEffect()); + ability.addEffect(new DontUntapInControllersUntapStepEnchantedEffect() + .setText("and doesn't untap during its controller's untap step")); + this.addAbility(ability); + } + + private StopCold(final StopCold card) { + super(card); + } + + @Override + public StopCold copy() { + return new StopCold(this); + } +} + +class StopColdEffect extends ContinuousEffectImpl { + + StopColdEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.Benefit); + staticText = "enchanted permanent loses all abilities"; + } + + private StopColdEffect(final StopColdEffect effect) { + super(effect); + } + + @Override + public StopColdEffect copy() { + return new StopColdEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Optional.ofNullable(source.getSourcePermanentIfItStillExists(game)) + .map(Permanent::getAttachedTo) + .map(game::getPermanent) + .ifPresent(permanent -> permanent.removeAllAbilities(source.getSourceId(), game)); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java index 0417da8f5d6..5d17e081bb4 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java @@ -251,6 +251,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet { cards.add(new SetCardInfo("Sterling Supplier", 33, Rarity.COMMON, mage.cards.s.SterlingSupplier.class)); cards.add(new SetCardInfo("Stingerback Terror", 147, Rarity.RARE, mage.cards.s.StingerbackTerror.class)); cards.add(new SetCardInfo("Stoic Sphinx", 71, Rarity.RARE, mage.cards.s.StoicSphinx.class)); + cards.add(new SetCardInfo("Stop Cold", 72, Rarity.COMMON, mage.cards.s.StopCold.class)); cards.add(new SetCardInfo("Stubborn Burrowfiend", 184, Rarity.UNCOMMON, mage.cards.s.StubbornBurrowfiend.class)); cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Take Up the Shield", 34, Rarity.COMMON, mage.cards.t.TakeUpTheShield.class));