Implemented Jasmine Seer

This commit is contained in:
Evan Kranzler 2018-06-04 09:07:34 -04:00
parent e06686610d
commit f6c6902ae2
3 changed files with 96 additions and 23 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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));