mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Basic AI for payments via K'rrik's static ability.
This commit is contained in:
@@ -321,11 +321,17 @@ public class ComputerUtilMana {
|
|||||||
|
|
||||||
SpellAbility saPayment = chooseManaAbility(cost, sa, ai, toPay, saList, true);
|
SpellAbility saPayment = chooseManaAbility(cost, sa, ai, toPay, saList, true);
|
||||||
if (saPayment == null) {
|
if (saPayment == null) {
|
||||||
if (!toPay.isPhyrexian() || !ai.canPayLife(2)) {
|
boolean lifeInsteadOfBlack = toPay.isBlack() && ai.hasKeyword("PayLifeInsteadOf:B");
|
||||||
|
if ((!toPay.isPhyrexian() && !lifeInsteadOfBlack) || !ai.canPayLife(2)) {
|
||||||
break; // cannot pay
|
break; // cannot pay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toPay.isPhyrexian()) {
|
||||||
cost.payPhyrexian();
|
cost.payPhyrexian();
|
||||||
|
} else if (lifeInsteadOfBlack) {
|
||||||
|
cost.decreaseShard(ManaCostShard.BLACK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,6 +387,8 @@ public class ComputerUtilMana {
|
|||||||
while (!cost.isPaid()) {
|
while (!cost.isPaid()) {
|
||||||
toPay = getNextShardToPay(cost);
|
toPay = getNextShardToPay(cost);
|
||||||
|
|
||||||
|
boolean lifeInsteadOfBlack = toPay.isBlack() && ai.hasKeyword("PayLifeInsteadOf:B");
|
||||||
|
|
||||||
Collection<SpellAbility> saList = null;
|
Collection<SpellAbility> saList = null;
|
||||||
if (hasConverge &&
|
if (hasConverge &&
|
||||||
(toPay == ManaCostShard.GENERIC || toPay == ManaCostShard.X)) {
|
(toPay == ManaCostShard.GENERIC || toPay == ManaCostShard.X)) {
|
||||||
@@ -431,7 +439,8 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (saPayment == null) {
|
if (saPayment == null) {
|
||||||
if (!toPay.isPhyrexian() || !ai.canPayLife(2) || (ai.getLife() <= 2 && !ai.cantLoseForZeroOrLessLife())) {
|
if ((!toPay.isPhyrexian() && !lifeInsteadOfBlack) || !ai.canPayLife(2)
|
||||||
|
|| (ai.getLife() <= 2 && !ai.cantLoseForZeroOrLessLife())) {
|
||||||
break; // cannot pay
|
break; // cannot pay
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +455,12 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toPay.isPhyrexian()) {
|
||||||
cost.payPhyrexian();
|
cost.payPhyrexian();
|
||||||
|
} else if (lifeInsteadOfBlack) {
|
||||||
|
cost.decreaseShard(ManaCostShard.BLACK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!test) {
|
if (!test) {
|
||||||
ai.payLife(2, sa.getHostCard());
|
ai.payLife(2, sa.getHostCard());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user