From 0b796ea2762ae306ed5be941f2811b46ddc60cfa Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 31 Oct 2025 09:15:10 -0400 Subject: [PATCH] [TLA] Implement Toph, Earthbending Master --- .../mage/cards/t/TophEarthbendingMaster.java | 58 +++++++++++++++++++ .../sets/AvatarTheLastAirbenderEternal.java | 1 + .../common/CountersControllerCount.java | 2 +- .../keyword/EarthbendTargetEffect.java | 32 +++++++--- 4 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/t/TophEarthbendingMaster.java diff --git a/Mage.Sets/src/mage/cards/t/TophEarthbendingMaster.java b/Mage.Sets/src/mage/cards/t/TophEarthbendingMaster.java new file mode 100644 index 00000000000..40e3ace50f1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TophEarthbendingMaster.java @@ -0,0 +1,58 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksWithCreaturesTriggeredAbility; +import mage.abilities.common.LandfallAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.CountersControllerCount; +import mage.abilities.effects.common.counter.AddCountersPlayersEffect; +import mage.abilities.effects.keyword.EarthbendTargetEffect; +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.counters.CounterType; +import mage.target.common.TargetControlledLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TophEarthbendingMaster extends CardImpl { + + private static final DynamicValue xValue = new CountersControllerCount(CounterType.EXPERIENCE); + + public TophEarthbendingMaster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.subtype.add(SubType.ALLY); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Landfall -- Whenever a land you control enters, you get an experience counter. + this.addAbility(new LandfallAbility(new AddCountersPlayersEffect( + CounterType.EXPERIENCE.createInstance(), TargetController.YOU + ))); + + // Whenever you attack, earthbend X, where X is the number of experience counters you have. + Ability ability = new AttacksWithCreaturesTriggeredAbility(new EarthbendTargetEffect(xValue), 1); + ability.addTarget(new TargetControlledLandPermanent()); + this.addAbility(ability); + } + + private TophEarthbendingMaster(final TophEarthbendingMaster card) { + super(card); + } + + @Override + public TophEarthbendingMaster copy() { + return new TophEarthbendingMaster(this); + } +} diff --git a/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java b/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java index 0c18fe3ff8b..c265cea16af 100644 --- a/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java +++ b/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java @@ -130,6 +130,7 @@ public final class AvatarTheLastAirbenderEternal extends ExpansionSet { cards.add(new SetCardInfo("Thriving Heath", 262, Rarity.COMMON, mage.cards.t.ThrivingHeath.class)); cards.add(new SetCardInfo("Thriving Isle", 263, Rarity.COMMON, mage.cards.t.ThrivingIsle.class)); cards.add(new SetCardInfo("Thriving Moor", 264, Rarity.COMMON, mage.cards.t.ThrivingMoor.class)); + cards.add(new SetCardInfo("Toph, Earthbending Master", 145, Rarity.MYTHIC, mage.cards.t.TophEarthbendingMaster.class)); cards.add(new SetCardInfo("Tundra Wall", 220, Rarity.COMMON, mage.cards.t.TundraWall.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tundra Wall", 275, Rarity.COMMON, mage.cards.t.TundraWall.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Turtle-Seals", 226, Rarity.COMMON, mage.cards.t.TurtleSeals.class)); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersControllerCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersControllerCount.java index c6d6a86826b..0d942a10de0 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersControllerCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersControllerCount.java @@ -48,6 +48,6 @@ public class CountersControllerCount implements DynamicValue { @Override public String getMessage() { - return (counterType != null ? counterType.toString() + ' ' : "") + "counter on {this}'s controller"; + return "the number of " + counterType.getName() + " counters you have"; } } diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/EarthbendTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/EarthbendTargetEffect.java index 9982a5dc7fc..9ed6c95b839 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/EarthbendTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/EarthbendTargetEffect.java @@ -4,6 +4,8 @@ import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.Mode; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; @@ -25,9 +27,13 @@ import mage.util.CardUtil; */ public class EarthbendTargetEffect extends OneShotEffect { - private final int amount; + private final DynamicValue amount; public EarthbendTargetEffect(int amount) { + this(StaticValue.get(amount)); + } + + public EarthbendTargetEffect(DynamicValue amount) { super(Outcome.Benefit); this.amount = amount; } @@ -53,11 +59,12 @@ public class EarthbendTargetEffect extends OneShotEffect { .withAbility(HasteAbility.getInstance()), false, true, Duration.Custom ), source); - permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); + int value = amount.calculate(game, source, this); + permanent.addCounters(CounterType.P1P1.createInstance(value), source, game); game.addDelayedTriggeredAbility(new EarthbendingDelayedTriggeredAbility(permanent, game), source); game.fireEvent(GameEvent.getEvent( GameEvent.EventType.EARTHBENDED, permanent.getId(), - source, source.getControllerId(), amount + source, source.getControllerId(), value )); return true; } @@ -67,10 +74,21 @@ public class EarthbendTargetEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "earthbend " + amount + ". (Target land you control becomes a 0/0 creature " + - "with haste that's still a land. Put " + CardUtil.numberToText(amount, "a") + - " +1/+1 counter" + (amount > 1 ? "s" : "") + " on it. " + - "When it dies or is exiled, return it to the battlefield tapped.)"; + StringBuilder sb = new StringBuilder("earthbend "); + sb.append(amount); + if (!(amount instanceof StaticValue)) { + sb.append(", where X is "); + sb.append(amount.getMessage()); + } + sb.append(". (Target land you control becomes a 0/0 creature with haste that's still a land. Put "); + String value = amount instanceof StaticValue + ? CardUtil.numberToText(((StaticValue) amount).getValue(), "a") + : amount.toString(); + sb.append(value); + sb.append(" +1/+1 counter"); + sb.append(("a".equals(value) ? "" : "s")); + sb.append(" on it. When it dies or is exiled, return it to the battlefield tapped.)"); + return sb.toString(); } }