mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
AiController: canPlaySa add check if the mana cost is zero, but the card cost does contain X
should not play this spell for free.
This commit is contained in:
@@ -654,13 +654,21 @@ public class AiController {
|
||||
else if (sa.getPayCosts() != null){
|
||||
Cost payCosts = sa.getPayCosts();
|
||||
ManaCost mana = payCosts.getTotalMana();
|
||||
if (mana!= null && mana.countX() > 0) {
|
||||
if (mana != null) {
|
||||
if(mana.countX() > 0) {
|
||||
// Set PayX here to maximum value.
|
||||
final int xPay = ComputerUtilMana.determineLeftoverMana(sa, player);
|
||||
if (xPay <= 0) {
|
||||
return AiPlayDecision.CantAffordX;
|
||||
}
|
||||
card.setSVar("PayX", Integer.toString(xPay));
|
||||
} else if (mana.isZero()) {
|
||||
// if mana is zero, but card mana cost does have X, then something is wrong
|
||||
ManaCost cardCost = card.getManaCost();
|
||||
if (cardCost != null && cardCost.countX() > 0) {
|
||||
return AiPlayDecision.CantPlayAi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkCurseEffects(sa)) {
|
||||
@@ -691,6 +699,12 @@ public class AiController {
|
||||
}
|
||||
card.setSVar("PayX", Integer.toString(xPay));
|
||||
}
|
||||
} else if (mana.isZero()) {
|
||||
// if mana is zero, but card mana cost does have X, then something is wrong
|
||||
ManaCost cardCost = card.getManaCost();
|
||||
if (cardCost != null && cardCost.countX() > 0) {
|
||||
return AiPlayDecision.CantPlayAi;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for valid targets before casting
|
||||
|
||||
Reference in New Issue
Block a user