- Fix the AI logic for Expansion // Explosion (casting for 0, underdrawing).

This commit is contained in:
Agetian
2018-12-15 11:58:43 +03:00
parent f2e9d5913e
commit 498f7325c9

View File

@@ -365,6 +365,10 @@ public class DrawAi extends SpellAbilityAi {
if (numCards >= computerLibrarySize) { if (numCards >= computerLibrarySize) {
if (xPaid) { if (xPaid) {
numCards = computerLibrarySize - 1; numCards = computerLibrarySize - 1;
if (numCards <= 0 && !mandatory) {
// not drawing anything, so don't do it
return false;
}
} else if (!ai.isCardInPlay("Laboratory Maniac")) { } else if (!ai.isCardInPlay("Laboratory Maniac")) {
aiTarget = false; aiTarget = false;
} }
@@ -398,6 +402,9 @@ public class DrawAi extends SpellAbilityAi {
if (computerHandSize + numCards > computerMaxHandSize && game.getPhaseHandler().isPlayerTurn(ai)) { if (computerHandSize + numCards > computerMaxHandSize && game.getPhaseHandler().isPlayerTurn(ai)) {
if (xPaid) { if (xPaid) {
numCards = computerMaxHandSize - computerHandSize; numCards = computerMaxHandSize - computerHandSize;
if (sa.getHostCard().getZone().is(ZoneType.Hand)) {
numCards++; // the card will be spent
}
source.setSVar("PayX", Integer.toString(numCards)); source.setSVar("PayX", Integer.toString(numCards));
} else { } else {
// Don't draw too many cards and then risk discarding // Don't draw too many cards and then risk discarding