Short-circuit card selection.

This commit is contained in:
marcins78@gmail.com
2011-09-11 07:49:55 +00:00
parent 0e924d2a00
commit 56daf9d6a7
2 changed files with 13 additions and 12 deletions

View File

@@ -34,10 +34,6 @@ public class PlayPermanentAction implements CostToEffectAction {
private Effect _discardCardEffect;
private boolean _cardDiscarded;
public PlayPermanentAction(PhysicalCard card, Zone zone) {
this(card, zone, 0);
}
public PlayPermanentAction(PhysicalCard card, Zone zone, int twilightModifier) {
_source = card;

View File

@@ -32,14 +32,19 @@ public abstract class ChooseActiveCardsEffect extends UnrespondableEffect {
@Override
public void playEffect(LotroGame game) {
game.getUserFeedback().sendAwaitingDecision(_playerId,
new CardsSelectionDecision(1, _choiceText, Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filters), _minimum, _maximum) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
cardsSelected(selectedCards);
}
});
List<PhysicalCard> matchingCards = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filters);
if (matchingCards.size() == _minimum) {
cardsSelected(matchingCards);
} else {
game.getUserFeedback().sendAwaitingDecision(_playerId,
new CardsSelectionDecision(1, _choiceText, matchingCards, _minimum, _maximum) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
cardsSelected(selectedCards);
}
});
}
}
protected abstract void cardsSelected(List<PhysicalCard> cards);