mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +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:
@@ -4,7 +4,6 @@ Types:Sorcery
|
|||||||
Text:no text
|
Text:no text
|
||||||
A:SP$ GainLife | Cost$ X G | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ X | SpellDescription$ Target player gains X life.
|
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:X:Count$xPaid
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Rarity:Common
|
SVar:Rarity:Common
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/stream_of_life.jpg
|
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
|
SetInfo:8ED|Uncommon|http://magiccards.info/scans/en/8e/282.jpg
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ public class ComputerUtil {
|
|||||||
int xMana = 0;
|
int xMana = 0;
|
||||||
|
|
||||||
for (int i = 1; i < 99; i++) {
|
for (int i = 1; i < 99; i++) {
|
||||||
if (!ComputerUtil.payManaCost(sa, player, true, xMana)) {
|
if (!ComputerUtil.payManaCost(sa, player, true, i)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xMana = i;
|
xMana = i;
|
||||||
|
|||||||
@@ -239,8 +239,16 @@ public class AbilityFactoryAlterLife {
|
|||||||
final Cost abCost = sa.getPayCosts();
|
final Cost abCost = sa.getPayCosts();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
final int life = AllZone.getComputerPlayer().getLife();
|
final int life = AllZone.getComputerPlayer().getLife();
|
||||||
final int lifeAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("LifeAmount"), sa);
|
|
||||||
final String amountStr = params.get("LifeAmount");
|
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
|
// don't use it if no life to gain
|
||||||
if (lifeAmount <= 0) {
|
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;
|
boolean randomReturn = r.nextFloat() <= .6667;
|
||||||
if (AbilityFactory.playReusable(sa)) {
|
if (AbilityFactory.playReusable(sa)) {
|
||||||
randomReturn = true;
|
randomReturn = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user