- Improved the AI of AF Bounce a little.

This commit is contained in:
jendave
2011-08-06 10:49:58 +00:00
parent 88b8ed0943
commit e849b09b50
2 changed files with 23 additions and 2 deletions

View File

@@ -180,7 +180,7 @@ public class AbilityFactory_Bounce {
Card choice = null;
if (list.getNotType("Creature").size() == 0)
choice = CardFactoryUtil.AI_getBestCreature(list); //if the targets are only creatures, take the best
choice = CardFactoryUtil.AI_getBestCreatureToBounce(list); //if the targets are only creatures, take the best
else
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), true);

View File

@@ -517,7 +517,6 @@ public class CardFactoryUtil {
all = all.getType("Creature");
Card biggest = null;
//if flying creature is small, get biggest non-flying creature
if(all.size() != 0) {
biggest = all.get(0);
@@ -527,6 +526,28 @@ public class CardFactoryUtil {
return biggest;
}
//This selection rates tokens higher
public static Card AI_getBestCreatureToBounce(CardList list) {
CardList all = list;
all = all.getType("Creature");
Card biggest = null; //returns null if list.size() == 0
int biggestvalue = 0;
int newvalue = 0;
if(all.size() != 0) {
biggest = all.get(0);
for(int i = 0; i < all.size(); i++) {
biggestvalue = evaluateCreature(biggest);
if (biggest.isToken()) biggestvalue += 100; // raise the value of tokens
newvalue = evaluateCreature(all.get(i));
if (all.get(i).isToken()) newvalue += 100; // raise the value of tokens
if(evaluateCreature(biggest) < evaluateCreature(all.get(i))) biggest = all.get(i);
}
}
return biggest;
}
//returns null if list.size() == 0
public static Card AI_getWorstCreature(CardList list) {
CardList all = list;