* Fixed flashback check of Altar of the Lost conditional mana.

This commit is contained in:
LevelX2 2016-08-05 20:03:04 +02:00
parent 9b683ef481
commit d1c25b0662
2 changed files with 13 additions and 7 deletions

View file

@ -27,10 +27,8 @@
*/ */
package mage.sets.darkascension; package mage.sets.darkascension;
import java.util.UUID;
import mage.ConditionalMana; import mage.ConditionalMana;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -40,9 +38,11 @@ import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.mana.ConditionalAnyColorManaAbility; import mage.abilities.mana.ConditionalAnyColorManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.Spell;
import java.util.UUID;
/** /**
* *
@ -72,6 +72,7 @@ public class AltarOfTheLost extends CardImpl {
} }
class AltarOfTheLostManaBuilder extends ConditionalManaBuilder { class AltarOfTheLostManaBuilder extends ConditionalManaBuilder {
@Override @Override
public ConditionalMana build(Object... options) { public ConditionalMana build(Object... options) {
return new AltarOfTheLostConditionalMana(this.mana); return new AltarOfTheLostConditionalMana(this.mana);
@ -93,11 +94,12 @@ class AltarOfTheLostConditionalMana extends ConditionalMana {
} }
class AltarOfTheLostManaCondition implements Condition { class AltarOfTheLostManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object != null && game.getState().getZone(object.getId()) == Zone.GRAVEYARD) { if (object instanceof Spell && ((Spell) object).getFromZone().equals(Zone.GRAVEYARD)) {
for (Ability ability: object.getAbilities()) { for (Ability ability : ((Spell) object).getAbilities(game)) {
if (ability instanceof FlashbackAbility) { if (ability instanceof FlashbackAbility) {
return true; return true;
} }

View file

@ -13,7 +13,11 @@ public class AltarOfTheLostTest extends CardTestPlayerBase {
@Test @Test
public void testCard() { 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"); 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"); addCard(Zone.GRAVEYARD, playerA, "Lingering Souls");
setChoice(playerA, "Black"); setChoice(playerA, "Black");