From dc8a2ad400cddb1b1b8fb17553cb4bb2b3a3c73e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 17 Sep 2022 22:59:06 -0400 Subject: [PATCH] [40K] Implemented Epistolary Librarian --- .../src/mage/cards/e/EpistolaryLibrarian.java | 64 +++++++++++++++++++ Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + 2 files changed, 65 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EpistolaryLibrarian.java diff --git a/Mage.Sets/src/mage/cards/e/EpistolaryLibrarian.java b/Mage.Sets/src/mage/cards/e/EpistolaryLibrarian.java new file mode 100644 index 0000000000..09e545c4a8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EpistolaryLibrarian.java @@ -0,0 +1,64 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.effects.common.cost.CastFromHandForFreeEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.Predicate; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EpistolaryLibrarian extends CardImpl { + + private static final FilterCard filter = new FilterCard("a spell with mana value X or less"); + + static { + filter.add(EpistolaryLibrarianPredicate.instance); + } + + public EpistolaryLibrarian(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{U}"); + + this.subtype.add(SubType.ASTARTES); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Veil of Time -- Whenever Epistolary Librarian attacks, you may cast a spell with mana value X or less from your hand without paying its mana cost, where X is the number of attacking creatures. + Ability ability = new AttacksTriggeredAbility(new CastFromHandForFreeEffect(filter)); + ability.addEffect(new InfoEffect(", where X is the number of attacking creatures")); + this.addAbility(ability.withFlavorWord("Veil of Time")); + } + + private EpistolaryLibrarian(final EpistolaryLibrarian card) { + super(card); + } + + @Override + public EpistolaryLibrarian copy() { + return new EpistolaryLibrarian(this); + } +} + +enum EpistolaryLibrarianPredicate implements Predicate { + instance; + + @Override + public boolean apply(Card input, Game game) { + return input.getManaValue() <= game + .getBattlefield() + .count(StaticFilters.FILTER_ATTACKING_CREATURE, null, null, game); + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index c97be6cdf8..f01003223e 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -80,6 +80,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Dread Return", 200, Rarity.UNCOMMON, mage.cards.d.DreadReturn.class)); cards.add(new SetCardInfo("Endless Atlas", 237, Rarity.RARE, mage.cards.e.EndlessAtlas.class)); cards.add(new SetCardInfo("Entrapment Maneuver", 185, Rarity.RARE, mage.cards.e.EntrapmentManeuver.class)); + cards.add(new SetCardInfo("Epistolary Librarian", 118, Rarity.RARE, mage.cards.e.EpistolaryLibrarian.class)); cards.add(new SetCardInfo("Everflowing Chalice", 238, Rarity.RARE, mage.cards.e.EverflowingChalice.class)); cards.add(new SetCardInfo("Evolving Wilds", 277, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); cards.add(new SetCardInfo("Exalted Flamer of Tzeentch", 119, Rarity.RARE, mage.cards.e.ExaltedFlamerOfTzeentch.class));