From 9f83d9572ff4a0adf5012b2e53ae65c50dc80ef2 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 5 Feb 2022 12:17:32 -0600 Subject: [PATCH] [NEO] Implemented Debt to the Kami --- Mage.Sets/src/mage/cards/d/DebtToTheKami.java | 122 ++++++++++++++++++ .../src/mage/sets/KamigawaNeonDynasty.java | 1 + 2 files changed, 123 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DebtToTheKami.java diff --git a/Mage.Sets/src/mage/cards/d/DebtToTheKami.java b/Mage.Sets/src/mage/cards/d/DebtToTheKami.java new file mode 100644 index 00000000000..45782470c23 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DebtToTheKami.java @@ -0,0 +1,122 @@ +package mage.cards.d; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetOpponent; + +/** + * + * @author weirddan455 + */ +public final class DebtToTheKami extends CardImpl { + + public DebtToTheKami(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}"); + + // Choose one— + // • Target opponent exiles a creature they control. + this.getSpellAbility().addEffect(new DebtToTheKamiExileCreatureEffect()); + this.getSpellAbility().addTarget(new TargetOpponent()); + + // • Target opponent exiles an enchantment they control. + Mode mode = new Mode(new DebtToTheKamiExileEnchantmentEffect()); + mode.addTarget(new TargetOpponent()); + this.getSpellAbility().addMode(mode); + } + + private DebtToTheKami(final DebtToTheKami card) { + super(card); + } + + @Override + public DebtToTheKami copy() { + return new DebtToTheKami(this); + } +} + +class DebtToTheKamiExileCreatureEffect extends OneShotEffect { + + public DebtToTheKamiExileCreatureEffect() { + super(Outcome.Exile); + this.staticText = "Target opponent exiles a creature they control"; + } + + private DebtToTheKamiExileCreatureEffect(final DebtToTheKamiExileCreatureEffect effect) { + super(effect); + } + + @Override + public DebtToTheKamiExileCreatureEffect copy() { + return new DebtToTheKamiExileCreatureEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null) { + return false; + } + Target target = new TargetControlledCreaturePermanent(); + target.setNotTarget(true); + player.choose(outcome, target, source.getSourceId(), game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null) { + return false; + } + return player.moveCards(permanent, Zone.EXILED, source, game); + } +} + +class DebtToTheKamiExileEnchantmentEffect extends OneShotEffect { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("enchantment you control"); + + static { + filter.add(CardType.ENCHANTMENT.getPredicate()); + } + + public DebtToTheKamiExileEnchantmentEffect() { + super(Outcome.Exile); + this.staticText = "Target opponent exiles an enchantment they control"; + } + + private DebtToTheKamiExileEnchantmentEffect(final DebtToTheKamiExileEnchantmentEffect effect) { + super(effect); + } + + @Override + public DebtToTheKamiExileEnchantmentEffect copy() { + return new DebtToTheKamiExileEnchantmentEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null) { + return false; + } + Target target = new TargetControlledPermanent(filter); + target.setNotTarget(true); + player.choose(outcome, target, source.getSourceId(), game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null) { + return false; + } + return player.moveCards(permanent, Zone.EXILED, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 33610365155..c4944923520 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -67,6 +67,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Colossal Skyturtle", 216, Rarity.UNCOMMON, mage.cards.c.ColossalSkyturtle.class)); cards.add(new SetCardInfo("Commune with Spirits", 180, Rarity.COMMON, mage.cards.c.CommuneWithSpirits.class)); cards.add(new SetCardInfo("Covert Technician", 49, Rarity.UNCOMMON, mage.cards.c.CovertTechnician.class)); + cards.add(new SetCardInfo("Debt to the Kami", 92, Rarity.COMMON, mage.cards.d.DebtToTheKami.class)); cards.add(new SetCardInfo("Dismal Backwater", 267, Rarity.COMMON, mage.cards.d.DismalBackwater.class)); cards.add(new SetCardInfo("Disruption Protocol", 51, Rarity.COMMON, mage.cards.d.DisruptionProtocol.class)); cards.add(new SetCardInfo("Dockside Chef", 93, Rarity.UNCOMMON, mage.cards.d.DocksideChef.class));