From 47d8c2c0c8c0d208f1ad89cbc785b27f37a0d7ff Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 16:14:19 +0000 Subject: [PATCH] - Tweaks for AI passing priority in between land plays. --- src/forge/ComputerAI_General.java | 12 ++++++------ src/forge/ComputerUtil.java | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/forge/ComputerAI_General.java b/src/forge/ComputerAI_General.java index a6f9861ae20..432bb20a92d 100644 --- a/src/forge/ComputerAI_General.java +++ b/src/forge/ComputerAI_General.java @@ -13,18 +13,18 @@ public class ComputerAI_General implements Computer { } public void main1() { - ComputerUtil.chooseLandsToPlay(); - if(AllZone.Stack.size() != 0) - { + if (!ComputerUtil.chooseLandsToPlay()){ + if (AllZone.Phase.getPriorityPlayer().isComputer()) + stackResponse(); return; } playCards(Constant.Phase.Main1); }//main1() public void main2() { - ComputerUtil.chooseLandsToPlay(); // in case we can play more lands now, or drew cards since first main phase - if(AllZone.Stack.size() != 0) - { + if (!ComputerUtil.chooseLandsToPlay()){ // in case we can play more lands now, or drew cards since first main phase + if (AllZone.Phase.getPriorityPlayer().isComputer()) + stackResponse(); return; } playCards(Constant.Phase.Main2); diff --git a/src/forge/ComputerUtil.java b/src/forge/ComputerUtil.java index f0c133bd72c..9226193f85f 100644 --- a/src/forge/ComputerUtil.java +++ b/src/forge/ComputerUtil.java @@ -528,7 +528,7 @@ public class ComputerUtil }//getAvailableMana() //plays a land if one is available - static public void chooseLandsToPlay() + static public boolean chooseLandsToPlay() { Player computer = AllZone.ComputerPlayer; ArrayList landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land"); @@ -553,7 +553,10 @@ public class ComputerUtil computer.playLand(land); AllZone.GameAction.checkStateEffects(); + if (AllZone.Stack.size() != 0) + return false; } + return true; } static public Card getCardPreference(Card activate, String pref, CardList typeList){