- 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:
Sloth
2011-11-23 17:03:56 +00:00
parent 2fbfb0ad30
commit 2224a48eed
3 changed files with 10 additions and 9 deletions

View File

@@ -4,7 +4,6 @@ Types:Sorcery
Text:no text
A:SP$ GainLife | Cost$ X G | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SpellDescription$ Target player gains X life.
SVar:X:Count$xPaid
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/stream_of_life.jpg
SetInfo:8ED|Uncommon|http://magiccards.info/scans/en/8e/282.jpg

View File

@@ -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;

View File

@@ -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;