From 3e5ba7e0971e5ea6f124030075d73fe9492969ad Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 30 Oct 2022 19:58:43 -0400 Subject: [PATCH] [BRO] Implemented Mishra's Command --- .../src/mage/cards/m/MishrasCommand.java | 98 +++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 1 + 2 files changed, 99 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MishrasCommand.java diff --git a/Mage.Sets/src/mage/cards/m/MishrasCommand.java b/Mage.Sets/src/mage/cards/m/MishrasCommand.java new file mode 100644 index 00000000000..4c4d496db50 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MishrasCommand.java @@ -0,0 +1,98 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetPlaneswalkerPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MishrasCommand extends CardImpl { + + public MishrasCommand(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}"); + + // Choose two -- + this.getSpellAbility().getModes().setMinModes(2); + this.getSpellAbility().getModes().setMaxModes(2); + + // * Choose target player. They may discard up to X cards. Then they draw a card for each card discarded this way. + this.getSpellAbility().addEffect(new MishrasCommandEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + + // * This spell deals X damage to target creature. + this.getSpellAbility().addMode(new Mode(new DamageTargetEffect( + ManacostVariableValue.REGULAR, "this spell" + )).addTarget(new TargetCreaturePermanent())); + + // * This spell deals X damage to target planeswalker. + this.getSpellAbility().addMode(new Mode(new DamageTargetEffect( + ManacostVariableValue.REGULAR, "this spell" + )).addTarget(new TargetPlaneswalkerPermanent())); + + // * Target creature gets +X/+0 and gains haste until end of turn. + this.getSpellAbility().addMode(new Mode(new BoostTargetEffect( + ManacostVariableValue.REGULAR, StaticValue.get(0), Duration.EndOfTurn + ).setText("target creature gets +X/+0")).addEffect(new GainAbilityTargetEffect( + HasteAbility.getInstance(), Duration.EndOfTurn + ).setText("and gains haste until end of turn")).addTarget(new TargetCreaturePermanent())); + } + + private MishrasCommand(final MishrasCommand card) { + super(card); + } + + @Override + public MishrasCommand copy() { + return new MishrasCommand(this); + } +} + +class MishrasCommandEffect extends OneShotEffect { + + MishrasCommandEffect() { + super(Outcome.Benefit); + staticText = "choose target player. They may discard up to X cards. " + + "Then they draw a card for each card discarded this way"; + } + + private MishrasCommandEffect(final MishrasCommandEffect effect) { + super(effect); + } + + @Override + public MishrasCommandEffect copy() { + return new MishrasCommandEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + int xValue = source.getManaCostsToPay().getX(); + if (player != null && xValue > 0) { + player.drawCards(player.discard( + 0, xValue, false, source, game + ).size(), source, game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index eb1daa37f4d..d7b13ae6b5a 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -44,6 +44,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Hurkyl, Master Wizard", 51, Rarity.RARE, mage.cards.h.HurkylMasterWizard.class)); cards.add(new SetCardInfo("Island", 280, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Llanowar Wastes", 264, Rarity.RARE, mage.cards.l.LlanowarWastes.class)); + cards.add(new SetCardInfo("Mishra's Command", 141, Rarity.RARE, mage.cards.m.MishrasCommand.class)); cards.add(new SetCardInfo("Mishra's Foundry", 265, Rarity.RARE, mage.cards.m.MishrasFoundry.class)); cards.add(new SetCardInfo("Mishra's Juggernaut", 161, Rarity.COMMON, mage.cards.m.MishrasJuggernaut.class)); cards.add(new SetCardInfo("Mishra, Claimed by Gix", 216, Rarity.MYTHIC, mage.cards.m.MishraClaimedByGix.class));