diff --git a/Mage.Sets/src/mage/cards/e/EyeCollector.java b/Mage.Sets/src/mage/cards/e/EyeCollector.java new file mode 100644 index 00000000000..708c9bec082 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EyeCollector.java @@ -0,0 +1,82 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +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.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class EyeCollector extends CardImpl { + + public EyeCollector(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}"); + + this.subtype.add(SubType.FAERIE); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever Eye Collector deals combat damage to a player, each player puts the top card of their library into their graveyard. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new EyeCollectorEffect(), false)); + } + + private EyeCollector(final EyeCollector card) { + super(card); + } + + @Override + public EyeCollector copy() { + return new EyeCollector(this); + } +} + +class EyeCollectorEffect extends OneShotEffect { + + EyeCollectorEffect() { + super(Outcome.Benefit); + staticText = "each player puts the top card of their library into their graveyard"; + } + + private EyeCollectorEffect(final EyeCollectorEffect effect) { + super(effect); + } + + @Override + public EyeCollectorEffect copy() { + return new EyeCollectorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + return controller.moveCards(new CardsImpl(game.getState() + .getPlayersInRange(controller.getId(), game) + .stream() + .map(game::getPlayer) + .filter(player -> player != null) + .map(Player::getLibrary) + .map(library -> library.getFromTop(game)) + .collect(Collectors.toSet()) + ), Zone.GRAVEYARD, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 80422527743..2efeb6b8fa2 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -32,6 +32,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Chittering Witch", 319, Rarity.RARE, mage.cards.c.ChitteringWitch.class)); cards.add(new SetCardInfo("Chulane, Teller of Tales", 326, Rarity.MYTHIC, mage.cards.c.ChulaneTellerOfTales.class)); cards.add(new SetCardInfo("Crystal Slipper", 119, Rarity.COMMON, mage.cards.c.CrystalSlipper.class)); + cards.add(new SetCardInfo("Eye Collector", 86, Rarity.COMMON, mage.cards.e.EyeCollector.class)); cards.add(new SetCardInfo("Fireborn Knight", 210, Rarity.UNCOMMON, mage.cards.f.FirebornKnight.class)); cards.add(new SetCardInfo("Gilded Goose", 160, Rarity.RARE, mage.cards.g.GildedGoose.class)); cards.add(new SetCardInfo("Golden Egg", 220, Rarity.COMMON, mage.cards.g.GoldenEgg.class));