From b470f0b679708cf1061a315ec43e6c652cd9e44e Mon Sep 17 00:00:00 2001 From: jmlundeen Date: Fri, 15 Aug 2025 15:38:47 -0500 Subject: [PATCH] update Urianger Augurelt to support full cost reduction --- .../src/mage/cards/u/UriangerAugurelt.java | 22 +++--- .../single/fic/UriangerAugureltTest.java | 75 +++++++++++++++++++ 2 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/fic/UriangerAugureltTest.java diff --git a/Mage.Sets/src/mage/cards/u/UriangerAugurelt.java b/Mage.Sets/src/mage/cards/u/UriangerAugurelt.java index df9fcd03c86..b30eaba92de 100644 --- a/Mage.Sets/src/mage/cards/u/UriangerAugurelt.java +++ b/Mage.Sets/src/mage/cards/u/UriangerAugurelt.java @@ -6,6 +6,9 @@ import mage.abilities.Ability; import mage.abilities.common.PlayLandOrCastSpellTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.GainLifeEffect; @@ -14,7 +17,6 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.game.Controllable; import mage.game.Game; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -142,14 +144,16 @@ class UriangerAugureltPlayEffect extends AsThoughEffectImpl { if (card.isLand(game)) { return true; } - // TODO: This should ideally apply the reduction while the spell is being cast because effects that increase the cost apply first - Optional.ofNullable(source) - .map(Controllable::getControllerId) - .map(game::getPlayer) - .ifPresent(player -> player.setCastSourceIdWithAlternateMana( - card.getId(), CardUtil.reduceCost(card.getManaCost(), 2), - null, MageIdentifier.UriangerAugureltAlternateCast - )); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + ManaCosts newCost = CardUtil.reduceCost(card.getManaCost(), 2); + if (newCost.isEmpty()) { + newCost.add(new GenericManaCost(0)); + } + controller.setCastSourceIdWithAlternateMana( + card.getId(), newCost, null, MageIdentifier.UriangerAugureltAlternateCast + ); + } return true; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/fic/UriangerAugureltTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/fic/UriangerAugureltTest.java new file mode 100644 index 00000000000..cf66bcd37fd --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/fic/UriangerAugureltTest.java @@ -0,0 +1,75 @@ +package org.mage.test.cards.single.fic; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + + +public class UriangerAugureltTest extends CardTestPlayerBase { + + private static final String urianger = "Urianger Augurelt"; + private static final String arcaneSignet = "Arcane Signet"; + private static final String howlingMine = "Howling Mine"; + private static final String thoughtVessel = "Thought Vessel"; + private static final String benalishKnight = "Benalish Knight"; + + @Test + public void uriangerAugureltTest() { + setStrictChooseMode(true); + skipInitShuffling(); + removeAllCardsFromLibrary(playerA); + + Ability ability = new SimpleActivatedAbility( + Zone.ALL, + new UntapAllControllerEffect(StaticFilters.FILTER_CONTROLLED_A_CREATURE), + new ManaCostsImpl<>("") + ); + addCustomCardWithAbility("Untap creatures", playerA, ability); + + addCard(Zone.BATTLEFIELD, playerA, urianger); + addCard(Zone.LIBRARY, playerA, "Plains", 3); + addCard(Zone.LIBRARY, playerA, arcaneSignet); + addCard(Zone.LIBRARY, playerA, howlingMine); + addCard(Zone.LIBRARY, playerA, thoughtVessel); + addCard(Zone.LIBRARY, playerA, benalishKnight); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Draw Arcanum"); + setChoice(playerA, true, 4); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Draw Arcanum"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Draw Arcanum"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Draw Arcanum"); + + + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Arcanum"); + waitStackResolved(3, PhaseStep.PRECOMBAT_MAIN); + playLand(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Plains"); + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, benalishKnight, true); + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, arcaneSignet, true); + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, howlingMine, true); + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, thoughtVessel, true); + + setStopAt(3, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, benalishKnight, 1); + assertPermanentCount(playerA, arcaneSignet, 1); + assertPermanentCount(playerA, howlingMine, 1); + assertPermanentCount(playerA, thoughtVessel, 1); + assertLife(playerA, 20 + 2 * 4); + } +}