mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Rename variables
This commit is contained in:
@@ -241,9 +241,9 @@ public class CostPayment extends ManaConversionMatrix {
|
|||||||
* a {@link forge.game.spellability.SpellAbility} object.
|
* a {@link forge.game.spellability.SpellAbility} object.
|
||||||
* @return a {@link forge.game.mana.Mana} 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<String, Integer> xManaCostPaidByColor) {
|
String restriction, final byte colorsPaid, Map<String, Integer> xManaCostPaidByColor) {
|
||||||
final List<Pair<Mana, Integer>> weightedOptions = selectManaToPayFor(ai.getManaPool(), shard,
|
final List<Pair<Mana, Integer>> weightedOptions = selectManaToPayFor(player.getManaPool(), shard,
|
||||||
saBeingPaidFor, restriction, colorsPaid, xManaCostPaidByColor);
|
saBeingPaidFor, restriction, colorsPaid, xManaCostPaidByColor);
|
||||||
|
|
||||||
// Exclude border case
|
// 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 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);
|
return manaChoices.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let them choose then
|
// Let them choose then
|
||||||
return ai.getController().chooseManaFromPool(manaChoices);
|
return player.getController().chooseManaFromPool(manaChoices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Pair<Mana, Integer>> selectManaToPayFor(final ManaPool manapool, final ManaCostShard shard,
|
private static List<Pair<Mana, Integer>> selectManaToPayFor(final ManaPool manapool, final ManaCostShard shard,
|
||||||
|
|||||||
@@ -291,12 +291,12 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void refundMana(List<Mana> manaSpent, Player ai, SpellAbility sa) {
|
public static void refundMana(List<Mana> manaSpent, Player player, SpellAbility sa) {
|
||||||
if (sa.getHostCard() != null) {
|
if (sa.getHostCard() != null) {
|
||||||
sa.getHostCard().setCanCounter(true);
|
sa.getHostCard().setCanCounter(true);
|
||||||
}
|
}
|
||||||
for (final Mana m : manaSpent) {
|
for (final Mana m : manaSpent) {
|
||||||
ai.getManaPool().addMana(m);
|
player.getManaPool().addMana(m);
|
||||||
}
|
}
|
||||||
manaSpent.clear();
|
manaSpent.clear();
|
||||||
}
|
}
|
||||||
@@ -358,12 +358,12 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
* Checks if the given mana cost can be paid from floating mana.
|
* Checks if the given mana cost can be paid from floating mana.
|
||||||
* @param cost mana cost to pay for
|
* @param cost mana cost to pay for
|
||||||
* @param sa ability 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 test actual payment is made if this is false
|
||||||
* @param manaSpentToPay list of mana spent
|
* @param manaSpentToPay list of mana spent
|
||||||
* @return whether the floating mana is sufficient to pay the cost fully
|
* @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<Mana> manaSpentToPay) {
|
final boolean test, List<Mana> manaSpentToPay) {
|
||||||
final boolean hasConverge = sa.getHostCard().hasConverge();
|
final boolean hasConverge = sa.getHostCard().hasConverge();
|
||||||
List<ManaCostShard> unpaidShards = cost.getUnpaidShards();
|
List<ManaCostShard> unpaidShards = cost.getUnpaidShards();
|
||||||
@@ -375,9 +375,9 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get a mana of this type from floating, bail if none available
|
// 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 (mana != null) {
|
||||||
if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana, test)) {
|
if (player.getManaPool().tryPayCostWithMana(sa, cost, mana, test)) {
|
||||||
manaSpentToPay.add(0, mana);
|
manaSpentToPay.add(0, mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
if (cost.isPaid()) {
|
if (cost.isPaid()) {
|
||||||
// refund any mana taken from mana pool when test
|
// refund any mana taken from mana pool when test
|
||||||
if (test) {
|
if (test) {
|
||||||
refundMana(manaSpentToPay, ai, sa);
|
refundMana(manaSpentToPay, player, sa);
|
||||||
}
|
}
|
||||||
CostPayment.handleOfferings(sa, test, cost.isPaid());
|
CostPayment.handleOfferings(sa, test, cost.isPaid());
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user