1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-01 19:07:57 -09:00

Test that reproduces Issue 266. Fixed Issue 266.

This commit is contained in:
magenoxx 2011-09-28 09:00:44 +04:00
parent 614a3b0d13
commit f8c853fe4e

View file

@ -182,7 +182,7 @@ public class DeckGenerator {
symbol = symbol.replace("{", "").replace("}", "");
if (isColoredMana(symbol)) {
for (ColoredManaSymbol allowed : allowedColors) {
if (allowed.toString().equals(symbol)) {
if (symbol.contains(allowed.toString())) {
found = true;
break;
}
@ -279,6 +279,33 @@ public class DeckGenerator {
}
protected static boolean isColoredMana(String symbol) {
return symbol.equals("W") || symbol.equals("G") || symbol.equals("U") || symbol.equals("B") || symbol.equals("R");
return symbol.equals("W") || symbol.equals("G") || symbol.equals("U") || symbol.equals("B") || symbol.equals("R") || symbol.contains("/");
}
public static void main(String[] args) {
Card selesnyaGuildMage = null;
for (Card card : CardsStorage.getAllCards()) {
if (card.getName().equals("Selesnya Guildmage")) {
selesnyaGuildMage = card;
break;
}
}
if (selesnyaGuildMage == null) {
throw new RuntimeException("Couldn't find card: Selesnya Guildmage");
}
List<ColoredManaSymbol> allowedColors = new ArrayList<ColoredManaSymbol>();
allowedColors.add(ColoredManaSymbol.lookup('B'));
allowedColors.add(ColoredManaSymbol.lookup('R'));
System.out.println(DeckGenerator.cardFitsChosenColors(selesnyaGuildMage, allowedColors));
allowedColors.clear();
allowedColors = new ArrayList<ColoredManaSymbol>();
allowedColors.add(ColoredManaSymbol.lookup('G'));
System.out.println(DeckGenerator.cardFitsChosenColors(selesnyaGuildMage, allowedColors));
allowedColors.clear();
allowedColors = new ArrayList<ColoredManaSymbol>();
allowedColors.add(ColoredManaSymbol.lookup('W'));
System.out.println(DeckGenerator.cardFitsChosenColors(selesnyaGuildMage, allowedColors));
}
}