From 841a8dce442ed14c96c5def2010cf6f0376ebeeb Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 27 Jan 2024 10:50:10 -0500 Subject: [PATCH] [MKM] Implement Lost in the Maze --- Mage.Sets/src/mage/cards/l/LostInTheMaze.java | 103 ++++++++++++++++++ .../src/mage/sets/MurdersAtKarlovManor.java | 1 + 2 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LostInTheMaze.java diff --git a/Mage.Sets/src/mage/cards/l/LostInTheMaze.java b/Mage.Sets/src/mage/cards/l/LostInTheMaze.java new file mode 100644 index 00000000000..8f5a42d2d16 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LostInTheMaze.java @@ -0,0 +1,103 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LostInTheMaze extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("tapped creatures"); + + static { + filter.add(TappedPredicate.TAPPED); + } + + public LostInTheMaze(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{X}{U}{U}"); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // When Lost in the Maze enters the battlefield, tap X target creatures. Put a stun counter on each of those creatures you don't control. + Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect("tap X target creatures")); + ability.addEffect(new LostInTheMazeEffect()); + ability.setTargetAdjuster(LostInTheMazeAdjuster.instance); + this.addAbility(ability); + + // Tapped creatures you control have hexproof. + this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + HexproofAbility.getInstance(), Duration.WhileOnBattlefield, filter + ))); + } + + private LostInTheMaze(final LostInTheMaze card) { + super(card); + } + + @Override + public LostInTheMaze copy() { + return new LostInTheMaze(this); + } +} + +enum LostInTheMazeAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + ability.addTarget(new TargetCreaturePermanent(ManacostVariableValue.ETB.calculate(game, ability, null))); + } +} + +class LostInTheMazeEffect extends OneShotEffect { + + LostInTheMazeEffect() { + super(Outcome.Benefit); + staticText = "Put a stun counter on each of those creatures you don't control"; + } + + private LostInTheMazeEffect(final LostInTheMazeEffect effect) { + super(effect); + } + + @Override + public LostInTheMazeEffect copy() { + return new LostInTheMazeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null && !permanent.isControlledBy(source.getControllerId())) { + permanent.addCounters(CounterType.STUN.createInstance(), source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java b/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java index 8401046e972..c87a6d44097 100644 --- a/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java +++ b/Mage.Sets/src/mage/sets/MurdersAtKarlovManor.java @@ -115,6 +115,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet { cards.add(new SetCardInfo("Lightning Helix", 218, Rarity.UNCOMMON, mage.cards.l.LightningHelix.class)); cards.add(new SetCardInfo("Living Conundrum", 63, Rarity.UNCOMMON, mage.cards.l.LivingConundrum.class)); cards.add(new SetCardInfo("Long Goodbye", 92, Rarity.UNCOMMON, mage.cards.l.LongGoodbye.class)); + cards.add(new SetCardInfo("Lost in the Maze", 64, Rarity.RARE, mage.cards.l.LostInTheMaze.class)); cards.add(new SetCardInfo("Loxodon Eavesdropper", 168, Rarity.COMMON, mage.cards.l.LoxodonEavesdropper.class)); cards.add(new SetCardInfo("Lush Portico", 263, Rarity.RARE, mage.cards.l.LushPortico.class)); cards.add(new SetCardInfo("Macabre Reconstruction", 93, Rarity.COMMON, mage.cards.m.MacabreReconstruction.class));