From f3ed03fe4e70255ac10ac3651a84e4189aa1ba3e Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 23 May 2025 16:45:42 -0400 Subject: [PATCH] [FIN] Implement Tellah, Great Sage --- .../src/mage/cards/t/TellahGreatSage.java | 120 ++++++++++++++++++ Mage.Sets/src/mage/sets/FinalFantasy.java | 3 + 2 files changed, 123 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TellahGreatSage.java diff --git a/Mage.Sets/src/mage/cards/t/TellahGreatSage.java b/Mage.Sets/src/mage/cards/t/TellahGreatSage.java new file mode 100644 index 00000000000..56f7345aeef --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TellahGreatSage.java @@ -0,0 +1,120 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.TargetController; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.HeroToken; +import mage.game.stack.Spell; +import mage.util.CardUtil; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TellahGreatSage extends CardImpl { + + public TellahGreatSage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever you cast a noncreature spell, create a 1/1 colorless Hero creature token. If four or more mana was spent to cast that spell, draw two cards. If eight or more mana was spent to cast that spell, sacrifice Tellah and it deals that much damage to each opponent. + Ability ability = new SpellCastControllerTriggeredAbility( + new CreateTokenEffect(new HeroToken()), StaticFilters.FILTER_SPELL_A_NON_CREATURE, false + ); + ability.addEffect(new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(2), TellahGreatSageCondition.FOUR, + "If four or more mana was spent to cast that spell, draw two cards" + )); + ability.addEffect(new ConditionalOneShotEffect( + new SacrificeSourceEffect(), TellahGreatSageCondition.EIGHT, + "If eight or more mana was spent to cast that spell, " + + "sacrifice {this} and it deals that much damage to each opponent" + ).addEffect(new DamagePlayersEffect(TellahGreatSageValue.instance, TargetController.OPPONENT))); + this.addAbility(ability); + } + + private TellahGreatSage(final TellahGreatSage card) { + super(card); + } + + @Override + public TellahGreatSage copy() { + return new TellahGreatSage(this); + } +} + +enum TellahGreatSageCondition implements Condition { + FOUR(4), + EIGHT(8); + private final int amount; + + TellahGreatSageCondition(int amount) { + this.amount = amount; + } + + @Override + public boolean apply(Game game, Ability source) { + return CardUtil + .getEffectValueFromAbility(source, "spellCast", Spell.class) + .map(Spell::getStackAbility) + .map(Ability::getManaCostsToPay) + .map(ManaCost::getUsedManaToPay) + .map(Mana::count) + .orElse(0) >= amount; + } +} + +enum TellahGreatSageValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return Optional + .ofNullable((Spell) effect.getValue("spellCast")) + .map(Spell::getStackAbility) + .map(Ability::getManaCostsToPay) + .map(ManaCost::getUsedManaToPay) + .map(Mana::count) + .orElse(0); + } + + @Override + public TellahGreatSageValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasy.java b/Mage.Sets/src/mage/sets/FinalFantasy.java index d6bca6532bf..cf5a38b808e 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasy.java +++ b/Mage.Sets/src/mage/sets/FinalFantasy.java @@ -397,6 +397,9 @@ public final class FinalFantasy extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 302, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Swamp", 574, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Syncopate", 80, Rarity.COMMON, mage.cards.s.Syncopate.class)); + cards.add(new SetCardInfo("Tellah, Great Sage", 244, Rarity.RARE, mage.cards.t.TellahGreatSage.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Tellah, Great Sage", 349, Rarity.RARE, mage.cards.t.TellahGreatSage.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Tellah, Great Sage", 510, Rarity.RARE, mage.cards.t.TellahGreatSage.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Terra, Magical Adept", 245, Rarity.MYTHIC, mage.cards.t.TerraMagicalAdept.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Terra, Magical Adept", 323, Rarity.MYTHIC, mage.cards.t.TerraMagicalAdept.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Terra, Magical Adept", 511, Rarity.MYTHIC, mage.cards.t.TerraMagicalAdept.class, NON_FULL_USE_VARIOUS));