nonLandNames support. updated Conundrum Sphinx

This commit is contained in:
magenoxx 2011-06-08 18:15:38 +04:00
parent 6238e2dfa1
commit 41546cf7d3
2 changed files with 7 additions and 1 deletions

View file

@ -54,6 +54,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
private final static Logger logger = Logger.getLogger(Sets.class); private final static Logger logger = Logger.getLogger(Sets.class);
private static final Sets fINSTANCE = new Sets(); private static final Sets fINSTANCE = new Sets();
private static Set<String> names; private static Set<String> names;
private static Set<String> nonLandNames;
private static List<Card> cards; private static List<Card> cards;
protected static Random rnd = new Random(); protected static Random rnd = new Random();
@ -63,6 +64,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
private Sets() { private Sets() {
names = new TreeSet<String>(); names = new TreeSet<String>();
nonLandNames = new TreeSet<String>();
cards = new ArrayList<Card>(); cards = new ArrayList<Card>();
this.addSet(AlaraReborn.getInstance()); this.addSet(AlaraReborn.getInstance());
this.addSet(Apocalypse.getInstance()); this.addSet(Apocalypse.getInstance());
@ -95,6 +97,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
for (Card card: set.getCards()) { for (Card card: set.getCards()) {
cards.add(card); cards.add(card);
names.add(card.getName()); names.add(card.getName());
if (!card.getCardType().contains(CardType.LAND)) nonLandNames.add(card.getName());
} }
} }
@ -102,6 +105,10 @@ public class Sets extends HashMap<String, ExpansionSet> {
return names; return names;
} }
public static Set<String> getNonLandCardNames() {
return nonLandNames;
}
public static Card getRandomCard() { public static Card getRandomCard() {
return cards.get(rnd.nextInt(cards.size())); return cards.get(rnd.nextInt(cards.size()));
} }

View file

@ -90,7 +90,6 @@ class ConundrumSphinxEffect extends OneShotEffect<ConundrumSphinxEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Set<String> cardNames = Sets.getCardNames();
Choice cardChoice = new ChoiceImpl(); Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(Sets.getCardNames()); cardChoice.setChoices(Sets.getCardNames());
for (Player player: game.getPlayers().values()) { for (Player player: game.getPlayers().values()) {