Merge pull request #3629 from Card-Forge/kevlahnota-patch-8

Update AiController.java
This commit is contained in:
kevlahnota
2023-08-14 18:44:04 +08:00
committed by GitHub

View File

@@ -1197,16 +1197,17 @@ public class AiController {
}
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message, Map<String, Object> params) {
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment) {
if (mode == PlayerActionConfirmMode.AlternativeDamageAssignment || mode == PlayerActionConfirmMode.ChangeZoneToAltDestination) {
System.err.printf("Overriding AI confirmAction decision for %s, defaulting to true.\n", mode);
return true;
}
ApiType api = sa.getApi();
ApiType api = sa == null ? null : sa.getApi();
// Abilities without api may also use this routine, However they should provide a unique mode value ?? How could this work?
if (api == null) {
String exMsg = String.format("AI confirmAction does not know what to decide about %s mode (api is null).",
mode);
if (sa == null || api == null) {
String exMsg = String.format("AI confirmAction does not know what to decide about %s mode (%s is null).",
mode, sa == null ? "SA" : "API");
throw new IllegalArgumentException(exMsg);
}
return SpellApiToAi.Converter.get(api).confirmAction(player, sa, mode, message, params);