mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Fixed a general bug that prevented the AI from using most X costs.
- Fixed a bug in AF GainLife that prevented the AI from using X costs.
This commit is contained in:
@@ -454,7 +454,7 @@ public class ComputerUtil {
|
||||
int xMana = 0;
|
||||
|
||||
for (int i = 1; i < 99; i++) {
|
||||
if (!ComputerUtil.payManaCost(sa, player, true, xMana)) {
|
||||
if (!ComputerUtil.payManaCost(sa, player, true, i)) {
|
||||
break;
|
||||
}
|
||||
xMana = i;
|
||||
|
||||
@@ -239,8 +239,16 @@ public class AbilityFactoryAlterLife {
|
||||
final Cost abCost = sa.getPayCosts();
|
||||
final Card source = sa.getSourceCard();
|
||||
final int life = AllZone.getComputerPlayer().getLife();
|
||||
final int lifeAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
||||
final String amountStr = params.get("LifeAmount");
|
||||
int lifeAmount = 0;
|
||||
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")) {
|
||||
// Set PayX here to maximum value.
|
||||
final int xPay = ComputerUtil.determineLeftoverMana(sa);
|
||||
source.setSVar("PayX", Integer.toString(xPay));
|
||||
lifeAmount = xPay;
|
||||
} else {
|
||||
lifeAmount = AbilityFactory.calculateAmount(af.getHostCard(), amountStr, sa);
|
||||
}
|
||||
|
||||
// don't use it if no life to gain
|
||||
if (lifeAmount <= 0) {
|
||||
@@ -298,12 +306,6 @@ public class AbilityFactoryAlterLife {
|
||||
}
|
||||
}
|
||||
|
||||
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")) {
|
||||
// Set PayX here to maximum value.
|
||||
final int xPay = ComputerUtil.determineLeftoverMana(sa);
|
||||
source.setSVar("PayX", Integer.toString(xPay));
|
||||
}
|
||||
|
||||
boolean randomReturn = r.nextFloat() <= .6667;
|
||||
if (AbilityFactory.playReusable(sa)) {
|
||||
randomReturn = true;
|
||||
|
||||
Reference in New Issue
Block a user