added specialized method getArtificialChoiceResults for MagicScryChoice to handle case where there is no cards in library

master
melvin 2013-11-03 09:33:52 +08:00
parent 79b858f3cb
commit 9984c56474
1 changed files with 19 additions and 0 deletions

View File

@ -12,11 +12,30 @@ import magic.ui.UndoClickedException;
import magic.ui.choice.MayChoicePanel;
import java.util.concurrent.Callable;
import java.util.List;
import java.util.ArrayList;
public class MagicScryChoice extends MagicMayChoice {
public MagicScryChoice() {
super("Put this card on the bottom of your library?");
}
@Override
public List<Object[]> getArtificialChoiceResults(
final MagicGame game,
final MagicEvent event,
final MagicPlayer player,
final MagicSource source) {
final MagicCard topCard = player.getLibrary().getCardAtTop();
if (topCard == MagicCard.NONE) {
final List<Object[]> choiceResultsList=new ArrayList<Object[]>();
choiceResultsList.add(new Object[]{NO_CHOICE});
return choiceResultsList;
} else {
return NO_OTHER_CHOICE_RESULTS;
}
}
@Override
public Object[] getPlayerChoiceResults(