[OTJ] Implement Stop Cold

This commit is contained in:
theelk801 2024-04-02 15:47:19 -04:00
parent 0c064b3023
commit ba485d9ea3
2 changed files with 85 additions and 0 deletions

View file

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

View file

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