mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Improved the AI of AF Bounce a little.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user