From 3692e05dac63c5f20c199284ad6ed99f6028971a Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Thu, 23 Mar 2023 01:49:42 +0000 Subject: [PATCH] Add zombie count hint to The Scarab God --- Mage.Sets/src/mage/cards/t/TheScarabGod.java | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/t/TheScarabGod.java b/Mage.Sets/src/mage/cards/t/TheScarabGod.java index 0bf88907da..99dbd36672 100644 --- a/Mage.Sets/src/mage/cards/t/TheScarabGod.java +++ b/Mage.Sets/src/mage/cards/t/TheScarabGod.java @@ -11,10 +11,14 @@ import mage.abilities.common.DiesSourceTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenCopyTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -37,6 +41,12 @@ import mage.target.targetpointer.FixedTarget; */ public final class TheScarabGod extends CardImpl { + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.ZOMBIE, "Zombies you control"); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter, null); + private static final Hint hint = new ValueHint( + "Number of Zombies you control", xValue + ); + public TheScarabGod(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}"); @@ -46,7 +56,7 @@ public final class TheScarabGod extends CardImpl { this.toughness = new MageInt(5); // At the beginning of your upkeep, each opponent loses X life and you scry X, where X is the number of Zombies you control. - this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TheScarabGodEffect(), TargetController.YOU, false)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TheScarabGodEffect(xValue), TargetController.YOU, false).addHint(hint)); // {2}{U}{B}: Exile target creature card from a graveyard. Create a token that's a copy of it, except it's a 4/4 black Zombie. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TheScarabGodEffect2(), new ManaCostsImpl<>("{2}{U}{B}")); @@ -69,19 +79,17 @@ public final class TheScarabGod extends CardImpl { class TheScarabGodEffect extends OneShotEffect { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Zombies you control"); + private final DynamicValue numOfZombies; - static { - filter.add(SubType.ZOMBIE.getPredicate()); - } - - public TheScarabGodEffect() { + public TheScarabGodEffect(DynamicValue numOfZombies) { super(Outcome.Benefit); + this.numOfZombies = numOfZombies; staticText = "each opponent loses X life and you scry X, where X is the number of Zombies you control"; } public TheScarabGodEffect(final TheScarabGodEffect effect) { super(effect); + this.numOfZombies = effect.numOfZombies; } @Override @@ -93,8 +101,7 @@ class TheScarabGodEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - int numZombies = game.getBattlefield().countAll(filter, source.getControllerId(), game); - + int numZombies = numOfZombies.calculate(game, source, this); if (numZombies > 0) { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(playerId);