From d1c25b0662b7db89281113fd2815a1336ac8cc32 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 5 Aug 2016 20:03:04 +0200 Subject: [PATCH] * Fixed flashback check of Altar of the Lost conditional mana. --- .../mage/sets/darkascension/AltarOfTheLost.java | 16 +++++++++------- .../test/cards/single/AltarOfTheLostTest.java | 4 ++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/sets/darkascension/AltarOfTheLost.java b/Mage.Sets/src/mage/sets/darkascension/AltarOfTheLost.java index 8c2e3f7429..f13cb857e1 100644 --- a/Mage.Sets/src/mage/sets/darkascension/AltarOfTheLost.java +++ b/Mage.Sets/src/mage/sets/darkascension/AltarOfTheLost.java @@ -27,10 +27,8 @@ */ package mage.sets.darkascension; +import java.util.UUID; import mage.ConditionalMana; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageObject; import mage.Mana; import mage.abilities.Ability; @@ -40,9 +38,11 @@ import mage.abilities.keyword.FlashbackAbility; import mage.abilities.mana.ConditionalAnyColorManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; - -import java.util.UUID; +import mage.game.stack.Spell; /** * @@ -72,6 +72,7 @@ public class AltarOfTheLost extends CardImpl { } class AltarOfTheLostManaBuilder extends ConditionalManaBuilder { + @Override public ConditionalMana build(Object... options) { return new AltarOfTheLostConditionalMana(this.mana); @@ -93,11 +94,12 @@ class AltarOfTheLostConditionalMana extends ConditionalMana { } class AltarOfTheLostManaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { MageObject object = game.getObject(source.getSourceId()); - if (object != null && game.getState().getZone(object.getId()) == Zone.GRAVEYARD) { - for (Ability ability: object.getAbilities()) { + if (object instanceof Spell && ((Spell) object).getFromZone().equals(Zone.GRAVEYARD)) { + for (Ability ability : ((Spell) object).getAbilities(game)) { if (ability instanceof FlashbackAbility) { return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/AltarOfTheLostTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/AltarOfTheLostTest.java index 1fbda75a48..b130ef77e5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/AltarOfTheLostTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/AltarOfTheLostTest.java @@ -13,7 +13,11 @@ public class AltarOfTheLostTest extends CardTestPlayerBase { @Test public void testCard() { + // Altar of the Lost enters the battlefield tapped. + // {tap}: Add two mana in any combination of colors to your mana pool. Spend this mana only to cast spells with flashback from a graveyard. addCard(Zone.BATTLEFIELD, playerA, "Altar of the Lost"); + // Put two 1/1 white Spirit creature tokens with flying onto the battlefield. + // Flashback {1}{B} addCard(Zone.GRAVEYARD, playerA, "Lingering Souls"); setChoice(playerA, "Black");