AI_getBestEnchantment, Artifact and Permanent

While testing the AI handling the Bounce keyword, I noticed that the AI doesn't pick the most expensive Permanent. So I looked into the functions in CardFactoryUtil.java and I think they don't work as intended.
This entry should sort out the card with the biggest mana cost:
This entry should sort out the card with the biggest mana cost:
- Code: Select all
...
//get biggest Enchantment
Card biggest = null;
biggest = all.get(0);
for(int i = 0; i < all.size(); i++) {
if(CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil.getConvertedManaCost(biggest.getManaCost())) {
biggest = all.get(i);
}
}
return biggest;
- Code: Select all
if(CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil.getConvertedManaCost(biggest.getManaCost()))
- Code: Select all
if(CardUtil.getConvertedManaCost(all.get(i).getManaCost()) >= CardUtil.getConvertedManaCost(biggest.getManaCost()))