Implemented Guiding Spirit

This commit is contained in:
Evan Kranzler 2019-01-30 22:38:25 -05:00
parent 3a356c014b
commit 47d88e94ff
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GuidingSpirit extends CardImpl {
public GuidingSpirit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}");
this.subtype.add(SubType.ANGEL);
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {tap}: If the top card of target player's graveyard is a creature card, put that card on top of that player's library.
Ability ability = new SimpleActivatedAbility(new GuidingSpiritEffect(), new TapSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
private GuidingSpirit(final GuidingSpirit card) {
super(card);
}
@Override
public GuidingSpirit copy() {
return new GuidingSpirit(this);
}
}
class GuidingSpiritEffect extends OneShotEffect {
GuidingSpiritEffect() {
super(Outcome.Benefit);
staticText = "If the top card of target player's graveyard is a creature card, " +
"put that card on top of that player's library.";
}
private GuidingSpiritEffect(final GuidingSpiritEffect effect) {
super(effect);
}
@Override
public GuidingSpiritEffect copy() {
return new GuidingSpiritEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
Card card = player.getGraveyard().getTopCard(game);
if (card != null && card.isCreature()) {
player.putCardsOnTopOfLibrary(new CardsImpl(card), game, source, false);
}
return true;
}
}

View file

@ -78,6 +78,7 @@ public final class Visions extends ExpansionSet {
cards.add(new SetCardInfo("Goblin Swine-Rider", 81, Rarity.COMMON, mage.cards.g.GoblinSwineRider.class));
cards.add(new SetCardInfo("Gossamer Chains", 6, Rarity.COMMON, mage.cards.g.GossamerChains.class));
cards.add(new SetCardInfo("Griffin Canyon", 163, Rarity.RARE, mage.cards.g.GriffinCanyon.class));
cards.add(new SetCardInfo("Guiding Spirit", 131, Rarity.RARE, mage.cards.g.GuidingSpirit.class));
cards.add(new SetCardInfo("Hearth Charm", 82, Rarity.COMMON, mage.cards.h.HearthCharm.class));
cards.add(new SetCardInfo("Helm of Awakening", 145, Rarity.UNCOMMON, mage.cards.h.HelmOfAwakening.class));
cards.add(new SetCardInfo("Honorable Passage", 7, Rarity.UNCOMMON, mage.cards.h.HonorablePassage.class));