From 48df6902e133f5bb896e3385729e440b69dce856 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 8 Sep 2022 11:35:42 -0500 Subject: [PATCH] [40K] Fixed Abaddon the Despoiler and enabled test (fixes #9490) --- Mage.Sets/src/mage/cards/a/AbaddonTheDespoiler.java | 13 +++++++++---- .../cards/single/_40k/AbaddonTheDespoilerTest.java | 4 ++-- .../abilities/effects/GainAbilitySpellsEffect.java | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AbaddonTheDespoiler.java b/Mage.Sets/src/mage/cards/a/AbaddonTheDespoiler.java index 5aca8c0cdc..3275d51442 100644 --- a/Mage.Sets/src/mage/cards/a/AbaddonTheDespoiler.java +++ b/Mage.Sets/src/mage/cards/a/AbaddonTheDespoiler.java @@ -1,6 +1,7 @@ package mage.cards.a; import mage.MageInt; +import mage.MageObject; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.MyTurnCondition; import mage.abilities.decorator.ConditionalContinuousEffect; @@ -73,14 +74,18 @@ public final class AbaddonTheDespoiler extends CardImpl { } } -enum AbaddonTheDespoilerPredicate implements Predicate { +enum AbaddonTheDespoilerPredicate implements Predicate { instance; @Override - public boolean apply(StackObject input, Game game) { - return input.getManaValue() <= game + public boolean apply(MageObject input, Game game) { + if (!(input instanceof StackObject)) { + return false; + } + StackObject stackObject = (StackObject) input; + return stackObject.getManaValue() <= game .getState() .getWatcher(PlayerLostLifeWatcher.class) - .getAllOppLifeLost(input.getControllerId(), game); + .getAllOppLifeLost(stackObject.getControllerId(), game); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/_40k/AbaddonTheDespoilerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/_40k/AbaddonTheDespoilerTest.java index 06d17bce5b..db01d74f10 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/_40k/AbaddonTheDespoilerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/_40k/AbaddonTheDespoilerTest.java @@ -2,7 +2,6 @@ package org.mage.test.cards.single._40k; import mage.constants.PhaseStep; import mage.constants.Zone; -import org.junit.Ignore; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -17,10 +16,10 @@ public class AbaddonTheDespoilerTest extends CardTestPlayerBase { /** * Reported bug: https://github.com/magefree/mage/issues/9490 */ - @Ignore @Test public void cascadeWorks() { String lightningBolt = "Lightning Bolt"; + addCard(Zone.BATTLEFIELD, playerA, abaddonTheDespoiler); addCard(Zone.HAND, playerA, lightningBolt, 2); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); addCard(Zone.LIBRARY, playerA, "Crimson Kobolds"); // {0} @@ -31,6 +30,7 @@ public class AbaddonTheDespoilerTest extends CardTestPlayerBase { waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, lightningBolt, playerB); + setChoice(playerA, true); // Cast with Cascade setStopAt(1, PhaseStep.PRECOMBAT_MAIN); execute(); diff --git a/Mage/src/main/java/mage/abilities/effects/GainAbilitySpellsEffect.java b/Mage/src/main/java/mage/abilities/effects/GainAbilitySpellsEffect.java index 78cbab355a..45e0033073 100644 --- a/Mage/src/main/java/mage/abilities/effects/GainAbilitySpellsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/GainAbilitySpellsEffect.java @@ -1,7 +1,6 @@ package mage.abilities.effects; import mage.abilities.Ability; -import mage.abilities.MageSingleton; import mage.cards.Card; import mage.constants.*; import mage.filter.FilterObject;