- When keeping blockers back while assigning attackers, AI should consider his creatures with Vigilance safe to attack.

- AI (and player) shouldn't be able to cast Elephant Ambush multiple times from the graveyard anymore.
This commit is contained in:
jendave
2011-08-06 04:34:30 +00:00
parent 18014c8371
commit 36938c3d20
2 changed files with 18 additions and 6 deletions

View File

@@ -748,7 +748,6 @@ public class CardFactoryUtil {
PlayerLife compLife = AllZone.GameAction.getPlayerLife("Computer");
int life = compLife.getLife();
return (life > (loss + 2));
}
@@ -758,7 +757,10 @@ public class CardFactoryUtil {
String phase = AllZone.Phase.getPhase();
String activePlayer = AllZone.Phase.getActivePlayer();
return AllZone.GameAction.isCardInZone(sourceCard, grave)
ArrayList<Card> spellsOnStack = AllZone.Stack.getSourceCards();
Card sourceCard = this.getSourceCard();
return AllZone.GameAction.isCardInZone(sourceCard, grave) && !spellsOnStack.contains(sourceCard)
&& (sourceCard.isInstant() || (phase.equals(Constant.Phase.Main1) || phase.equals(Constant.Phase.Main2))
&& sourceCard.getController().equals(activePlayer) && AllZone.Stack.size() == 0);

View File

@@ -82,14 +82,16 @@ import java.util.*;
CardListUtil.sortAttack(humanList);
int blockersNeeded = computerList.size();
for(int i = 0; i < computerList.size(); i++) {
CardList list = computerList;
for(int i = 0; i < list.size(); i++) {
if(!doesHumanAttackAndWin(i)) {
blockersNeeded= i;
break;
}
}
if (blockersNeeded == computerList.size()) {
if (blockersNeeded == list.size()) {
// Human will win unless everything is kept back to block
return blockersNeeded;
}
@@ -124,8 +126,8 @@ import java.util.*;
}
}
if (blockersNeeded > computerList.size())
blockersNeeded = computerList.size();
if (blockersNeeded > list.size())
blockersNeeded = list.size();
return blockersNeeded;
}
@@ -225,6 +227,14 @@ import java.util.*;
CardListUtil.sortNonFlyingFirst(attackers);
CardListUtil.sortAttackLowFirst(attackers);
for (Card c:attackers)
{
if (c.getKeyword().contains("Vigilance"))
i--;
}
if (i < 0)
i = 0;
for(; i < attackers.size(); i++)
{