mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
*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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user