diff --git a/Mage.Sets/src/mage/cards/i/InvokeDespair.java b/Mage.Sets/src/mage/cards/i/InvokeDespair.java new file mode 100644 index 0000000000..952fec4036 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InvokeDespair.java @@ -0,0 +1,102 @@ +package mage.cards.i; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledEnchantmentPermanent; +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 InvokeDespair extends CardImpl { + + public InvokeDespair(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}{B}{B}"); + + // Target opponent sacrifices a creature. If they can't, they lose 2 life and you draw a card. Then repeat this process for an enchantment and a planeswalker. + this.getSpellAbility().addEffect(new InvokeDespairEffect()); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + private InvokeDespair(final InvokeDespair card) { + super(card); + } + + @Override + public InvokeDespair copy() { + return new InvokeDespair(this); + } +} + +class InvokeDespairEffect extends OneShotEffect { + + private static final FilterControlledEnchantmentPermanent enchantmentFilter = new FilterControlledEnchantmentPermanent(); + + public InvokeDespairEffect() { + super(Outcome.Sacrifice); + this.staticText = "Target opponent sacrifices a creature. If they can't, they lose 2 life and you draw a card. Then repeat this process for an enchantment and a planeswalker"; + } + + private InvokeDespairEffect(final InvokeDespairEffect effect) { + super(effect); + } + + @Override + public InvokeDespairEffect copy() { + return new InvokeDespairEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player opponent = game.getPlayer(source.getFirstTarget()); + Player controller = game.getPlayer(source.getControllerId()); + if (opponent == null || controller == null) { + return false; + } + Target target = new TargetControlledCreaturePermanent(); + target.setNotTarget(true); + opponent.choose(outcome, target, source.getSourceId(), game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + permanent.sacrifice(source, game); + } else { + opponent.loseLife(2, game, source, false); + controller.drawCards(1, source, game); + } + target = new TargetControlledPermanent(enchantmentFilter); + target.setNotTarget(true); + opponent.choose(outcome, target, source.getSourceId(), game); + permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + permanent.sacrifice(source, game); + } else { + opponent.loseLife(2, game, source, false); + controller.drawCards(1, source, game); + } + target = new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_PLANESWALKER); + target.setNotTarget(true); + opponent.choose(outcome, target, source.getSourceId(), game); + permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + permanent.sacrifice(source, game); + } else { + opponent.loseLife(2, game, source, false); + controller.drawCards(1, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 80c48ed1b6..933bcad63b 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -126,6 +126,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Inkrise Infiltrator", 100, Rarity.COMMON, mage.cards.i.InkriseInfiltrator.class)); cards.add(new SetCardInfo("Inventive Iteration", 57, Rarity.RARE, mage.cards.i.InventiveIteration.class)); cards.add(new SetCardInfo("Invigorating Hot Spring", 223, Rarity.UNCOMMON, mage.cards.i.InvigoratingHotSpring.class)); + cards.add(new SetCardInfo("Invoke Despair", 101, Rarity.RARE, mage.cards.i.InvokeDespair.class)); cards.add(new SetCardInfo("Invoke the Ancients", 193, Rarity.RARE, mage.cards.i.InvokeTheAncients.class)); cards.add(new SetCardInfo("Invoke the Winds", 58, Rarity.RARE, mage.cards.i.InvokeTheWinds.class)); cards.add(new SetCardInfo("Ironhoof Boar", 148, Rarity.COMMON, mage.cards.i.IronhoofBoar.class));