Added verify test to check missing second face cards in sets, fixed missing cards;

This commit is contained in:
Oleg Agafonov 2020-08-22 18:48:15 +04:00
parent 7aac355f4a
commit 1b430e5d99
9 changed files with 99 additions and 34 deletions

View file

@ -32,4 +32,16 @@ public final class MtgJsonCard {
public String layout;
public boolean isFullArt;
public List<String> printings; // set codes with that card
public String getRealCardName() {
// double faces cards must be split in different cards in xmage (so use faceName instead name)
// for card searching
if ("transform".equals(layout)
|| "flip".equals(layout)
|| "adventure".equals(layout)
|| "meld".equals(layout)) { // TODO: remove or keep after mtgjson's meld bug resolve https://github.com/mtgjson/mtgjson/issues/661
return faceName;
}
return asciiName != null ? asciiName : name;
}
}

View file

@ -78,7 +78,7 @@ public final class MtgJsonService {
String needName = convertXmageToMtgJsonCardName(name);
return set.cards.stream()
.filter(c -> needName.equals(c.name) || needName.equals(c.asciiName) || needName.equals(c.faceName))
.filter(c -> needName.equals(c.getRealCardName()))
.collect(Collectors.toList());
}
@ -146,7 +146,7 @@ public final class MtgJsonService {
public HashMap<String, ArrayList<MtgJsonCard>> data;
private boolean containsSameNames(ArrayList<MtgJsonCard> list) {
Set<String> names = list.stream().map(c -> c.name).collect(Collectors.toSet());
Set<String> names = list.stream().map(MtgJsonCard::getRealCardName).collect(Collectors.toSet());
return names.size() == 1;
}