mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- 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:
@@ -748,7 +748,6 @@ public class CardFactoryUtil {
|
|||||||
PlayerLife compLife = AllZone.GameAction.getPlayerLife("Computer");
|
PlayerLife compLife = AllZone.GameAction.getPlayerLife("Computer");
|
||||||
int life = compLife.getLife();
|
int life = compLife.getLife();
|
||||||
|
|
||||||
|
|
||||||
return (life > (loss + 2));
|
return (life > (loss + 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +757,10 @@ public class CardFactoryUtil {
|
|||||||
String phase = AllZone.Phase.getPhase();
|
String phase = AllZone.Phase.getPhase();
|
||||||
String activePlayer = AllZone.Phase.getActivePlayer();
|
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.isInstant() || (phase.equals(Constant.Phase.Main1) || phase.equals(Constant.Phase.Main2))
|
||||||
&& sourceCard.getController().equals(activePlayer) && AllZone.Stack.size() == 0);
|
&& sourceCard.getController().equals(activePlayer) && AllZone.Stack.size() == 0);
|
||||||
|
|
||||||
|
|||||||
@@ -82,14 +82,16 @@ import java.util.*;
|
|||||||
CardListUtil.sortAttack(humanList);
|
CardListUtil.sortAttack(humanList);
|
||||||
int blockersNeeded = computerList.size();
|
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)) {
|
if(!doesHumanAttackAndWin(i)) {
|
||||||
blockersNeeded= i;
|
blockersNeeded= i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockersNeeded == computerList.size()) {
|
if (blockersNeeded == list.size()) {
|
||||||
// Human will win unless everything is kept back to block
|
// Human will win unless everything is kept back to block
|
||||||
return blockersNeeded;
|
return blockersNeeded;
|
||||||
}
|
}
|
||||||
@@ -124,8 +126,8 @@ import java.util.*;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockersNeeded > computerList.size())
|
if (blockersNeeded > list.size())
|
||||||
blockersNeeded = computerList.size();
|
blockersNeeded = list.size();
|
||||||
return blockersNeeded;
|
return blockersNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +227,14 @@ import java.util.*;
|
|||||||
CardListUtil.sortNonFlyingFirst(attackers);
|
CardListUtil.sortNonFlyingFirst(attackers);
|
||||||
CardListUtil.sortAttackLowFirst(attackers);
|
CardListUtil.sortAttackLowFirst(attackers);
|
||||||
|
|
||||||
|
for (Card c:attackers)
|
||||||
|
{
|
||||||
|
if (c.getKeyword().contains("Vigilance"))
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
if (i < 0)
|
||||||
|
i = 0;
|
||||||
|
|
||||||
for(; i < attackers.size(); i++)
|
for(; i < attackers.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user