From 946ed82f24b2ea60121667b80786e4e8624b4ede Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 13 Sep 2019 18:15:06 -0400 Subject: [PATCH] Implemented Redcap Melee --- Mage.Sets/src/mage/cards/r/RedcapMelee.java | 72 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RedcapMelee.java diff --git a/Mage.Sets/src/mage/cards/r/RedcapMelee.java b/Mage.Sets/src/mage/cards/r/RedcapMelee.java new file mode 100644 index 00000000000..e0673a7be66 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RedcapMelee.java @@ -0,0 +1,72 @@ +package mage.cards.r; + +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreatureOrPlaneswalker; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RedcapMelee extends CardImpl { + + public RedcapMelee(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}"); + + // Redcap Melee deals 4 damage to target creature or planeswalker. If a nonred permanent is dealt damage this way, you sacrifice a land. + this.getSpellAbility().addEffect(new RedcapMeleeEffect()); + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + } + + private RedcapMelee(final RedcapMelee card) { + super(card); + } + + @Override + public RedcapMelee copy() { + return new RedcapMelee(this); + } +} + +class RedcapMeleeEffect extends OneShotEffect { + + private static final Effect effect = new SacrificeControllerEffect(StaticFilters.FILTER_LAND, 1, ""); + + RedcapMeleeEffect() { + super(Outcome.Benefit); + staticText = "{this} deals 4 damage to target creature or planeswalker. " + + "If a nonred permanent is dealt damage this way, you sacrifice a land."; + } + + private RedcapMeleeEffect(final RedcapMeleeEffect effect) { + super(effect); + } + + @Override + public RedcapMeleeEffect copy() { + return new RedcapMeleeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + boolean isRed = permanent.getColor(game).isRed(); + if (permanent.damage(4, source.getSourceId(), game) > 0 && !isRed) { + return effect.apply(game, source); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 3b9d3d7b33c..c448e1eca84 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -130,6 +130,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Raging Redcap", 134, Rarity.COMMON, mage.cards.r.RagingRedcap.class)); cards.add(new SetCardInfo("Rankle, Master of Pranks", 101, Rarity.MYTHIC, mage.cards.r.RankleMasterOfPranks.class)); cards.add(new SetCardInfo("Reave Soul", 103, Rarity.COMMON, mage.cards.r.ReaveSoul.class)); + cards.add(new SetCardInfo("Redcap Melee", 135, Rarity.UNCOMMON, mage.cards.r.RedcapMelee.class)); cards.add(new SetCardInfo("Return to Nature", 173, Rarity.COMMON, mage.cards.r.ReturnToNature.class)); cards.add(new SetCardInfo("Righteousness", 27, Rarity.UNCOMMON, mage.cards.r.Righteousness.class)); cards.add(new SetCardInfo("Robber of the Rich", 138, Rarity.MYTHIC, mage.cards.r.RobberOfTheRich.class));