From 551d5d8633a77ee954d4e58b1f649a5352e5b775 Mon Sep 17 00:00:00 2001 From: jimga150 Date: Thu, 9 May 2024 01:26:42 -0400 Subject: [PATCH] Gain abilities - improved combo support with Evoke, Dash and Prowl (example: Hunting Velociraptor, fixed #11714) (#12237) --- .../cards/abilities/keywords/ProwlTest.java | 32 ++++++++++++++++++- .../main/java/mage/players/PlayerImpl.java | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProwlTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProwlTest.java index 37aa15f1b13..21e298b2272 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProwlTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProwlTest.java @@ -6,7 +6,7 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) + * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) and jimga150 */ public class ProwlTest extends CardTestPlayerBase { @@ -74,4 +74,34 @@ public class ProwlTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Goblin Warchief", 1); assertPermanentCount(playerA, "Auntie's Snitch", 1); } + + /* + * Reported bug: you can't cast something for its prowl cost if you could not afford to cast it for its normal cost. The game won't allow me to put the creature on the stack at all. + * It seems it is only in the case of Hunting Velociraptor and not Prowl in general. + * GainAbilityControlledSpellsEffect not adding AlternativeSourceCosts in time to check playable + */ + @Test + public void test_ProwlWithGainAbilityControlledSpellsEffect() { + // {2}{R} Creature — Dinosaur (3/2) + // Dinosaur spells you cast have prowl {2}{R}. + addCard(Zone.BATTLEFIELD, playerA, "Hunting Velociraptor"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + addCard(Zone.HAND, playerA, "Thrasta, Tempest's Roar"); + + // prepare prowl condition + checkPlayableAbility("can't", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Thrasta", false); + attack(1, playerA, "Hunting Velociraptor"); + + checkPlayableAbility("must play", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Thrasta", true); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Thrasta, Tempest's Roar"); + setChoice(playerA, true); // choosing to pay prowl cost + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerB, currentGame.getStartingLife() - 3); + assertPermanentCount(playerA, "Hunting Velociraptor", 1); + assertPermanentCount(playerA, "Thrasta, Tempest's Roar", 1); + } } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index f797da5247d..64df1c12f88 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3737,7 +3737,7 @@ public abstract class PlayerImpl implements Player, Serializable { // TODO: Why is the "sourceObject instanceof Permanent" in there? if (sourceObject != null && !(sourceObject instanceof Permanent)) { Ability copyAbility; // for alternative cost and reduce tries - for (Ability alternateSourceCostsAbility : sourceObject.getAbilities()) { + for (Ability alternateSourceCostsAbility : sourceObject.getAbilities(game)) { // if cast for noMana no Alternative costs are allowed if (alternateSourceCostsAbility instanceof AlternativeSourceCosts) { if (((AlternativeSourceCosts) alternateSourceCostsAbility).isAvailable(ability, game)) {