From 7607d69015dabf9ede5b04c2a2e6a3c04a6d04ce Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 31 May 2021 16:08:37 -0400 Subject: [PATCH] [MH2] Implemented Chrome Courier --- Mage.Sets/src/mage/cards/c/ChromeCourier.java | 97 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ChromeCourier.java diff --git a/Mage.Sets/src/mage/cards/c/ChromeCourier.java b/Mage.Sets/src/mage/cards/c/ChromeCourier.java new file mode 100644 index 00000000000..7ce54a0867e --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChromeCourier.java @@ -0,0 +1,97 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ChromeCourier extends CardImpl { + + public ChromeCourier(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{W}{U}"); + + this.subtype.add(SubType.THOPTER); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Chrome Courier enters the battlefield, reveal the top two cards of your library. Put one of them into your hand and the other into your graveyard. If you put an artifact card into your hand this way, you gain 3 life. + this.addAbility(new EntersBattlefieldTriggeredAbility(new ChromeCourierEffect())); + } + + private ChromeCourier(final ChromeCourier card) { + super(card); + } + + @Override + public ChromeCourier copy() { + return new ChromeCourier(this); + } +} + +class ChromeCourierEffect extends OneShotEffect { + + ChromeCourierEffect() { + super(Outcome.Benefit); + staticText = "reveal the top two cards of your library. " + + "Put one of them into your hand and the other into your graveyard. " + + "If you put an artifact card into your hand this way, you gain 3 life"; + } + + private ChromeCourierEffect(final ChromeCourierEffect effect) { + super(effect); + } + + @Override + public ChromeCourierEffect copy() { + return new ChromeCourierEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2)); + player.revealCards(source, cards, game); + Card card; + switch (cards.size()) { + case 0: + card = null; + break; + case 1: + card = cards.getRandom(game); + break; + default: + TargetCard target = new TargetCardInLibrary(); + target.withChooseHint("to hand"); + player.choose(outcome, cards, target, game); + card = cards.get(target.getFirstTarget(), game); + } + player.moveCards(card, Zone.HAND, source, game); + cards.remove(card); + player.moveCards(cards, Zone.GRAVEYARD, source, game); + if (card != null && card.isArtifact()) { + player.gainLife(3, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index 132a013571b..cf8f3cf7bbc 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -51,6 +51,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Chainer, Nightmare Adept", 289, Rarity.RARE, mage.cards.c.ChainerNightmareAdept.class)); cards.add(new SetCardInfo("Chance Encounter", 277, Rarity.RARE, mage.cards.c.ChanceEncounter.class)); cards.add(new SetCardInfo("Chatterstorm", 152, Rarity.COMMON, mage.cards.c.Chatterstorm.class)); + cards.add(new SetCardInfo("Chrome Courier", 190, Rarity.COMMON, mage.cards.c.ChromeCourier.class)); cards.add(new SetCardInfo("Combine Chrysalis", 191, Rarity.UNCOMMON, mage.cards.c.CombineChrysalis.class)); cards.add(new SetCardInfo("Constable of the Realm", 10, Rarity.UNCOMMON, mage.cards.c.ConstableOfTheRealm.class)); cards.add(new SetCardInfo("Counterspell", 267, Rarity.UNCOMMON, mage.cards.c.Counterspell.class));