From 067b72dcce42f252c2666de2c670f4e3d26ad091 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 3 Feb 2017 21:36:33 +0100 Subject: [PATCH] * Added test. --- .../control/GontiLordOfLuxuryEffectTest.java | 50 +++++++++++++++++-- Mage/src/main/java/mage/cards/CardImpl.java | 2 +- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java index f5975fe686d..917d60a429a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java @@ -79,9 +79,11 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Rashmi, Eternities Crafter", 1); } + /** - * Opponent using Gonti, Lord of Luxury took Mirari's Wake out of my library and cast it. - * I cast Cyclonic Rift on Mirari's Wake to put it back in my hand and was unable to recast Mirari's Wake. + * Opponent using Gonti, Lord of Luxury took Mirari's Wake out of my library + * and cast it. I cast Cyclonic Rift on Mirari's Wake to put it back in my + * hand and was unable to recast Mirari's Wake. */ @Test public void testCanBeCastAgainCyclonicRift() { @@ -124,6 +126,48 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { assertPowerToughness(playerB, "Silvercoat Lion", 3, 3); } - + + /** + * I noticed in a game that when you cast Lingering Souls off of Gonti, Lord + * of Luxury and then the lingering souls goes to the graveyard it cannot be + * flashed back. The gonti was my opponent's and the lingering souls was + * mine for reference. + */ + @Test + public void testCanBeCastLaterWithFlashBack() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7); + // Deathtouch + // When Gonti, Lord of Luxury enters the battlefield, look at the top four cards of target opponent's library, exile one of them face down, + // then put the rest on the bottom of that library in a random order. For as long as that card remains exiled, + // you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it. + addCard(Zone.HAND, playerA, "Gonti, Lord of Luxury", 1); // Creature 2/3 {2}{B}{B} + + // Create two 1/1 white Spirit creature tokens with flying. + // Flashback {1}{B} + addCard(Zone.LIBRARY, playerB, "Lingering Souls"); // Sorcery {2}{W} + skipInitShuffling(); + + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); + addTarget(playerA, playerB); + setChoice(playerA, "Lingering Souls"); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lingering Souls"); + + activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Flashback"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Gonti, Lord of Luxury", 1); + assertPowerToughness(playerA, "Gonti, Lord of Luxury", 2, 3); + assertPermanentCount(playerA, "Spirit", 2); + + assertPermanentCount(playerB, "Spirit", 2); + + assertExileCount("Lingering Souls", 1); + + } } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 10a0aa8d124..f8a1ff91473 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -275,7 +275,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public Abilities getAbilities(Game game) { Abilities otherAbilities = game.getState().getAllOtherAbilities(objectId); - if (otherAbilities == null) { + if (otherAbilities == null || otherAbilities.isEmpty()) { return abilities; } Abilities all = new AbilitiesImpl<>();