mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
Merge pull request #2189 from JOAC69/master
No spells cast last turn transform fix to not transform turn 1 #2188
This commit is contained in:
commit
0ffeb2d5b6
3 changed files with 38 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Hinterland Logger"); // 2/1
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Bloodbriar"); // 2/3
|
||||
|
||||
attack(1, playerA, "Bronze Sable");
|
||||
block(1, playerB, "Hill Giant", "Bronze Sable");
|
||||
castSpell(1, PhaseStep.DECLARE_BLOCKERS, playerA, "Survive the Night", "Bronze Sable");
|
||||
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.END_COMBAT);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue