Implemented Gorging Vulture

This commit is contained in:
Evan Kranzler 2019-06-27 08:20:05 -04:00
parent 3f504dae5c
commit 24dcd26aad
2 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GorgingVulture extends CardImpl {
public GorgingVulture(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.BIRD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Gorging Vulture enters the battlefield, put the top four cards of your library into your graveyard. You gain 1 life for each creature card put into your graveyard this way.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GorgingVultureEffect()));
}
private GorgingVulture(final GorgingVulture card) {
super(card);
}
@Override
public GorgingVulture copy() {
return new GorgingVulture(this);
}
}
class GorgingVultureEffect extends OneShotEffect {
GorgingVultureEffect() {
super(Outcome.Benefit);
staticText = "put the top four cards of your library into your graveyard. " +
"You gain 1 life for each creature card put into your graveyard this way.";
}
private GorgingVultureEffect(final GorgingVultureEffect effect) {
super(effect);
}
@Override
public GorgingVultureEffect copy() {
return new GorgingVultureEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4));
player.moveCards(cards, Zone.GRAVEYARD, source, game);
int lifeToGain = cards
.getCards(game)
.stream()
.filter(Card::isCreature)
.mapToInt(card -> game.getState().getZone(card.getId()) == Zone.GRAVEYARD ? 1 : 0)
.sum();
return player.gainLife(lifeToGain, game, source) > 0;
}
}

View file

@ -157,6 +157,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Gods Willing", 19, Rarity.UNCOMMON, mage.cards.g.GodsWilling.class));
cards.add(new SetCardInfo("Goldmane Griffin", 283, Rarity.RARE, mage.cards.g.GoldmaneGriffin.class));
cards.add(new SetCardInfo("Golos, Tireless Pilgrim", 226, Rarity.RARE, mage.cards.g.GolosTirelessPilgrim.class));
cards.add(new SetCardInfo("Gorging Vulture", 102, Rarity.COMMON, mage.cards.g.GorgingVulture.class));
cards.add(new SetCardInfo("Grafdigger's Cage", 227, Rarity.RARE, mage.cards.g.GrafdiggersCage.class));
cards.add(new SetCardInfo("Gravedigger", 103, Rarity.UNCOMMON, mage.cards.g.Gravedigger.class));
cards.add(new SetCardInfo("Greenwood Sentinel", 174, Rarity.COMMON, mage.cards.g.GreenwoodSentinel.class));