mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added support for PayXButSaveMana AI logic for non-trigger AF Dig as well (for potential use cases).
This commit is contained in:
@@ -63,9 +63,16 @@ public class DigAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
final String num = sa.getParam("DigNum");
|
final String num = sa.getParam("DigNum");
|
||||||
if (num != null && num.equals("X") && host.getSVar(num).equals("Count$xPaid")) {
|
if (num != null && num.equals("X") && host.getSVar(num).equals("Count$xPaid")) {
|
||||||
// Set PayX here to maximum value.
|
// By default, set PayX here to maximum value.
|
||||||
if (!(sa instanceof AbilitySub) || host.getSVar("PayX").equals("")) {
|
if (!(sa instanceof AbilitySub) || host.getSVar("PayX").equals("")) {
|
||||||
int numCards = ComputerUtilMana.determineLeftoverMana(sa, ai);
|
int manaToSave = 0;
|
||||||
|
|
||||||
|
// Special logic that asks the AI to conserve a certain amount of mana when paying X
|
||||||
|
if (sa.hasParam("AILogic") && sa.getParam("AILogic").startsWith("PayXButSaveMana")) {
|
||||||
|
manaToSave = Integer.parseInt(TextUtil.split(sa.getParam("AILogic"), '.')[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numCards = ComputerUtilMana.determineLeftoverMana(sa, ai) - manaToSave;
|
||||||
if (numCards <= 0) {
|
if (numCards <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user