From b63623b40f48a52b1e9789a0e4d408a6c61626e1 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 23 Oct 2021 15:40:58 -0500 Subject: [PATCH] [AFC] Fixed Belt of Giant Strength cost reduction (fixes #8347) --- .../src/mage/cards/b/BeltOfGiantStrength.java | 28 +++++++++++++++---- .../single/afc/BeltOfGiantStrengthTest.java | 1 - 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BeltOfGiantStrength.java b/Mage.Sets/src/mage/cards/b/BeltOfGiantStrength.java index 72ccd75714..b16c69d1ff 100644 --- a/Mage.Sets/src/mage/cards/b/BeltOfGiantStrength.java +++ b/Mage.Sets/src/mage/cards/b/BeltOfGiantStrength.java @@ -51,10 +51,28 @@ enum BeltOfGiantStrengthAdjuster implements CostAdjuster { @Override public void adjustCosts(Ability ability, Game game) { - Permanent permanent = game.getPermanent(ability.getFirstTarget()); - if (permanent == null) { - return; + if (game.inCheckPlayableState()) { + int maxPower = 0; + for (UUID permId : CardUtil.getAllPossibleTargets(ability, game)) { + Permanent permanent = game.getPermanent(permId); + if (permanent != null) { + int power = permanent.getPower().getValue(); + if (power > maxPower) { + maxPower = power; + } + } + } + if (maxPower > 0) { + CardUtil.reduceCost(ability, maxPower); + } + } else { + Permanent permanent = game.getPermanent(ability.getFirstTarget()); + if (permanent != null) { + int power = permanent.getPower().getValue(); + if (power > 0) { + CardUtil.reduceCost(ability, power); + } + } } - CardUtil.reduceCost(ability, Integer.max(permanent.getPower().getValue(), 0)); } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/afc/BeltOfGiantStrengthTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/afc/BeltOfGiantStrengthTest.java index 38262ef5d7..4fd9ab347b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/afc/BeltOfGiantStrengthTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/afc/BeltOfGiantStrengthTest.java @@ -42,7 +42,6 @@ public class BeltOfGiantStrengthTest extends CardTestPlayerBase { ); } - @Ignore // currently failing, need to fix @Test public void testWithoutManaAvailable() { addCard(Zone.BATTLEFIELD, playerA, belt);