- Added the SVar NeedsToPlay. The AI won't play cards with it unless a valid card is on the battlefield.

- Updated the Lairs to use it.
This commit is contained in:
jendave
2011-08-07 00:21:47 +00:00
parent 8c429da712
commit b17eb43274
7 changed files with 31 additions and 10 deletions

View File

@@ -762,6 +762,19 @@ public class ComputerUtil
for (Card crd : lands)
landList.add(crd);
}
landList = landList.filter(new CardListFilter() {
public boolean addCard(Card c) {
if (c.getSVar("NeedsToPlay").length() > 0) {
String needsToPlay = c.getSVar("NeedsToPlay");
CardList list = AllZoneUtil.getCardsInPlay();
list = list.getValidCards(needsToPlay.split(","), c.getController(), c);
if (list.isEmpty()) return false;
}
return true;
}
});
while(!landList.isEmpty() && computer.canPlayLand()){
// play as many lands as you can

View File

@@ -228,6 +228,14 @@ public class Spell_Permanent extends Spell {
return false;
}
if (card.getSVar("NeedsToPlay").length() > 0) {
String needsToPlay = card.getSVar("NeedsToPlay");
CardList list = AllZoneUtil.getCardsInPlay();
list = list.getValidCards(needsToPlay.split(","), card.getController(), card);
if (list.isEmpty()) return false;
}
if (!checkETBEffects(card, this, null))
return false;