From 2c286a0d6dd3197a71bb74ed8fcf3710cd11f3f0 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 10 Jul 2025 17:25:59 -0400 Subject: [PATCH] [EOE] Implement Bioengineered Future --- .../src/mage/cards/b/BioengineeredFuture.java | 144 ++++++++++++++++++ Mage.Sets/src/mage/sets/EdgeOfEternities.java | 1 + 2 files changed, 145 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BioengineeredFuture.java diff --git a/Mage.Sets/src/mage/cards/b/BioengineeredFuture.java b/Mage.Sets/src/mage/cards/b/BioengineeredFuture.java new file mode 100644 index 00000000000..c6bc5fe3a0d --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BioengineeredFuture.java @@ -0,0 +1,144 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.Hint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.WatcherScope; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.LanderToken; +import mage.util.CardUtil; +import mage.watchers.Watcher; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BioengineeredFuture extends CardImpl { + + public BioengineeredFuture(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); + + // When this enchantment enters, create a Lander token. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new LanderToken()))); + + // Each creature you control enters with an additional +1/+1 counter on it for each land that entered the battlefield under your control this turn. + this.addAbility(new SimpleStaticAbility(new BioengineeredFutureEffect()) + .addHint(BioengineeredFutureHint.instance), new BioengineeredFutureWatcher()); + } + + private BioengineeredFuture(final BioengineeredFuture card) { + super(card); + } + + @Override + public BioengineeredFuture copy() { + return new BioengineeredFuture(this); + } +} + +class BioengineeredFutureEffect extends ReplacementEffectImpl { + + BioengineeredFutureEffect() { + super(Duration.WhileOnBattlefield, Outcome.BoostCreature); + staticText = "each creature you control enters with an additional +1/+1 counter on it " + + "for each land that entered the battlefield under your control this turn"; + } + + private BioengineeredFutureEffect(final BioengineeredFutureEffect effect) { + super(effect); + } + + @Override + public BioengineeredFutureEffect copy() { + return new BioengineeredFutureEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); + return permanent != null + && permanent.isControlledBy(source.getControllerId()) + && permanent.isCreature(game); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); + int count = BioengineeredFutureWatcher.getCount(game, source); + if (creature != null && count > 0) { + creature.addCounters( + CounterType.P1P1.createInstance(count), source.getControllerId(), + source, game, event.getAppliedEffects() + ); + } + return false; + } +} + +class BioengineeredFutureWatcher extends Watcher { + + private final Map map = new HashMap<>(); + + BioengineeredFutureWatcher() { + super(WatcherScope.GAME); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { + return; + } + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); + if (permanent != null && permanent.isLand(game)) { + map.compute(permanent.getControllerId(), CardUtil::setOrIncrementValue); + } + } + + @Override + public void reset() { + super.reset(); + map.clear(); + } + + static int getCount(Game game, Ability source) { + return game + .getState() + .getWatcher(BioengineeredFutureWatcher.class) + .map + .getOrDefault(source.getControllerId(), 0); + } +} + +enum BioengineeredFutureHint implements Hint { + instance; + + @Override + public String getText(Game game, Ability ability) { + return "Lands that entered under your control this turn: " + BioengineeredFutureWatcher.getCount(game, ability); + } + + @Override + public Hint copy() { + return this; + } +} diff --git a/Mage.Sets/src/mage/sets/EdgeOfEternities.java b/Mage.Sets/src/mage/sets/EdgeOfEternities.java index 8e8a5c88bb1..7b92d13643c 100644 --- a/Mage.Sets/src/mage/sets/EdgeOfEternities.java +++ b/Mage.Sets/src/mage/sets/EdgeOfEternities.java @@ -41,6 +41,7 @@ public final class EdgeOfEternities extends ExpansionSet { cards.add(new SetCardInfo("Astelli Reclaimer", 288, Rarity.RARE, mage.cards.a.AstelliReclaimer.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Astelli Reclaimer", 4, Rarity.RARE, mage.cards.a.AstelliReclaimer.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Banishing Light", 6, Rarity.COMMON, mage.cards.b.BanishingLight.class)); + cards.add(new SetCardInfo("Bioengineered Future", 340, Rarity.RARE, mage.cards.b.BioengineeredFuture.class)); cards.add(new SetCardInfo("Biotech Specialist", 214, Rarity.RARE, mage.cards.b.BiotechSpecialist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Biotech Specialist", 347, Rarity.RARE, mage.cards.b.BiotechSpecialist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Breeding Pool", 251, Rarity.RARE, mage.cards.b.BreedingPool.class, NON_FULL_USE_VARIOUS));