From 7da1df250d49387edbc6793912cf438a0d47a6f5 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Wed, 16 Aug 2023 14:44:03 +0200 Subject: [PATCH] [WOE] Implement Troyan, Gutsy Explorer (#10824) --- .../src/mage/cards/t/TroyanGutsyExplorer.java | 101 ++++++++++++++++++ Mage.Sets/src/mage/sets/WildsOfEldraine.java | 1 + Utils/mtg-cards-data.txt | 2 +- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/t/TroyanGutsyExplorer.java diff --git a/Mage.Sets/src/mage/cards/t/TroyanGutsyExplorer.java b/Mage.Sets/src/mage/cards/t/TroyanGutsyExplorer.java new file mode 100644 index 00000000000..6c59b1cb0bf --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TroyanGutsyExplorer.java @@ -0,0 +1,101 @@ +package mage.cards.t; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.costs.mana.VariableManaCost; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.mana.ConditionalColoredManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class TroyanGutsyExplorer extends CardImpl { + + public TroyanGutsyExplorer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.VEDALKEN); + this.subtype.add(SubType.SCOUT); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // {T}: Add {G}{U}. Spend this mana only to cast spells with mana value 5 or greater or spells with X in their mana costs. + this.addAbility(new ConditionalColoredManaAbility( + new TapSourceCost(), + new Mana(0, 1, 0, 0, 1, 0, 0, 0), + new TroyanGutsyExplorerManaBuilder() + )); + + // {U}, {T}: Draw a card, then discard a card. + Ability ability = new SimpleActivatedAbility( + new DrawDiscardControllerEffect(), + new ManaCostsImpl<>("{U}") + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private TroyanGutsyExplorer(final TroyanGutsyExplorer card) { + super(card); + } + + @Override + public TroyanGutsyExplorer copy() { + return new TroyanGutsyExplorer(this); + } +} + +class TroyanGutsyExplorerManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new TroyanGutsyExplorerConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast spells with mana value 5 or greater or spells with X in their mana costs"; + } +} + +class TroyanGutsyExplorerConditionalMana extends ConditionalMana { + TroyanGutsyExplorerConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to cast spells with mana value 5 or greater or spells with X in their mana costs"; + addCondition(TroyanGutsyExplorerCondition.instance); + } +} + +enum TroyanGutsyExplorerCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + if (!(source instanceof SpellAbility)) { + // Only for spells. + return false; + } + + MageObject object = game.getObject(source); + return object != null && (object.getManaValue() >= 5 || + object.getManaCost().stream().anyMatch(VariableManaCost.class::isInstance)); + } +} diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraine.java b/Mage.Sets/src/mage/sets/WildsOfEldraine.java index 65a9af43e8c..aac21003688 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraine.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraine.java @@ -41,6 +41,7 @@ public final class WildsOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Talion, the Kindly Lord", 215, Rarity.MYTHIC, mage.cards.t.TalionTheKindlyLord.class)); cards.add(new SetCardInfo("Tanglespan Lookout", 188, Rarity.UNCOMMON, mage.cards.t.TanglespanLookout.class)); cards.add(new SetCardInfo("Tough Cookie", 193, Rarity.UNCOMMON, mage.cards.t.ToughCookie.class)); + cards.add(new SetCardInfo("Troyan, Gutsy Explorer", 217, Rarity.UNCOMMON, mage.cards.t.TroyanGutsyExplorer.class)); } // @Override diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 2ca16e55ed5..28ae9b4aa2c 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -50208,7 +50208,7 @@ Sharae of Numbing Depths|Wilds of Eldraine|213|U|{2}{W}{U}|Legendary Creature - Syr Armont, the Redeemer 34*|Wilds of Eldraine|214|U|{3}{G}{W}|Legendary Creature - Human Knight|4|4|When Syr Armont, the Redeemer 34* enters the battlefield, create a Monster Role token attached to another target creature you control.$Enchanted creatures you control get +1/+1.| Talion, the Kindly Lord|Wilds of Eldraine|215|M|{2}{U}{B}|Legendary Creature - Faerie Noble|3|4|Flying$As Talion, the Kindly Lord enters the battlefield, choose a number between 1 and 10.$Whenever an opponent casts a spell with mana value, power, or toughness equal to the chosen number, that player loses 2 life and you draw a card.| Totentanz, Swarm Piper|Wilds of Eldraine|216|U|{1}{B}{R}|Legendary Creature - Human Warlock Bard|2|3|Whenever Totentanz, Swarm Piper or another nontoken creature you control dies, create a 1/1 black Rat creature token with "This creature can't block."${1}{B}: Target attacking Rat you control gains deathtouch until end of turn.| -Troyan, Gutsy Explorer|Wilds of Eldraine|217|U|{1}{G}{U}|Legendary Creature - Vedalken Scout|1|3|{T}: Add {G}{U}. Spend this mana only to cast spells with mana value 5 or greater or spells with X in their mana costs.${Y}, {T}: Draw a card, then discard a card.| +Troyan, Gutsy Explorer|Wilds of Eldraine|217|U|{1}{G}{U}|Legendary Creature - Vedalken Scout|1|3|{T}: Add {G}{U}. Spend this mana only to cast spells with mana value 5 or greater or spells with X in their mana costs.${U}, {T}: Draw a card, then discard a card.| Will, Scion of Peace|Wilds of Eldraine|218|M|{1}{W}{U}|Legendary Creature - Human Wizard|2|4|Vigilance${T}: Spells you cast this turn that are white and/or blue cost X less to cast, where X is the amount of life you gained this turn. Activate only as a sorcery.| Beluna Grandsquall|Wilds of Eldraine|220|M|{G}{U}{R}|Legendary Creature - Giant Noble|4|4|Trample$Permanent spells you cast have an Adventure cost {1} less to cast.| Seek Thrills|Wilds of Eldraine|220|M|{2}{G}{U}{R}|Instant - Adventure|4|4|Mill seven cards. Then put all cards that have an Adventure from among the milled cards into your hand.|