From 512965c9f58f7a0e96500ed4e6fcaaad386222b4 Mon Sep 17 00:00:00 2001 From: matoro <12038583+matoro@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:26:06 -0500 Subject: [PATCH] [DSC] Implement Zimone's Hypothesis (#14296) --- .../src/mage/cards/z/ZimonesHypothesis.java | 112 ++++++++++++++++++ .../sets/DuskmournHouseOfHorrorCommander.java | 1 + .../mageobject/PowerParityPredicate.java | 29 +++++ 3 files changed, 142 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/z/ZimonesHypothesis.java create mode 100644 Mage/src/main/java/mage/filter/predicate/mageobject/PowerParityPredicate.java diff --git a/Mage.Sets/src/mage/cards/z/ZimonesHypothesis.java b/Mage.Sets/src/mage/cards/z/ZimonesHypothesis.java new file mode 100644 index 00000000000..6e9187e8299 --- /dev/null +++ b/Mage.Sets/src/mage/cards/z/ZimonesHypothesis.java @@ -0,0 +1,112 @@ +package mage.cards.z; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerParityPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author matoro + * Based on initial version by werhsdnas + */ +public final class ZimonesHypothesis extends CardImpl { + + public ZimonesHypothesis(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}"); + + // You may put a +1/+1 counter on a creature. + this.getSpellAbility().addEffect(new ZimonesHypothesisCounterEffect()); + + //Then choose odd or even. Return each creature with power of the chosen quality to its owner’s hand. + this.getSpellAbility().addEffect(new ZimonesHypothesisBounceEffect()); + } + + private ZimonesHypothesis(final ZimonesHypothesis card) { + super(card); + } + + @Override + public ZimonesHypothesis copy() { + return new ZimonesHypothesis(this); + } +} + +class ZimonesHypothesisCounterEffect extends OneShotEffect { + + ZimonesHypothesisCounterEffect() { + super(Outcome.BoostCreature); + this.staticText = "You may put a +1/+1 counter on a creature."; + } + + private ZimonesHypothesisCounterEffect(final ZimonesHypothesisCounterEffect effect) { + super(effect); + } + + @Override + public ZimonesHypothesisCounterEffect copy() { + return new ZimonesHypothesisCounterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + final Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + final Target target = new TargetCreaturePermanent(0, 1).withNotTarget(true); + player.choose(this.outcome, target, source, game); + final Permanent permanent = game.getPermanent(target.getFirstTarget()); + return permanent != null && permanent.addCounters(CounterType.P1P1.createInstance(), source, game); + } +} + +class ZimonesHypothesisBounceEffect extends OneShotEffect { + + private static final FilterPermanent evenFilter = new FilterCreaturePermanent(); + private static final FilterPermanent oddFilter = new FilterCreaturePermanent(); + + static { + evenFilter.add(PowerParityPredicate.EVEN); + oddFilter.add(PowerParityPredicate.ODD); + } + + ZimonesHypothesisBounceEffect() { + super(Outcome.ReturnToHand); + this.staticText = "
Then choose odd or even. Return each creature with power of the chosen quality to its owner's hand. (Zero is even.)"; + } + + private ZimonesHypothesisBounceEffect(final ZimonesHypothesisBounceEffect effect) { + super(effect); + } + + @Override + public ZimonesHypothesisBounceEffect copy() { + return new ZimonesHypothesisBounceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + final Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + final FilterPermanent filter = player.chooseUse(this.outcome, "Odd or even?", null, "Odd", "Even", source, game) ? oddFilter : evenFilter; + return new ReturnToHandFromBattlefieldAllEffect(filter).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java index 1dad64f44fb..f6525a8f68e 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java @@ -348,5 +348,6 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet { cards.add(new SetCardInfo("Yavimaya Elder", 208, Rarity.COMMON, mage.cards.y.YavimayaElder.class)); cards.add(new SetCardInfo("Yedora, Grave Gardener", 209, Rarity.UNCOMMON, mage.cards.y.YedoraGraveGardener.class)); cards.add(new SetCardInfo("Zimone, Mystery Unraveler", 8, Rarity.MYTHIC, mage.cards.z.ZimoneMysteryUnraveler.class)); + cards.add(new SetCardInfo("Zimone's Hypothesis", 15, Rarity.RARE, mage.cards.z.ZimonesHypothesis.class)); } } diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/PowerParityPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/PowerParityPredicate.java new file mode 100644 index 00000000000..36ac73b5184 --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/PowerParityPredicate.java @@ -0,0 +1,29 @@ +package mage.filter.predicate.mageobject; + +import mage.MageObject; +import mage.filter.predicate.Predicate; +import mage.game.Game; + +/** + * @author matoro + * Based on initial version by werhsdnas + */ +public enum PowerParityPredicate implements Predicate { + EVEN(0), + ODD(1); + private final int parity; + + PowerParityPredicate(int parity) { + this.parity = parity; + } + + @Override + public boolean apply(MageObject input, Game game) { + return input.getPower().getValue() % 2 == parity; + } + + @Override + public String toString() { + return "PowerParity" + super.toString(); + } +}