From c4754936f558b856e9a5df11c7cda2f9d6ddb89b Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 19 Apr 2021 18:27:41 -0400 Subject: [PATCH] [C21] Implemented Sproutback Trudge --- .../src/mage/cards/s/SproutbackTrudge.java | 96 +++++++++++++++++++ .../src/mage/sets/Commander2021Edition.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SproutbackTrudge.java diff --git a/Mage.Sets/src/mage/cards/s/SproutbackTrudge.java b/Mage.Sets/src/mage/cards/s/SproutbackTrudge.java new file mode 100644 index 00000000000..bfe4f60e541 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SproutbackTrudge.java @@ -0,0 +1,96 @@ +package mage.cards.s; + +import mage.ApprovingObject; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.YouGainedLifeCondition; +import mage.abilities.dynamicvalue.common.ControllerGotLifeCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.PlayerGainedLifeWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SproutbackTrudge extends CardImpl { + + private static final Condition condition = new YouGainedLifeCondition(ComparisonType.MORE_THAN, 0); + + public SproutbackTrudge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{7}{G}{G}"); + + this.subtype.add(SubType.FUNGUS); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(9); + this.toughness = new MageInt(7); + + // This spell costs {X} less to cast, where X is the amount of life you gained this turn. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(ControllerGotLifeCount.instance) + ).addHint(ControllerGotLifeCount.getHint()).setRuleAtTheTop(true), new PlayerGainedLifeWatcher()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // At the beginning of your end step, if you gained life this turn, you may cast Sproutback Trudge from your graveyard. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + Zone.GRAVEYARD, new SproutbackTrudgeEffect(), TargetController.YOU, condition, true + )); + } + + private SproutbackTrudge(final SproutbackTrudge card) { + super(card); + } + + @Override + public SproutbackTrudge copy() { + return new SproutbackTrudge(this); + } +} + +class SproutbackTrudgeEffect extends OneShotEffect { + + SproutbackTrudgeEffect() { + super(Outcome.Benefit); + staticText = "cast {this} from your graveyard"; + } + + private SproutbackTrudgeEffect(final SproutbackTrudgeEffect effect) { + super(effect); + } + + @Override + public SproutbackTrudgeEffect copy() { + return new SproutbackTrudgeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObjectIfItStillExists(game); + if (player == null || !(sourceObject instanceof Card)) { + return false; + } + Card card = (Card) sourceObject; + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + player.cast( + player.chooseAbilityForCast(card, game, false), + game, false, new ApprovingObject(source, game) + ); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 071548c4ec0..9a81f214983 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -275,6 +275,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Spawning Kraken", 33, Rarity.RARE, mage.cards.s.SpawningKraken.class)); cards.add(new SetCardInfo("Spectral Searchlight", 265, Rarity.UNCOMMON, mage.cards.s.SpectralSearchlight.class)); cards.add(new SetCardInfo("Spitting Image", 229, Rarity.RARE, mage.cards.s.SpittingImage.class)); + cards.add(new SetCardInfo("Sproutback Trudge", 68, Rarity.RARE, mage.cards.s.SproutbackTrudge.class)); cards.add(new SetCardInfo("Stalking Leonin", 105, Rarity.RARE, mage.cards.s.StalkingLeonin.class)); cards.add(new SetCardInfo("Steel Hellkite", 266, Rarity.RARE, mage.cards.s.SteelHellkite.class)); cards.add(new SetCardInfo("Steel Overseer", 267, Rarity.RARE, mage.cards.s.SteelOverseer.class));