From bf598d1af2f1c512d68894ecec442722a9fa8d4a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 30 May 2015 00:25:48 +0200 Subject: [PATCH] * Laboratory Maniac - Removed wrong checks that prevented the player to win if his life was below 1 and he drew from an empty libraray. --- .../mage/sets/innistrad/LaboratoryManiac.java | 5 +- .../src/mage/sets/timespiral/AngelsGrace.java | 2 +- .../cards/replacement/WinLoseEffectsTest.java | 51 +++++++++++++++++++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/innistrad/LaboratoryManiac.java b/Mage.Sets/src/mage/sets/innistrad/LaboratoryManiac.java index a5587cda001..ee8f1a919f5 100644 --- a/Mage.Sets/src/mage/sets/innistrad/LaboratoryManiac.java +++ b/Mage.Sets/src/mage/sets/innistrad/LaboratoryManiac.java @@ -113,10 +113,7 @@ class LaboratoryManiacEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getPlayerId().equals(source.getControllerId())) { Player player = game.getPlayer(event.getPlayerId()); - if (!player.hasLost() && ( - (player.getLife() > 0 || !player.canLoseByZeroOrLessLife()) - && player.isEmptyDraw() - && player.getCounters().getCount(CounterType.POISON) < 10)) { + if (player != null && !player.hasLost() && player.isEmptyDraw()) { return true; } } diff --git a/Mage.Sets/src/mage/sets/timespiral/AngelsGrace.java b/Mage.Sets/src/mage/sets/timespiral/AngelsGrace.java index f51413dd1f5..3a7aef912e8 100644 --- a/Mage.Sets/src/mage/sets/timespiral/AngelsGrace.java +++ b/Mage.Sets/src/mage/sets/timespiral/AngelsGrace.java @@ -53,7 +53,7 @@ public class AngelsGrace extends CardImpl { this.expansionSetCode = "TSP"; - // Split second + // Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.) this.addAbility(new SplitSecondAbility()); // You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead. diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java index d7ee8020536..41f230092b2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java @@ -93,4 +93,55 @@ public class WinLoseEffectsTest extends CardTestPlayerBase { assertLife(playerB, 20); } + + @Test + public void testAngelsGrace2() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + addCard(Zone.BATTLEFIELD, playerA, "Island", 4); + // Instant {W} + // You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead. + addCard(Zone.HAND, playerA, "Angel's Grace"); + // Instant - {3}{B}{B} + // Reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost. + // You may repeat this process any number of times. + addCard(Zone.HAND, playerA, "Ad Nauseam"); + + // Creature + // If you would draw a card while your library has no cards in it, you win the game instead. + addCard(Zone.BATTLEFIELD, playerA, "Laboratory Maniac", 1); + + skipInitShuffling(); + + playerA.getLibrary().clear(); + // Instant {U} + // Draw a card. Scry 2 + addCard(Zone.LIBRARY, playerA, "Serum Visions"); // 1 life lost + addCard(Zone.LIBRARY, playerA, "Bogardan Hellkite", 3); // 24 life lost + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Angel's Grace"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ad Nauseam"); + setChoice(playerA, "Yes"); + setChoice(playerA, "Yes"); + setChoice(playerA, "Yes"); + setChoice(playerA, "Yes"); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Serum Visions"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Angel's Grace", 1); + assertGraveyardCount(playerA, "Ad Nauseam", 1); + assertGraveyardCount(playerA, "Serum Visions", 1); + + Assert.assertEquals("Player A library is empty", 0 , playerA.getLibrary().size()); + + assertLife(playerA, -5); + assertLife(playerB, 20); + + Assert.assertTrue("Player A has not won but should have", playerA.hasWon()); + + } }