mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Merge branch 'ai-energy-check' into 'master'
Make AI check energy when testing if it can pay for a mana ability See merge request core-developers/forge!284
This commit is contained in:
@@ -19,6 +19,7 @@ import forge.game.combat.CombatUtil;
|
|||||||
import forge.game.cost.Cost;
|
import forge.game.cost.Cost;
|
||||||
import forge.game.cost.CostAdjustment;
|
import forge.game.cost.CostAdjustment;
|
||||||
import forge.game.cost.CostPartMana;
|
import forge.game.cost.CostPartMana;
|
||||||
|
import forge.game.cost.CostPayEnergy;
|
||||||
import forge.game.cost.CostPayment;
|
import forge.game.cost.CostPayment;
|
||||||
import forge.game.mana.Mana;
|
import forge.game.mana.Mana;
|
||||||
import forge.game.mana.ManaCostBeingPaid;
|
import forge.game.mana.ManaCostBeingPaid;
|
||||||
@@ -360,6 +361,7 @@ public class ComputerUtilMana {
|
|||||||
adjustManaCostToAvoidNegEffects(cost, sa.getHostCard(), ai);
|
adjustManaCostToAvoidNegEffects(cost, sa.getHostCard(), ai);
|
||||||
List<Mana> manaSpentToPay = test ? new ArrayList<Mana>() : sa.getPayingMana();
|
List<Mana> manaSpentToPay = test ? new ArrayList<Mana>() : sa.getPayingMana();
|
||||||
boolean purePhyrexian = cost.containsOnlyPhyrexianMana();
|
boolean purePhyrexian = cost.containsOnlyPhyrexianMana();
|
||||||
|
int testEnergyPool = ai.getCounters(CounterType.ENERGY);
|
||||||
|
|
||||||
List<SpellAbility> paymentList = Lists.newArrayList();
|
List<SpellAbility> paymentList = Lists.newArrayList();
|
||||||
|
|
||||||
@@ -458,6 +460,16 @@ public class ComputerUtilMana {
|
|||||||
setExpressColorChoice(sa, ai, cost, toPay, saPayment);
|
setExpressColorChoice(sa, ai, cost, toPay, saPayment);
|
||||||
|
|
||||||
if (test) {
|
if (test) {
|
||||||
|
// Check energy when testing
|
||||||
|
CostPayEnergy energyCost = saPayment.getPayCosts().getCostEnergy();
|
||||||
|
if (energyCost != null) {
|
||||||
|
testEnergyPool -= Integer.parseInt(energyCost.getAmount());
|
||||||
|
if (testEnergyPool < 0) {
|
||||||
|
// Can't pay energy cost
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String manaProduced = toPay.isSnow() ? "S" : GameActionUtil.generatedMana(saPayment);
|
String manaProduced = toPay.isSnow() ? "S" : GameActionUtil.generatedMana(saPayment);
|
||||||
manaProduced = AbilityManaPart.applyManaReplacement(saPayment, manaProduced);
|
manaProduced = AbilityManaPart.applyManaReplacement(saPayment, manaProduced);
|
||||||
//System.out.println(manaProduced);
|
//System.out.println(manaProduced);
|
||||||
|
|||||||
Reference in New Issue
Block a user