From 13fbb51a5e167a87481dd3cc5fe075263fc11ee2 Mon Sep 17 00:00:00 2001 From: Jamaninja Date: Tue, 29 Oct 2024 17:58:10 +0000 Subject: [PATCH 1/2] [DSK] Implement Grab the Prize --- Mage.Sets/src/mage/cards/g/GrabThePrize.java | 59 +++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 60 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GrabThePrize.java diff --git a/Mage.Sets/src/mage/cards/g/GrabThePrize.java b/Mage.Sets/src/mage/cards/g/GrabThePrize.java new file mode 100644 index 000000000000..4203af918851 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrabThePrize.java @@ -0,0 +1,59 @@ +package mage.cards.g; + +import java.util.Collection; +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.util.CardUtil; + +/** + * @author Jamaninja + */ +public final class GrabThePrize extends CardImpl { + + public GrabThePrize(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); + + // As an additional cost to cast this spell, discard a card. + this.getSpellAbility().addCost(new DiscardCardCost()); + + // Draw two cards. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); + + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new DamagePlayersEffect(2, TargetController.OPPONENT), + GrabThePrizeCondition.instance, + "If the discarded card wasn't a land card, {this} deals two damage to each opponent.")); + } + + private GrabThePrize(final GrabThePrize card) { + super(card); + } + + @Override + public GrabThePrize copy() { + return new GrabThePrize(this); + } +} + +enum GrabThePrizeCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return CardUtil.castStream(source.getCosts().stream(), DiscardCardCost.class) + .map(DiscardCardCost::getCards) + .flatMap(Collection::stream) + .anyMatch(card -> !card.isLand(game)); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index dbec10452d2c..41f4788093d9 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -108,6 +108,7 @@ private DuskmournHouseOfHorror() { cards.add(new SetCardInfo("Glimmerburst", 62, Rarity.COMMON, mage.cards.g.Glimmerburst.class)); cards.add(new SetCardInfo("Glimmerlight", 249, Rarity.COMMON, mage.cards.g.Glimmerlight.class)); cards.add(new SetCardInfo("Gloomlake Verge", 260, Rarity.RARE, mage.cards.g.GloomlakeVerge.class)); + cards.add(new SetCardInfo("Grab the Prize", 138, Rarity.COMMON, mage.cards.g.GrabThePrize.class)); cards.add(new SetCardInfo("Grasping Longneck", 180, Rarity.COMMON, mage.cards.g.GraspingLongneck.class)); cards.add(new SetCardInfo("Gremlin Tamer", 215, Rarity.UNCOMMON, mage.cards.g.GremlinTamer.class)); cards.add(new SetCardInfo("Grievous Wound", 102, Rarity.RARE, mage.cards.g.GrievousWound.class)); From 2a75b1ee4a2e13070bc31f80c065af0f77b1a8c0 Mon Sep 17 00:00:00 2001 From: Jamaninja Date: Tue, 29 Oct 2024 20:01:40 +0000 Subject: [PATCH 2/2] Grab the Prize - Added missing comment --- Mage.Sets/src/mage/cards/g/GrabThePrize.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/cards/g/GrabThePrize.java b/Mage.Sets/src/mage/cards/g/GrabThePrize.java index 4203af918851..7bdf108bad5a 100644 --- a/Mage.Sets/src/mage/cards/g/GrabThePrize.java +++ b/Mage.Sets/src/mage/cards/g/GrabThePrize.java @@ -30,6 +30,7 @@ public GrabThePrize(UUID ownerId, CardSetInfo setInfo) { // Draw two cards. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); + // If the discarded card wasn't a land card, {this} deals two damage to each opponent. this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DamagePlayersEffect(2, TargetController.OPPONENT), GrabThePrizeCondition.instance,