Commit 087495f5 authored by Peter Patel-Schneider's avatar Peter Patel-Schneider

Force AI to accept mulligan scry (otherwise there is a crash)

parent b94ec249
......@@ -1209,9 +1209,10 @@ public class AiController {
}
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
ApiType api = sa.getApi();
ApiType api = (sa == null ) ? null : sa.getApi();
if ( api == null && mode == PlayerActionConfirmMode.Scry ) return true; // special hack for mulligan
// Abilities without api may also use this routine, However they should provide a unique mode value
// 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);
......
......@@ -31,6 +31,7 @@ import forge.game.event.*;
import forge.game.keyword.KeywordInterface;
import forge.game.player.GameLossReason;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.replacement.ReplacementEffect;
import forge.game.replacement.ReplacementResult;
import forge.game.spellability.AbilitySub;
......@@ -1818,7 +1819,6 @@ public class GameAction {
game.getTriggerHandler().runTrigger(TriggerType.BecomeMonarch, runParams, false);
}
// Make scry an action function so that it can be used for mulligans (with a null cause)
// Assumes that the list of players is in APNAP order, which should be the case
// Optional here as well to handle the way that mulligans do the choice
......@@ -1843,7 +1843,7 @@ public class GameAction {
ArrayList<ImmutablePair<CardCollection, CardCollection>> decisions =
new ArrayList<ImmutablePair<CardCollection, CardCollection>>();
for ( final Player p : players ) {
if (isOptional && !p.getController().confirmAction(cause, null, "Do you want to scry?")) {
if (isOptional && !p.getController().confirmAction(cause, PlayerActionConfirmMode.Scry, "Do you want to scry?")) {
decisions.add(new ImmutablePair<CardCollection, CardCollection>(new CardCollection(),new CardCollection()));
} else {
final CardCollection topN = new CardCollection(p.getCardsIn(ZoneType.Library, numScry));
......
......@@ -13,8 +13,8 @@ public enum PlayerActionConfirmMode {
ChangeZoneGeneral,
BidLife,
OptionalChoose,
Tribute;
Tribute,
// Ripple;
Scry;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment