- Fixed TwoPilesEffect

This commit is contained in:
swordshine
2014-05-22 01:43:02 +00:00
parent a2102d4a4a
commit f67ea4a7f0
2 changed files with 6 additions and 2 deletions

View File

@@ -1395,6 +1395,7 @@ public class AiController {
List<Card> result = new ArrayList<>(); List<Card> result = new ArrayList<>();
switch( sa.getApi()) { switch( sa.getApi()) {
case TwoPiles: case TwoPiles:
// TODO: improve AI
Card biggest = null; Card biggest = null;
Card smallest = null; Card smallest = null;
biggest = pool.get(0); biggest = pool.get(0);
@@ -1409,7 +1410,7 @@ public class AiController {
} }
result.add(biggest); result.add(biggest);
if (max >= 3 && !result.contains(smallest)) { if (max > 3 && !result.contains(smallest)) {
result.add(smallest); result.add(smallest);
} }
break; break;

View File

@@ -86,9 +86,12 @@ public class TwoPilesEffect extends SpellAbilityEffect {
} }
List<Card> pool = CardLists.getValidCards(pool0, valid, card.getController(), card); List<Card> pool = CardLists.getValidCards(pool0, valid, card.getController(), card);
int size = pool.size(); int size = pool.size();
if (size == 0) {
return;
}
// first, separate the cards into piles // first, separate the cards into piles
final List<Card> pile1 = separator.getController().chooseCardsForEffect(pool, sa, "Divide cards into two piles", 1, size - 1, false); final List<Card> pile1 = separator.getController().chooseCardsForEffect(pool, sa, "Divide cards into two piles", 0, size, false);
final List<Card> pile2 = Lists.newArrayList(pool); final List<Card> pile2 = Lists.newArrayList(pool);
Iterables.removeAll(pile2, pile1); Iterables.removeAll(pile2, pile1);