*Fixed AI decision-making for Spreading Seas,Convincing Mirage and Phantasmal Terrain. It will attempt to manascrew the human based on what lands are on the table. I was going to factor in landwalk abilities of it's own creatures but baby steps and bugfixes first.

This commit is contained in:
jendave
2011-08-06 08:26:53 +00:00
parent e3c6f1f184
commit 41f82808a2
3 changed files with 54 additions and 13 deletions

View File

@@ -1,12 +0,0 @@
#Forge
#Tue Sep 28 21:34:05 CEST 2010
gui.laf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
AI.stack.land=false
gui.new=true
stack.offset=tiny
card.images.size=medium
card.scale.larger.than.original=true
card.overlay=true
stack.max.size=3
loss.condition.milling=true
gui.laf.fonts=false

View File

@@ -3,6 +3,7 @@ package forge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
import com.esotericsoftware.minlog.Log;
@@ -594,7 +595,53 @@ class CardFactory_Auras {
}
else
{
NewType[0] = AllZone.Display.getChoice("Select land type.", "Plains","Island","Swamp","Mountain","Forest");
String[] LandTypes = new String[] { "Plains","Island","Swamp","Mountain","Forest"};
if(card.getController().equals(Constant.Player.Computer))
{
HashMap<String,Integer> humanLandCount = new HashMap<String,Integer>();
CardList humanlands = new CardList(AllZone.Human_Play.getCards());
humanlands = humanlands.getType("Land");
humanlands = humanlands.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.getType().contains("Land");
}
});
for(int i=0;i<LandTypes.length;i++)
{
humanLandCount.put(LandTypes[i],0);
}
for(Card c:humanlands)
{
for(String singleType:c.getType())
{
if(CardUtil.isBasicLandType(singleType))
{
humanLandCount.put(singleType, humanLandCount.get(singleType)+1);
}
}
}
int minAt = 0;
int minVal = Integer.MAX_VALUE;
for(int i=0;i<LandTypes.length;i++)
{
if(getTargetCard().getType().contains(LandTypes[i])) continue;
if(humanLandCount.get(LandTypes[i]) < minVal)
{
minVal = humanLandCount.get(LandTypes[i]);
minAt = i;
}
}
NewType[0] = LandTypes[minAt];
}
else
{
NewType[0] = AllZone.Display.getChoice("Select land type.", "Plains","Island","Swamp","Mountain","Forest");
}
}
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
play.add(card);

View File

@@ -216,4 +216,10 @@ public class CardUtil {
&& !cardType.equals("Island") && !cardType.equals("Forest")
&& !cardType.equals("Swamp"));
}
public static boolean isBasicLandType(String cardType) {
return (cardType.equals("Plains")
|| cardType.equals("Island") || cardType.equals("Swamp")
|| cardType.equals("Mountain") || cardType.equals("Forest"));
}
}