From f6c6902ae2b1edf36ca91d2a84af848cfb446b14 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 4 Jun 2018 09:07:34 -0400 Subject: [PATCH] Implemented Jasmine Seer --- Mage.Sets/src/mage/cards/j/JasmineSeer.java | 85 +++++++++++++++++++ .../src/mage/cards/s/ScentOfJasmine.java | 33 +++---- Mage.Sets/src/mage/sets/UrzasDestiny.java | 1 + 3 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/j/JasmineSeer.java diff --git a/Mage.Sets/src/mage/cards/j/JasmineSeer.java b/Mage.Sets/src/mage/cards/j/JasmineSeer.java new file mode 100644 index 00000000000..fde4f020ddb --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JasmineSeer.java @@ -0,0 +1,85 @@ +package mage.cards.j; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RevealTargetFromHandCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.target.common.TargetCardInHand; + +/** + * + * @author TheElk801 + */ +public final class JasmineSeer extends CardImpl { + + public JasmineSeer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {2}{W}, {tap}: Reveal any number of white cards in your hand. You gain 2 life for each card revealed this way. + Ability ability = new SimpleActivatedAbility(new JasmineSeerEffect(), new ManaCostsImpl("{2}{WF}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + public JasmineSeer(final JasmineSeer card) { + super(card); + } + + @Override + public JasmineSeer copy() { + return new JasmineSeer(this); + } +} + +class JasmineSeerEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("any number of white cards"); + + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + + public JasmineSeerEffect() { + super(Outcome.GainLife); + this.staticText = "reveal any number of white cards in your hand. " + + "You gain 2 life for each card revealed this way"; + } + + public JasmineSeerEffect(final JasmineSeerEffect effect) { + super(effect); + } + + @Override + public JasmineSeerEffect copy() { + return new JasmineSeerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); + if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + return false; + } + int xValue = cost.getNumberRevealedCards(); + return new GainLifeEffect(2 * xValue).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java b/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java index 95ec2050311..a997bc36508 100644 --- a/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java +++ b/Mage.Sets/src/mage/cards/s/ScentOfJasmine.java @@ -1,21 +1,18 @@ - package mage.cards.s; import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.effects.Effect; +import mage.abilities.costs.common.RevealTargetFromHandCost; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; -import mage.players.Player; import mage.target.common.TargetCardInHand; /** @@ -28,9 +25,7 @@ public final class ScentOfJasmine extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); // Reveal any number of white cards in your hand. You gain 2 life for each card revealed this way. - Effect effect = new ScentOfJasmineEffect(); - effect.setText("Reveal any number of white cards in your hand. You gain 2 life for each card revealed this way."); - this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(new ScentOfJasmineEffect()); } public ScentOfJasmine(final ScentOfJasmine card) { @@ -45,7 +40,7 @@ public final class ScentOfJasmine extends CardImpl { class ScentOfJasmineEffect extends OneShotEffect { - private static final FilterCard filter = new FilterCard("white cards"); + private static final FilterCard filter = new FilterCard("any number of white cards"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); @@ -53,6 +48,8 @@ class ScentOfJasmineEffect extends OneShotEffect { public ScentOfJasmineEffect() { super(Outcome.GainLife); + this.staticText = "reveal any number of white cards in your hand. " + + "You gain 2 life for each card revealed this way"; } public ScentOfJasmineEffect(final ScentOfJasmineEffect effect) { @@ -66,21 +63,11 @@ class ScentOfJasmineEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { + RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)); + if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { return false; } - Cards cards = new CardsImpl(); - if (player.getHand().count(filter, game) > 0) { - TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter); - if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) { - for (UUID uuid : target.getTargets()) { - cards.add(player.getHand().get(uuid, game)); - } - player.revealCards("cards", cards, game); - player.gainLife(cards.getCards(game).size() * 2, game, source); - } - } - return true; + int xValue = cost.getNumberRevealedCards(); + return new GainLifeEffect(2 * xValue).apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/UrzasDestiny.java b/Mage.Sets/src/mage/sets/UrzasDestiny.java index b26548e45c1..0d1da153d20 100644 --- a/Mage.Sets/src/mage/sets/UrzasDestiny.java +++ b/Mage.Sets/src/mage/sets/UrzasDestiny.java @@ -83,6 +83,7 @@ public final class UrzasDestiny extends ExpansionSet { cards.add(new SetCardInfo("Impatience", 88, Rarity.RARE, mage.cards.i.Impatience.class)); cards.add(new SetCardInfo("Iridescent Drake", 35, Rarity.UNCOMMON, mage.cards.i.IridescentDrake.class)); cards.add(new SetCardInfo("Ivy Seer", 110, Rarity.UNCOMMON, mage.cards.i.IvySeer.class)); + cards.add(new SetCardInfo("Jasmine Seer", 10, Rarity.UNCOMMON, mage.cards.j.JasmineSeer.class)); cards.add(new SetCardInfo("Junk Diver", 132, Rarity.RARE, mage.cards.j.JunkDiver.class)); cards.add(new SetCardInfo("Keldon Champion", 90, Rarity.UNCOMMON, mage.cards.k.KeldonChampion.class)); cards.add(new SetCardInfo("Keldon Vandals", 91, Rarity.COMMON, mage.cards.k.KeldonVandals.class));