From 0420d0083610e9b0adbe5a53b37720b1c20bd0e2 Mon Sep 17 00:00:00 2001 From: jmlundeen Date: Sun, 13 Apr 2025 11:00:11 -0500 Subject: [PATCH] [TDC] Implement Steward of the Harvest --- .../src/mage/cards/s/StewardOfTheHarvest.java | 112 ++++++++++++++++++ .../mage/sets/TarkirDragonstormCommander.java | 2 + 2 files changed, 114 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java diff --git a/Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java b/Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java new file mode 100644 index 00000000000..c7c65df84b9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StewardOfTheHarvest.java @@ -0,0 +1,112 @@ +package mage.cards.s; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileCardFromOwnGraveyardControllerEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.StaticFilters; +import mage.filter.common.FilterLandCard; +import mage.game.ExileZone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInYourGraveyard; +import mage.util.CardUtil; + +/** + * + * @author Jmlundeen + */ +public final class StewardOfTheHarvest extends CardImpl { + + private static final FilterLandCard filter = new FilterLandCard("land cards from your graveyard"); + + public StewardOfTheHarvest(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.DRUID); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When this creature enters, exile up to three target land cards from your graveyard. + Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect().setToSourceExileZone(true)); + ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter)); + this.addAbility(ability); + + // Creatures you control have all activated abilities of all land cards exiled with this creature. + this.addAbility(new SimpleStaticAbility(new StewardOfTheHarvestEffect())); + } + + private StewardOfTheHarvest(final StewardOfTheHarvest card) { + super(card); + } + + @Override + public StewardOfTheHarvest copy() { + return new StewardOfTheHarvest(this); + } +} + +class StewardOfTheHarvestEffect extends ContinuousEffectImpl { + + List abilities = new ArrayList<>(); + ExileZone lastZone; + + public StewardOfTheHarvestEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + staticText = "Creatures you control have all activated abilities of all land cards exiled with this creature."; + } + + private StewardOfTheHarvestEffect(StewardOfTheHarvestEffect effect) { + super(effect); + this.abilities = effect.abilities; + this.lastZone = effect.lastZone; + } + + @Override + public StewardOfTheHarvestEffect copy() { + return new StewardOfTheHarvestEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), CardUtil.getActualSourceObjectZoneChangeCounter(game, source)); + ExileZone exile = game.getExile().getExileZone(exileId); + if (exile != null) { + lastZone = exile; + if (abilities.isEmpty()) { + exile.getCards(game).stream() + .map(card -> card.getAbilities(game)) + .flatMap(List::stream) + .filter(ability -> ability instanceof ActivatedAbility) + .forEach(ability -> abilities.add(ability)); + } + } + else { + abilities.clear(); + if (lastZone != null) { + lastZone.getCards(game).forEach(card -> game.getExile().moveToMainExileZone(card, game)); + } + } + + List creatures = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURE, source.getControllerId(), source, game); + for (Ability ability : abilities) { + for (Permanent creature : creatures) { + creature.addAbility(ability, source.getSourceId(), game); + } + } + return true; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java b/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java index c7db37256c8..c7a9a48c4f2 100644 --- a/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java +++ b/Mage.Sets/src/mage/sets/TarkirDragonstormCommander.java @@ -302,6 +302,8 @@ public final class TarkirDragonstormCommander extends ExpansionSet { cards.add(new SetCardInfo("Springbloom Druid", 271, Rarity.COMMON, mage.cards.s.SpringbloomDruid.class)); cards.add(new SetCardInfo("Staff of Compleation", 326, Rarity.MYTHIC, mage.cards.s.StaffOfCompleation.class)); cards.add(new SetCardInfo("Steel Hellkite", 327, Rarity.RARE, mage.cards.s.SteelHellkite.class)); + cards.add(new SetCardInfo("Steward of the Harvest", 48, Rarity.RARE, mage.cards.s.StewardOfTheHarvest.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Steward of the Harvest", 88, Rarity.RARE, mage.cards.s.StewardOfTheHarvest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Stitcher's Supplier", 196, Rarity.UNCOMMON, mage.cards.s.StitchersSupplier.class)); cards.add(new SetCardInfo("Storm's Wrath", 236, Rarity.RARE, mage.cards.s.StormsWrath.class)); cards.add(new SetCardInfo("Storm-Kiln Artist", 235, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class));