diff --git a/Mage.Sets/src/mage/cards/a/AgentOfMasks.java b/Mage.Sets/src/mage/cards/a/AgentOfMasks.java index 752c9a4cfa7..274696934b9 100644 --- a/Mage.Sets/src/mage/cards/a/AgentOfMasks.java +++ b/Mage.Sets/src/mage/cards/a/AgentOfMasks.java @@ -1,7 +1,5 @@ - package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; @@ -14,18 +12,19 @@ import mage.constants.SubType; import mage.constants.TargetController; import mage.game.Game; +import java.util.UUID; + /** - * * @author Loki */ public final class AgentOfMasks extends CardImpl { public AgentOfMasks(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{B}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.ADVISOR); - + // At the beginning of your upkeep, each opponent loses 1 life. You gain life equal to the life lost this way. this.power = new MageInt(2); this.toughness = new MageInt(3); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AgentOfMasksEffect(), TargetController.YOU, false)); diff --git a/Mage.Sets/src/mage/cards/s/SphinxOfTheSecondSun.java b/Mage.Sets/src/mage/cards/s/SphinxOfTheSecondSun.java index b0c9183803a..5a929f62ff0 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxOfTheSecondSun.java +++ b/Mage.Sets/src/mage/cards/s/SphinxOfTheSecondSun.java @@ -30,7 +30,7 @@ public final class SphinxOfTheSecondSun extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - // At the beginning of your postcombat main phase, you get an additional beginning phase after this phase. + // At the beginning of your postcombat main phase, you get an additional beginning phase after this phase. (The beginning phase includes the untap, upkeep, and draw steps.) this.addAbility(new BeginningOfPostCombatMainTriggeredAbility( new SphinxOfTheSecondSunEffect(), TargetController.YOU, false ), new SphinxOfTheSecondSunWatcher()); @@ -50,7 +50,7 @@ class SphinxOfTheSecondSunEffect extends OneShotEffect { SphinxOfTheSecondSunEffect() { super(Outcome.Benefit); - staticText = "you get an additional beginning phase after this phase"; + staticText = "you get an additional beginning phase after this phase. (The beginning phase includes the untap, upkeep, and draw steps.)"; } private SphinxOfTheSecondSunEffect(final SphinxOfTheSecondSunEffect effect) { @@ -74,9 +74,9 @@ class SphinxOfTheSecondSunEffect extends OneShotEffect { break; } } - TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.POSTCOMBAT_MAIN, turnPhase, false); - combat.setNote("sphinxSecondSun"); - game.getState().getTurnMods().add(combat); + TurnMod newPhase = new TurnMod(source.getControllerId(), TurnPhase.BEGINNING, turnPhase, false); + newPhase.setNote("sphinxSecondSun"); + game.getState().getTurnMods().add(newPhase); return true; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/SphinxOfTheSecondSunTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/SphinxOfTheSecondSunTest.java new file mode 100644 index 00000000000..6e8e4f71a01 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/cmr/SphinxOfTheSecondSunTest.java @@ -0,0 +1,57 @@ +package org.mage.test.cards.single.cmr; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author JayDi85 + */ + +public class SphinxOfTheSecondSunTest extends CardTestPlayerBase { + + @Test + public void test_Playable_OneCard() { + // bug: card generating infinite amount of extra steps + + // At the beginning of your postcombat main phase, you get an additional beginning phase after this phase. + // (The beginning phase includes the untap, upkeep, and draw steps.) + addCard(Zone.BATTLEFIELD, playerA, "Sphinx of the Second Sun", 1); + // + // At the beginning of your upkeep, each opponent loses 1 life. You gain life equal to the life lost this way. + addCard(Zone.BATTLEFIELD, playerA, "Agent of Masks", 1); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + // 2x upkeep phases (1x normal + 1x from sphinx) + assertLife(playerA, 20 + 2); + assertLife(playerB, 20 - 2); + } + + @Test + public void test_Playable_TwoCards() { + // bug: card generating infinite amount of extra steps + + // At the beginning of your postcombat main phase, you get an additional beginning phase after this phase. + // (The beginning phase includes the untap, upkeep, and draw steps.) + addCard(Zone.BATTLEFIELD, playerA, "Sphinx of the Second Sun", 2); + // + // At the beginning of your upkeep, each opponent loses 1 life. You gain life equal to the life lost this way. + addCard(Zone.BATTLEFIELD, playerA, "Agent of Masks", 1); + + setChoice(playerA, "At the beginning"); // 2x triggers + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + // 3x upkeep phases (1x normal + 2x from sphinx) + assertLife(playerA, 20 + 3); + assertLife(playerB, 20 - 3); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index f8bf0274a1f..6d82a11a4df 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -1028,7 +1028,7 @@ public class TestPlayer implements Player { if (numberOfActions == actions.size()) { foundNoAction++; if (foundNoAction > maxCallsWithoutAction) { - throw new AssertionError("More priority calls to " + getName() + throw new AssertionError("Too much priority calls to " + getName() + " without taking any action than allowed (" + maxCallsWithoutAction + ") on turn " + game.getTurnNum()); } } else {