- Some tweaks and improvements in the experimental AI code.

This commit is contained in:
Agetian
2017-09-17 08:02:43 +00:00
parent e9c55345b8
commit 543aae0893

View File

@@ -1143,12 +1143,14 @@ public class AiController {
int predictedMana = ComputerUtilMana.getAvailableManaEstimate(player, true); int predictedMana = ComputerUtilMana.getAvailableManaEstimate(player, true);
boolean canCastWithLandDrop = (predictedMana + 1 >= minCMCInHand) && !isTapLand; boolean canCastWithLandDrop = (predictedMana + 1 >= minCMCInHand) && !isTapLand;
boolean cantCastAnythingNow = predictedMana < minCMCInHand;
boolean hasRelevantAbsOTB = !CardLists.filter(otb, new Predicate<Card>() { boolean hasRelevantAbsOTB = !CardLists.filter(otb, new Predicate<Card>() {
@Override @Override
public boolean apply(Card card) { public boolean apply(Card card) {
boolean isTapLand = false; boolean isTapLand = false;
for (ReplacementEffect repl : card.getReplacementEffects()) { for (ReplacementEffect repl : card.getReplacementEffects()) {
// TODO: improve the detection of taplands
if (repl.getParamOrDefault("Description", "").equals("CARDNAME enters the battlefield tapped.")) { if (repl.getParamOrDefault("Description", "").equals("CARDNAME enters the battlefield tapped.")) {
isTapLand = true; isTapLand = true;
} }
@@ -1177,7 +1179,6 @@ public class AiController {
&& ((params.get("ValidCard").contains("Land")) || (params.get("ValidCard").contains("Permanent")) && !params.get("ValidCard").contains("nonLand")) && ((params.get("ValidCard").contains("Land")) || (params.get("ValidCard").contains("Permanent")) && !params.get("ValidCard").contains("nonLand"))
&& "Battlefield".equals(params.get("Destination"))) { && "Battlefield".equals(params.get("Destination"))) {
// Landfall and other similar triggers // Landfall and other similar triggers
System.out.println("LANDFALL: " + card);
return true; return true;
} }
} }
@@ -1185,7 +1186,8 @@ public class AiController {
} }
}).isEmpty(); }).isEmpty();
if (!canCastWithLandDrop && !hasLandfall && (!hasRelevantAbsOTB || isTapLand)) { // TODO: add prediction for effects that will untap a tapland as it enters the battlefield
if (!canCastWithLandDrop && cantCastAnythingNow && !hasLandfall && (!hasRelevantAbsOTB || isTapLand)) {
// Hopefully there's not much to do with the extra mana immediately, can wait for Main 2 // Hopefully there's not much to do with the extra mana immediately, can wait for Main 2
return true; return true;
} }