From 24dcd26aad914cc1c66b1479e43dde2fa5d168b5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 27 Jun 2019 08:20:05 -0400 Subject: [PATCH] Implemented Gorging Vulture --- .../src/mage/cards/g/GorgingVulture.java | 80 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GorgingVulture.java diff --git a/Mage.Sets/src/mage/cards/g/GorgingVulture.java b/Mage.Sets/src/mage/cards/g/GorgingVulture.java new file mode 100644 index 0000000000..5f042ced90 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GorgingVulture.java @@ -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; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 37f774f021..2fe05115d7 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -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));