From 4c8f3ec3ae47f7f854cd05b8bc6c09f578d2aae2 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 18 Apr 2019 18:14:01 -0400 Subject: [PATCH] Implemented Heartwarming Redemption --- .../mage/cards/h/HeartwarmingRedemption.java | 65 +++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + 2 files changed, 66 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java diff --git a/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java b/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java new file mode 100644 index 0000000000..80dd636e95 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeartwarmingRedemption.java @@ -0,0 +1,65 @@ +package mage.cards.h; + +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.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HeartwarmingRedemption extends CardImpl { + + public HeartwarmingRedemption(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}{W}"); + + // Discard all the cards in your hand, then draw that many cards plus one. You gain life equal to the number of cards in your hand. + this.getSpellAbility().addEffect(new HeartwarmingRedemptionEffect()); + } + + private HeartwarmingRedemption(final HeartwarmingRedemption card) { + super(card); + } + + @Override + public HeartwarmingRedemption copy() { + return new HeartwarmingRedemption(this); + } +} + +class HeartwarmingRedemptionEffect extends OneShotEffect { + + HeartwarmingRedemptionEffect() { + super(Outcome.Benefit); + staticText = "Discard all the cards in your hand, then draw that many cards plus one. " + + "You gain life equal to the number of cards in your hand."; + } + + private HeartwarmingRedemptionEffect(final HeartwarmingRedemptionEffect effect) { + super(effect); + } + + @Override + public HeartwarmingRedemptionEffect copy() { + return new HeartwarmingRedemptionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int discarded = player.discard(player.getHand().size(), false, source, game).size(); + player.drawCards(discarded + 1, game); + player.gainLife(player.getHand().size(), game, source); + return true; + } +} +// Good night, sweet prince :( \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index d23bb75a52..608d0e1197 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -127,6 +127,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Guild Globe", 239, Rarity.COMMON, mage.cards.g.GuildGlobe.class)); cards.add(new SetCardInfo("Guildpact Informant", 271, Rarity.COMMON, mage.cards.g.GuildpactInformant.class)); cards.add(new SetCardInfo("Heartfire", 131, Rarity.COMMON, mage.cards.h.Heartfire.class)); + cards.add(new SetCardInfo("Heartwarming Redemption", 199, Rarity.UNCOMMON, mage.cards.h.HeartwarmingRedemption.class)); cards.add(new SetCardInfo("Herald of the Dreadhorde", 93, Rarity.COMMON, mage.cards.h.HeraldOfTheDreadhorde.class)); cards.add(new SetCardInfo("Honor the God-Pharaoh", 132, Rarity.COMMON, mage.cards.h.HonorTheGodPharaoh.class)); cards.add(new SetCardInfo("Huatli's Raptor", 200, Rarity.UNCOMMON, mage.cards.h.HuatlisRaptor.class));