From 2816a516f3ce6b2e63b66b03f20997b2f5c75f05 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 12 Sep 2019 07:55:34 -0400 Subject: [PATCH] Implemented Into the Story --- Mage.Sets/src/mage/cards/i/IntoTheStory.java | 63 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 2 files changed, 64 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/i/IntoTheStory.java diff --git a/Mage.Sets/src/mage/cards/i/IntoTheStory.java b/Mage.Sets/src/mage/cards/i/IntoTheStory.java new file mode 100644 index 00000000000..e48ef7bf07e --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IntoTheStory.java @@ -0,0 +1,63 @@ +package mage.cards.i; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.Graveyard; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class IntoTheStory extends CardImpl { + + public IntoTheStory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{U}{U}"); + + // This spell costs {3} less to cast if an opponent has seven or more cards in their graveyard. + this.addAbility(new SimpleStaticAbility( + Zone.STACK, new SpellCostReductionSourceEffect(3, IntoTheStoryCondition.instance) + ).setRuleAtTheTop(true)); + + // Draw four cards. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(4)); + } + + private IntoTheStory(final IntoTheStory card) { + super(card); + } + + @Override + public IntoTheStory copy() { + return new IntoTheStory(this); + } +} + +enum IntoTheStoryCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game + .getOpponents(source.getControllerId()) + .stream() + .map(game::getPlayer) + .map(Player::getGraveyard) + .mapToInt(Graveyard::size) + .anyMatch(i -> i >= 7); + } + + @Override + public String toString() { + return "an opponent has seven or more cards in their graveyard"; + } +} diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 3d96e496c4e..136c955890c 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -83,6 +83,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Inquisitive Puppet", 223, Rarity.UNCOMMON, mage.cards.i.InquisitivePuppet.class)); cards.add(new SetCardInfo("Insatiable Appetite", 162, Rarity.COMMON, mage.cards.i.InsatiableAppetite.class)); cards.add(new SetCardInfo("Inspiring Veteran", 194, Rarity.UNCOMMON, mage.cards.i.InspiringVeteran.class)); + cards.add(new SetCardInfo("Into the Story", 50, Rarity.UNCOMMON, mage.cards.i.IntoTheStory.class)); cards.add(new SetCardInfo("Joust", 129, Rarity.UNCOMMON, mage.cards.j.Joust.class)); cards.add(new SetCardInfo("Jousting Dummy", 224, Rarity.COMMON, mage.cards.j.JoustingDummy.class)); cards.add(new SetCardInfo("Keeper of Fables", 163, Rarity.UNCOMMON, mage.cards.k.KeeperOfFables.class));