- Simplified removal of likely blockers in chooseCardsForConvoke()

This commit is contained in:
excessum
2014-09-28 01:10:06 +00:00
parent 43382d5f9d
commit 4b51b0f9e7

View File

@@ -817,27 +817,21 @@ public class PlayerControllerAi extends PlayerController {
} }
//Do not convoke potential blockers until after opponent's attack //Do not convoke potential blockers until after opponent's attack
final List<Card> notBlocking = CardLists.filter(untappedCreats, new Predicate<Card>() { final List<Card> blockers = ComputerUtilCard.getLikelyBlockers(ai, null);
@Override
public boolean apply(final Card c) {
return !ComputerUtilCard.doesSpecifiedCreatureBlock(ai, c);
}
});
boolean nonBlockers = false;
if ((ph.isPlayerTurn(ai) && ph.getPhase().isAfter(PhaseType.COMBAT_BEGIN)) || if ((ph.isPlayerTurn(ai) && ph.getPhase().isAfter(PhaseType.COMBAT_BEGIN)) ||
(!ph.isPlayerTurn(ai) && ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS))) { (!ph.isPlayerTurn(ai) && ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS))) {
nonBlockers = true; untappedCreats.removeAll(blockers);
//Add threatened creatures //Add threatened creatures
if (!ai.getGame().getStack().isEmpty()) { if (!ai.getGame().getStack().isEmpty()) {
final List<GameObject> objects = ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), null); final List<GameObject> objects = ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), null);
for (Card c : untappedCreats) { for (Card c : blockers) {
if (objects.contains(c) && !notBlocking.contains(c)) { if (objects.contains(c) && blockers.contains(c)) {
notBlocking.add(c); untappedCreats.add(c);
} }
} }
} }
} }
return ComputerUtilMana.getConvokeFromList(manaCost, nonBlockers ? notBlocking : untappedCreats); return ComputerUtilMana.getConvokeFromList(manaCost, untappedCreats);
} }
@Override @Override