update Urianger Augurelt to support full cost reduction

This commit is contained in:
jmlundeen 2025-08-15 15:38:47 -05:00
parent b64f1dce45
commit b470f0b679
2 changed files with 88 additions and 9 deletions

View file

@ -6,6 +6,9 @@ import mage.abilities.Ability;
import mage.abilities.common.PlayLandOrCastSpellTriggeredAbility; import mage.abilities.common.PlayLandOrCastSpellTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; 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.AsThoughEffectImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
@ -14,7 +17,6 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.game.Controllable;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -142,14 +144,16 @@ class UriangerAugureltPlayEffect extends AsThoughEffectImpl {
if (card.isLand(game)) { if (card.isLand(game)) {
return true; return true;
} }
// TODO: This should ideally apply the reduction while the spell is being cast because effects that increase the cost apply first Player controller = game.getPlayer(source.getControllerId());
Optional.ofNullable(source) if (controller != null) {
.map(Controllable::getControllerId) ManaCosts<ManaCost> newCost = CardUtil.reduceCost(card.getManaCost(), 2);
.map(game::getPlayer) if (newCost.isEmpty()) {
.ifPresent(player -> player.setCastSourceIdWithAlternateMana( newCost.add(new GenericManaCost(0));
card.getId(), CardUtil.reduceCost(card.getManaCost(), 2), }
null, MageIdentifier.UriangerAugureltAlternateCast controller.setCastSourceIdWithAlternateMana(
)); card.getId(), newCost, null, MageIdentifier.UriangerAugureltAlternateCast
);
}
return true; return true;
} }
} }

View file

@ -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, "<i>Draw Arcanum</i>");
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, "<i>Draw Arcanum</i>");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "<i>Draw Arcanum</i>");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "untap all");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "<i>Draw Arcanum</i>");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "<i>Play Arcanum</i>");
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);
}
}