diff --git a/Mage.Sets/src/mage/cards/f/FolioOfFancies.java b/Mage.Sets/src/mage/cards/f/FolioOfFancies.java new file mode 100644 index 00000000000..191fe2c06d0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FolioOfFancies.java @@ -0,0 +1,95 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; + +import java.util.Collection; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class FolioOfFancies extends CardImpl { + + public FolioOfFancies(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{U}"); + + // Players have no maximum hand size. + this.addAbility(new SimpleStaticAbility(new MaximumHandSizeControllerEffect( + Integer.MAX_VALUE, Duration.WhileOnBattlefield, + MaximumHandSizeControllerEffect.HandSizeModification.SET, TargetController.ANY + ))); + + // {X}{X}, {T}: Each player draws X cards. + Ability ability = new SimpleActivatedAbility( + new DrawCardAllEffect(ManacostVariableValue.instance), new ManaCostsImpl("{X}{X}") + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + + // {2}{U}, {T}: Each opponent puts a number of cards equal to the number of cards in their hand from the top of their library into their graveyard. + ability = new SimpleActivatedAbility(new FolioOfFanciesEffect(), new ManaCostsImpl("{2}{U}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private FolioOfFancies(final FolioOfFancies card) { + super(card); + } + + @Override + public FolioOfFancies copy() { + return new FolioOfFancies(this); + } +} + +class FolioOfFanciesEffect extends OneShotEffect { + + FolioOfFanciesEffect() { + super(Outcome.Benefit); + staticText = "Each opponent puts a number of cards equal to the number of cards in their hand " + + "from the top of their library into their graveyard."; + } + + private FolioOfFanciesEffect(final FolioOfFanciesEffect effect) { + super(effect); + } + + @Override + public FolioOfFanciesEffect copy() { + return new FolioOfFanciesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Set cards = game.getOpponents(source.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .filter(player -> !player.getHand().isEmpty()) + .map(player -> player.getLibrary().getTopCards(game, player.getHand().size())) + .flatMap(Collection::stream) + .collect(Collectors.toSet()); + return controller.moveCards(cards, 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 3bc91be1db6..3cb1376808c 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -76,6 +76,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Fierce Witchstalker", 154, Rarity.COMMON, mage.cards.f.FierceWitchstalker.class)); cards.add(new SetCardInfo("Fireborn Knight", 210, Rarity.UNCOMMON, mage.cards.f.FirebornKnight.class)); cards.add(new SetCardInfo("Flaxen Intruder", 155, Rarity.UNCOMMON, mage.cards.f.FlaxenIntruder.class)); + cards.add(new SetCardInfo("Folio of Fancies", 46, Rarity.RARE, mage.cards.f.FolioOfFancies.class)); cards.add(new SetCardInfo("Foulmire Knight", 90, Rarity.UNCOMMON, mage.cards.f.FoulmireKnight.class)); cards.add(new SetCardInfo("Frogify", 47, Rarity.UNCOMMON, mage.cards.f.Frogify.class)); cards.add(new SetCardInfo("Garenbrig Paladin", 157, Rarity.COMMON, mage.cards.g.GarenbrigPaladin.class));