From e31e18e5357d192d766c54828e0fabdee33e2a89 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Mon, 23 Jan 2023 08:47:19 -0500 Subject: [PATCH] [ONE] Implement Tamiyo's Logbook --- .../src/mage/cards/t/TamiyosLogbook.java | 72 +++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TamiyosLogbook.java diff --git a/Mage.Sets/src/mage/cards/t/TamiyosLogbook.java b/Mage.Sets/src/mage/cards/t/TamiyosLogbook.java new file mode 100644 index 0000000000..ea7780126b --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TamiyosLogbook.java @@ -0,0 +1,72 @@ +package mage.cards.t; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.CostAdjuster; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.util.CardUtil; + +/** + * @author TheElk801 + */ +public final class TamiyosLogbook extends CardImpl { + + public TamiyosLogbook(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{U}"); + + // {5}{U}, {T}: Draw a card. This ability costs {1} less to activate for each other artifact you control. + Ability ability = new SimpleActivatedAbility( + new DrawCardSourceControllerEffect(1), new ManaCostsImpl<>("{5}{U}") + ); + ability.addCost(new TapSourceCost()); + ability.addEffect(new InfoEffect("This ability costs {1} less to activate for each other artifact you control")); + this.addAbility(ability.setCostAdjuster(TamiyosLogbookAdjuster.instance).addHint(TamiyosLogbookAdjuster.getHint())); + } + + private TamiyosLogbook(final TamiyosLogbook card) { + super(card); + } + + @Override + public TamiyosLogbook copy() { + return new TamiyosLogbook(this); + } +} + +enum TamiyosLogbookAdjuster implements CostAdjuster { + instance; + private static final FilterPermanent filter = new FilterControlledArtifactPermanent(); + + static { + filter.add(AnotherPredicate.instance); + } + + private static final Hint hint = new ValueHint( + "Other artifacts you control", new PermanentsOnBattlefieldCount(filter) + ); + + @Override + public void adjustCosts(Ability ability, Game game) { + int count = game.getBattlefield().count(filter, ability.getControllerId(), ability, game); + CardUtil.reduceCost(ability, count); + } + + public static Hint getHint() { + return hint; + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index 0cf6e866a3..1ca1bf7119 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -108,6 +108,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Swooping Lookout", 35, Rarity.UNCOMMON, mage.cards.s.SwoopingLookout.class)); cards.add(new SetCardInfo("Tablet of Compleation", 245, Rarity.RARE, mage.cards.t.TabletOfCompleation.class)); cards.add(new SetCardInfo("Tamiyo's Immobilizer", 69, Rarity.UNCOMMON, mage.cards.t.TamiyosImmobilizer.class)); + cards.add(new SetCardInfo("Tamiyo's Logbook", 70, Rarity.UNCOMMON, mage.cards.t.TamiyosLogbook.class)); cards.add(new SetCardInfo("The Filigree Sylex", 227, Rarity.RARE, mage.cards.t.TheFiligreeSylex.class)); cards.add(new SetCardInfo("The Monumental Facade", 255, Rarity.RARE, mage.cards.t.TheMonumentalFacade.class)); cards.add(new SetCardInfo("The Seedcore", 259, Rarity.RARE, mage.cards.t.TheSeedcore.class));