- Improved AI playing equipments.

This commit is contained in:
Sloth
2013-04-05 11:33:10 +00:00
parent fa8c5c42d7
commit 625efdf7f1
2 changed files with 14 additions and 2 deletions

View File

@@ -489,9 +489,9 @@ public class AiController {
// cast 0 mana cost spells first (might be a Mox) // cast 0 mana cost spells first (might be a Mox)
if (a1 == 0) { if (a1 == 0) {
b1 = -2; return -1;
} else if (b1 == 0) { } else if (b1 == 0) {
a1 = -2; return 1;
} }
a1 += getSpellAbilityPriority(a); a1 += getSpellAbilityPriority(a);
@@ -506,6 +506,10 @@ public class AiController {
if (sa.getSourceCard().isCreature()) { if (sa.getSourceCard().isCreature()) {
p += 1; p += 1;
} }
// don't play equipments before having any creatures
if (sa.getSourceCard().isEquipment() && sa.getSourceCard().getController().getCreaturesInPlay().isEmpty()) {
p -= 9;
}
// sort planeswalker abilities for ultimate // sort planeswalker abilities for ultimate
if (sa.getRestrictions().getPlaneswalker()) { if (sa.getRestrictions().getPlaneswalker()) {
if (sa.hasParam("Ultimate")) { if (sa.hasParam("Ultimate")) {

View File

@@ -810,6 +810,14 @@ public class ComputerUtil {
|| card.hasKeyword("Haste"))) || card.hasKeyword("Exalted")) { || card.hasKeyword("Haste"))) || card.hasKeyword("Exalted")) {
return true; return true;
} }
//cast equipments in Main1 when there are creatures to equip
if (card.isEquipment()) {
for (Card c : card.getController().getCreaturesInPlay()) {
if (CombatUtil.canAttackNextTurn(c) && c.canBeEquippedBy(card)) {
return true;
}
}
}
// get all cards the computer controls with BuffedBy // get all cards the computer controls with BuffedBy
final List<Card> buffed = ai.getCardsIn(ZoneType.Battlefield); final List<Card> buffed = ai.getCardsIn(ZoneType.Battlefield);