diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java index 29fcfe0873f..1fdd6cc49ed 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilMana.java @@ -688,10 +688,6 @@ public class ComputerUtilMana { ListMultimap sourcesForShards = getSourcesForShards(cost, sa, ai, test, checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType); - if (sourcesForShards == null && !purePhyrexian) { - return false; // no mana abilities to use for paying - } - int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY); final ManaPool manapool = ai.getManaPool(); ManaCostShard toPay = null; @@ -712,7 +708,7 @@ public class ComputerUtilMana { manapool.applyCardMatrix(pay); for (byte color : ManaAtom.MANATYPES) { - if (manapool.tryPayCostWithColor(color, sa, cost)) { + if (manapool.tryPayCostWithColor(color, sa, cost, manaSpentToPay)) { found = true; break; } @@ -724,6 +720,11 @@ public class ComputerUtilMana { if (cost.isPaid()) { break; } + + if (sourcesForShards == null && !purePhyrexian) { + return false; // no mana abilities to use for paying + } + toPay = getNextShardToPay(cost); boolean lifeInsteadOfBlack = toPay.isBlack() && ai.hasKeyword("PayLifeInsteadOf:B"); diff --git a/forge-game/src/main/java/forge/game/mana/ManaPool.java b/forge-game/src/main/java/forge/game/mana/ManaPool.java index 1cab0f54a9c..0fc931ce921 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaPool.java +++ b/forge-game/src/main/java/forge/game/mana/ManaPool.java @@ -212,7 +212,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { } } - public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost) { + public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost, List manaSpentToPay) { Mana manaFound = null; String restriction = manaCost.getSourceRestriction(); Collection cm = floatingMana.get(colorCode); @@ -231,7 +231,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { } if (manaFound != null && tryPayCostWithMana(saPaidFor, manaCost, manaFound, false)) { - saPaidFor.getPayingMana().add(0, manaFound); + manaSpentToPay.add(0, manaFound); return true; } return false; diff --git a/forge-gui/res/cardsfolder/c/cemetery_prowler.txt b/forge-gui/res/cardsfolder/c/cemetery_prowler.txt index de70790baee..545e9abe53a 100644 --- a/forge-gui/res/cardsfolder/c/cemetery_prowler.txt +++ b/forge-gui/res/cardsfolder/c/cemetery_prowler.txt @@ -5,10 +5,8 @@ PT:3/4 K:Vigilance T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield or attacks, exile a card from a graveyard. T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | Secondary$ True | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, exile a card from a graveyard. -SVar:TrigExile:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | SelectPrompt$ Select a card from a graveyard | Mandatory$ True | Hidden$ True | Imprint$ True | AILogic$ ExilePreference:MostProminentNonLandNonExiledOwnType +SVar:TrigExile:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | SelectPrompt$ Select a card from a graveyard | Mandatory$ True | Hidden$ True | AILogic$ ExilePreference:MostProminentNonLandNonExiledOwnType S:Mode$ ReduceCost | ValidCard$ Card | Type$ Spell | Amount$ AffectedX | Activator$ You | Description$ Spells you cast cost {1} less to cast for each card type they share with cards exiled with CARDNAME. -SVar:AffectedX:Count$TypesSharedWith Imprinted.ExiledWithSource -T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True -SVar:DBCleanup:DB$ Cleanup | ClearImprinted$ True +SVar:AffectedX:Count$TypesSharedWith Card.ExiledWithSource DeckHints:Ability$Graveyard|Discard Oracle:Vigilance\nWhenever Cemetery Prowler enters the battlefield or attacks, exile a card from a graveyard.\nSpells you cast cost {1} less to cast for each card type they share with cards exiled with Cemetery Prowler. diff --git a/forge-gui/src/main/java/forge/gamemodes/match/input/InputPayMana.java b/forge-gui/src/main/java/forge/gamemodes/match/input/InputPayMana.java index c5666ad05e7..8d5593ad286 100644 --- a/forge-gui/src/main/java/forge/gamemodes/match/input/InputPayMana.java +++ b/forge-gui/src/main/java/forge/gamemodes/match/input/InputPayMana.java @@ -201,7 +201,7 @@ public abstract class InputPayMana extends InputSyncronizedBase { public void useManaFromPool(byte colorCode) { // find the matching mana in pool. - if (player.getManaPool().tryPayCostWithColor(colorCode, saPaidFor, manaCost)) { + if (player.getManaPool().tryPayCostWithColor(colorCode, saPaidFor, manaCost, saPaidFor.getPayingMana())) { onManaAbilityPaid(); showMessage(); }