- Gave the generic auras code some AI. Will now check for aura magnets. If non found it will check for unenchanted cards and if there is non the AI will enchant a previously enchanted card.

This commit is contained in:
jendave
2011-08-06 21:30:22 +00:00
parent 3a12b95947
commit 15a0d22d1c

View File

@@ -1948,17 +1948,37 @@ class CardFactory_Auras {
player = AllZone.ComputerPlayer; player = AllZone.ComputerPlayer;
} }
CardList list = AllZoneUtil.getPlayerTypeInPlay(player, type); CardList list = AllZoneUtil.getPlayerTypeInPlay(player, type);
if (list.isEmpty()) return false; if (list.isEmpty()) return false;
//TODO - maybe do something intelligent here if it's not a curse, like // Enchant a random Aura magnet if one is in play.
//checking the aura magnet list // Else enchant a random unenchanted card if one exists.
// Enchant a previously enchanted card if no unenchanted cards exist.
if (! curse) {
CardList magnets = list.getEnchantMagnets();
if (! magnets.isEmpty()) {
list = magnets;
} else {
CardList notEnchanted = list.filter(AllZoneUtil.unenchanted);
if (! notEnchanted.isEmpty()) {
list = notEnchanted;
}
}
} else {
CardList notEnchanted = list.filter(AllZoneUtil.unenchanted);
if (! notEnchanted.isEmpty()) {
list = notEnchanted;
}
}
// We do not want the AI to always enchant the same card. // We do not want the AI to always enchant the same card.
list.shuffle();
list.shuffle();
setTargetCard(list.get(0)); setTargetCard(list.get(0));
return super.canPlayAI(); return super.canPlayAI();
}//canPlayAI() }//canPlayAI()
@Override @Override