diff --git a/Mage.Sets/src/mage/cards/s/ShantottoTacticianMagician.java b/Mage.Sets/src/mage/cards/s/ShantottoTacticianMagician.java new file mode 100644 index 00000000000..1c87eaab586 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/ShantottoTacticianMagician.java @@ -0,0 +1,102 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.util.CardUtil; +import mage.watchers.common.ManaPaidSourceWatcher; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ShantottoTacticianMagician extends CardImpl { + + public ShantottoTacticianMagician(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.DWARF); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Whenever you cast a noncreature spell, Shantotto, Tactician Magician gets +X/+0 until end of turn, where X is the amount of mana spent to cast that spell. If X is 4 or greater, draw a card. + Ability ability = new SpellCastControllerTriggeredAbility(new BoostSourceEffect( + ShantottoTacticianMagicianValue.instance, + StaticValue.get(0), Duration.EndOfTurn + ), StaticFilters.FILTER_SPELL_A_NON_CREATURE, false); + ability.addEffect(new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(1), + ShantottoTacticianMagicianCondition.instance, + "If X is 4 or greater, draw a card" + )); + this.addAbility(ability); + } + + private ShantottoTacticianMagician(final ShantottoTacticianMagician card) { + super(card); + } + + @Override + public ShantottoTacticianMagician copy() { + return new ShantottoTacticianMagician(this); + } +} + +enum ShantottoTacticianMagicianValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return Optional + .ofNullable((Spell) effect.getValue("spellCast")) + .map(spell -> ManaPaidSourceWatcher.getTotalPaid(spell.getId(), game)) + .orElse(0); + } + + @Override + public ShantottoTacticianMagicianValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the amount of mana spent to cast that spell"; + } + + @Override + public String toString() { + return "X"; + } +} + +enum ShantottoTacticianMagicianCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return CardUtil + .getEffectValueFromAbility(source, "spellCast", Spell.class) + .map(spell -> ManaPaidSourceWatcher.getTotalPaid(spell.getId(), game) >= 4) + .orElse(false); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasy.java b/Mage.Sets/src/mage/sets/FinalFantasy.java index 6655c657243..354022fcc0e 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasy.java +++ b/Mage.Sets/src/mage/sets/FinalFantasy.java @@ -37,6 +37,7 @@ public final class FinalFantasy extends ExpansionSet { cards.add(new SetCardInfo("Jumbo Cactuar", 191, Rarity.RARE, mage.cards.j.JumboCactuar.class)); cards.add(new SetCardInfo("Sazh's Chocobo", 200, Rarity.UNCOMMON, mage.cards.s.SazhsChocobo.class)); cards.add(new SetCardInfo("Sephiroth, Planet's Heir", 553, Rarity.MYTHIC, mage.cards.s.SephirothPlanetsHeir.class)); + cards.add(new SetCardInfo("Shantotto, Tactician Magician", 241, Rarity.UNCOMMON, mage.cards.s.ShantottoTacticianMagician.class)); cards.add(new SetCardInfo("Shinryu, Transcendent Rival", 127, Rarity.RARE, mage.cards.s.ShinryuTranscendentRival.class)); cards.add(new SetCardInfo("Sidequest: Catch a Fish", 31, Rarity.UNCOMMON, mage.cards.s.SidequestCatchAFish.class)); cards.add(new SetCardInfo("Sin, Spira's Punishment", 242, Rarity.RARE, mage.cards.s.SinSpirasPunishment.class, NON_FULL_USE_VARIOUS)); diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 150f4f4c835..8bfb7cfe0d1 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -57203,6 +57203,7 @@ Hades, Sorcerer of Eld|Final Fantasy|218|M||Legendary Creature - Avatar|6|6|Vigi Garland, Knight of Cornelia|Final Fantasy|221|U|{B}{R}|Legendary Creature - Human Knight|3|2|Whenever you cast a noncreature spell, surveil 1.${3}{B}{B}{R}{R}: Return this card from your graveyard to the battlefield transformed. Activate only as a sorcery.| Chaos, the Endless|Final Fantasy|221|U||Legendary Creature - Demon|5|5|Flying$When Chaos dies, put it on the bottom of its owner's library.| Gladiolus Amicitia|Final Fantasy|224|U|{4}{R}{G}|Legendary Creature - Human Warrior|6|6|When Gladiolus Amicitia enters, search your library for a land card, put it onto the battlefield tapped, then shuffle.$Landfall -- Whenever a land you control enters, another target creature you control gets +2/+2 and gains trample until end of turn.| +Shantotto, Tactician Magician|Final Fantasy|241|U|{1}{U}{R}|Legendary Creature - Dwarf Wizard|0|4|Whenever you cast a non-creature spell, Shantotto, Tactician Magician gets +X/+0 until end of turn where X is the amount of mana spent to cast that spell. If X is 4 or greater, draw a card.| Sin, Spira's Punishment|Final Fantasy|242|R|{4}{B}{G}{U}|Legendary Creature - Leviathan Avatar|7|7|Flying$Whenever Sin enters or attacks, exile a permanent card from your graveyard at random, then create a tapped token that's a copy of that card. If the exiled card is a land card, repeat this process.| Ultimecia, Time Sorceress|Final Fantasy|247|U|{3}{U}{B}|Legendary Creature - Human Warlock|4|5|Whenever Ultimecia enters or attacks, surveil 2.$At the beginning of your end step, you may pay {4}{U}{U}{B}{B} and exile eight cards from your graveyard. If you do, transform Ultimecia.| Ultimecia, Omnipotent|Final Fantasy|247|U||Legendary Creature - Nightmare Warlock|7|7|Menace$Time Compression -- When this creature transforms into Ultimecia, Omnipotent, take an extra turn after this one.|