From 23ed28f387b35e46461e5df3f8d81e94a1db33ee Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 4 Sep 2020 13:16:48 -0400 Subject: [PATCH] [ZNR] Implemented Nighthawk Scavenger --- .../src/mage/cards/n/NighthawkScavenger.java | 96 +++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NighthawkScavenger.java diff --git a/Mage.Sets/src/mage/cards/n/NighthawkScavenger.java b/Mage.Sets/src/mage/cards/n/NighthawkScavenger.java new file mode 100644 index 0000000000..745ab6870a --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NighthawkScavenger.java @@ -0,0 +1,96 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.SetPowerSourceEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +import java.util.Collection; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class NighthawkScavenger extends CardImpl { + + public NighthawkScavenger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}"); + + this.subtype.add(SubType.VAMPIRE); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(0); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // Nighthawk Scavenger's power is equal to 1 plus the number of card types among cards in your opponents' graveyards. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SetPowerSourceEffect( + NighthawkScavengerValue.instance, Duration.EndOfGame + ).setText("{this}'s power is equal to 1 plus the number of card types among cards in your opponents' graveyards.") + )); + } + + private NighthawkScavenger(final NighthawkScavenger card) { + super(card); + } + + @Override + public NighthawkScavenger copy() { + return new NighthawkScavenger(this); + } +} + +enum NighthawkScavengerValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return 1 + game.getOpponents(sourceAbility.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(Player::getGraveyard) + .map(g -> g.getCards(game)) + .flatMap(Collection::stream) + .filter(Objects::nonNull) + .map(MageObject::getCardType) + .flatMap(Collection::stream) + .collect(Collectors.toSet()) + .size(); + } + + @Override + public NighthawkScavengerValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 201f3928cb..81d3edc894 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -128,6 +128,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Murkwater Pathway", 260, Rarity.RARE, mage.cards.m.MurkwaterPathway.class)); cards.add(new SetCardInfo("Nahiri, Heir of the Ancients", 230, Rarity.MYTHIC, mage.cards.n.NahiriHeirOfTheAncients.class)); cards.add(new SetCardInfo("Needleverge Pathway", 263, Rarity.RARE, mage.cards.n.NeedlevergePathway.class)); + cards.add(new SetCardInfo("Nighthawk Scavenger", 115, Rarity.RARE, mage.cards.n.NighthawkScavenger.class)); cards.add(new SetCardInfo("Nimana Skitter-Sneak", 116, Rarity.COMMON, mage.cards.n.NimanaSkitterSneak.class)); cards.add(new SetCardInfo("Omnath, Locus of Creation", 232, Rarity.MYTHIC, mage.cards.o.OmnathLocusOfCreation.class)); cards.add(new SetCardInfo("Orah, Skyclave Hierophant", 233, Rarity.RARE, mage.cards.o.OrahSkyclaveHierophant.class));