diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java index c19e9c4780..0aec7dc363 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java @@ -27,6 +27,7 @@ */ package org.mage.test.cards.abilities.keywords; +import mage.abilities.keyword.IndestructibleAbility; import mage.constants.CardType; import mage.constants.PhaseStep; import mage.constants.Zone; @@ -321,4 +322,20 @@ public class TransformTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Avacyn, the Purifier", 0); assertPermanentCount(playerA, "Archangel Avacyn", 1); } + + /** + * Cards that transform if no spells cast last turn should not transform if the cards were added on turn 1. + * This would happen with tests and cheat testing. + */ + @Test + public void testNoSpellsCastLastTurnTransformDoesNotTriggerTurn1() { + + // At the beginning of each upkeep, if no spells were cast last turn, transform Hinterland Logger. + addCard(Zone.BATTLEFIELD, playerA, "Hinterland Logger"); + + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); + execute(); + + assertPermanentCount(playerA, "Hinterland Logger", 1); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/SurviveTheNightTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/SurviveTheNightTest.java index 02892bb8f2..d96af683aa 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/SurviveTheNightTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/SurviveTheNightTest.java @@ -21,21 +21,21 @@ public class SurviveTheNightTest extends CardTestPlayerBase { // Investigate addCard(Zone.HAND, playerA, "Survive the Night"); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); - addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable"); // 2/1 - addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // 3/3 - - attack(1, playerA, "Bronze Sable"); - block(1, playerB, "Hill Giant", "Bronze Sable"); - castSpell(1, PhaseStep.DECLARE_BLOCKERS, playerA, "Survive the Night", "Bronze Sable"); - - setStopAt(1, PhaseStep.END_COMBAT); + addCard(Zone.BATTLEFIELD, playerA, "Hinterland Logger"); // 2/1 + addCard(Zone.BATTLEFIELD, playerB, "Bloodbriar"); // 2/3 + + attack(1, playerA, "Hinterland Logger"); + block(1, playerB, "Bloodbriar", "Hinterland Logger"); + castSpell(1, PhaseStep.DECLARE_BLOCKERS, playerA, "Survive the Night", "Hinterland Logger"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); execute(); - + assertGraveyardCount(playerA, "Survive the Night", 1); - assertGraveyardCount(playerB, "Hill Giant", 1); + assertGraveyardCount(playerB, "Bloodbriar", 1); assertPermanentCount(playerA, "Clue", 1); - assertPermanentCount(playerA, "Bronze Sable", 1); - assertPowerToughness(playerA, "Bronze Sable", 3, 1); - assertAbility(playerA, "Bronze Sable", IndestructibleAbility.getInstance(), true); + assertPermanentCount(playerA, "Hinterland Logger", 1); + assertPowerToughness(playerA, "Hinterland Logger", 3, 1); + assertAbility(playerA, "Hinterland Logger", IndestructibleAbility.getInstance(), true); } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java b/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java index 345e18ce59..d721c0e030 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java @@ -45,6 +45,12 @@ public class NoSpellsWereCastLastTurnCondition implements Condition { @Override public boolean apply(Game game, Ability source) { + // Do not check at start of game. + // Needed for tests to keep add to battlefield cards setting off condition when not intended. + if (game.getTurnNum() < 2) { + return false; + } + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); // if any player cast spell, return false for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) { @@ -52,7 +58,8 @@ public class NoSpellsWereCastLastTurnCondition implements Condition { return false; } } - // no one cast spell this turn + + // no one cast spell last turn return true; } }