diff --git a/forge-game/src/main/java/forge/game/cost/CostPayment.java b/forge-game/src/main/java/forge/game/cost/CostPayment.java index bce4340ec24..ac6b5d6bf3f 100644 --- a/forge-game/src/main/java/forge/game/cost/CostPayment.java +++ b/forge-game/src/main/java/forge/game/cost/CostPayment.java @@ -241,9 +241,9 @@ public class CostPayment extends ManaConversionMatrix { * a {@link forge.game.spellability.SpellAbility} object. * @return a {@link forge.game.mana.Mana} object. */ - public static Mana getMana(final Player ai, final ManaCostShard shard, final SpellAbility saBeingPaidFor, + public static Mana getMana(final Player player, final ManaCostShard shard, final SpellAbility saBeingPaidFor, String restriction, final byte colorsPaid, Map xManaCostPaidByColor) { - final List> weightedOptions = selectManaToPayFor(ai.getManaPool(), shard, + final List> weightedOptions = selectManaToPayFor(player.getManaPool(), shard, saBeingPaidFor, restriction, colorsPaid, xManaCostPaidByColor); // Exclude border case @@ -284,12 +284,12 @@ public class CostPayment extends ManaConversionMatrix { } // if we are simulating mana payment for the human controller, use the first mana available (and avoid prompting the human player) - if (!ai.getController().isAI()) { + if (!player.getController().isAI()) { return manaChoices.get(0); } // Let them choose then - return ai.getController().chooseManaFromPool(manaChoices); + return player.getController().chooseManaFromPool(manaChoices); } private static List> selectManaToPayFor(final ManaPool manapool, final ManaCostShard shard, 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 682833edbf9..487eb89d224 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaPool.java +++ b/forge-game/src/main/java/forge/game/mana/ManaPool.java @@ -291,12 +291,12 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { return true; } - public static void refundMana(List manaSpent, Player ai, SpellAbility sa) { + public static void refundMana(List manaSpent, Player player, SpellAbility sa) { if (sa.getHostCard() != null) { sa.getHostCard().setCanCounter(true); } for (final Mana m : manaSpent) { - ai.getManaPool().addMana(m); + player.getManaPool().addMana(m); } manaSpent.clear(); } @@ -358,12 +358,12 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { * Checks if the given mana cost can be paid from floating mana. * @param cost mana cost to pay for * @param sa ability to pay for - * @param ai activating player + * @param player activating player * @param test actual payment is made if this is false * @param manaSpentToPay list of mana spent * @return whether the floating mana is sufficient to pay the cost fully */ - public static boolean payManaCostFromPool(final ManaCostBeingPaid cost, final SpellAbility sa, final Player ai, + public static boolean payManaCostFromPool(final ManaCostBeingPaid cost, final SpellAbility sa, final Player player, final boolean test, List manaSpentToPay) { final boolean hasConverge = sa.getHostCard().hasConverge(); List unpaidShards = cost.getUnpaidShards(); @@ -375,9 +375,9 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { } // get a mana of this type from floating, bail if none available - final Mana mana = CostPayment.getMana(ai, part, sa, cost.getSourceRestriction(), hasConverge ? cost.getColorsPaid() : -1, cost.getXManaCostPaidByColor()); + final Mana mana = CostPayment.getMana(player, part, sa, cost.getSourceRestriction(), hasConverge ? cost.getColorsPaid() : -1, cost.getXManaCostPaidByColor()); if (mana != null) { - if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana, test)) { + if (player.getManaPool().tryPayCostWithMana(sa, cost, mana, test)) { manaSpentToPay.add(0, mana); } } @@ -387,7 +387,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable { if (cost.isPaid()) { // refund any mana taken from mana pool when test if (test) { - refundMana(manaSpentToPay, ai, sa); + refundMana(manaSpentToPay, player, sa); } CostPayment.handleOfferings(sa, test, cost.isPaid()); return true;