mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
tests: improved verify checks for emblems and tokens
This commit is contained in:
parent
ebef329bc3
commit
ef8535314f
1 changed files with 13 additions and 2 deletions
|
@ -1364,7 +1364,14 @@ public class VerifyCardDataTest {
|
||||||
List<Card> cardsList = new ArrayList<>(CardScanner.getAllCards());
|
List<Card> cardsList = new ArrayList<>(CardScanner.getAllCards());
|
||||||
Map<String, List<Card>> setsWithTokens = new HashMap<>();
|
Map<String, List<Card>> setsWithTokens = new HashMap<>();
|
||||||
for (Card card : cardsList) {
|
for (Card card : cardsList) {
|
||||||
String allRules = String.join(" ", card.getRules()).toLowerCase(Locale.ENGLISH);
|
// must check all card parts (example: Mila, Crafty Companion with Lukka Emblem)
|
||||||
|
String allRules = CardUtil.getObjectPartsAsObjects(card)
|
||||||
|
.stream()
|
||||||
|
.map(obj -> (Card) obj)
|
||||||
|
.map(Card::getRules)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(r -> r.toLowerCase(Locale.ENGLISH))
|
||||||
|
.collect(Collectors.joining("; "));
|
||||||
if ((allRules.contains("create") && allRules.contains("token"))
|
if ((allRules.contains("create") && allRules.contains("token"))
|
||||||
|| (allRules.contains("get") && allRules.contains("emblem"))) {
|
|| (allRules.contains("get") && allRules.contains("emblem"))) {
|
||||||
List<Card> sourceCards = setsWithTokens.getOrDefault(card.getExpansionSetCode(), null);
|
List<Card> sourceCards = setsWithTokens.getOrDefault(card.getExpansionSetCode(), null);
|
||||||
|
@ -1400,8 +1407,12 @@ public class VerifyCardDataTest {
|
||||||
String needTokenName = token.getName()
|
String needTokenName = token.getName()
|
||||||
.replace(" Token", "")
|
.replace(" Token", "")
|
||||||
.replace("Emblem ", "");
|
.replace("Emblem ", "");
|
||||||
// need add card name, so it will skip no name emblems like Sarkhan, the Dragonspeaker
|
// cards with emblems don't use emblem's name, so check it in card name itself (example: Sarkhan, the Dragonspeaker)
|
||||||
|
// also must check all card parts (example: Mila, Crafty Companion with Lukka Emblem)
|
||||||
if (sourceCards.stream()
|
if (sourceCards.stream()
|
||||||
|
.map(CardUtil::getObjectPartsAsObjects)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(obj -> (Card) obj)
|
||||||
.map(card -> card.getName() + " - " + String.join(", ", card.getRules()))
|
.map(card -> card.getName() + " - " + String.join(", ", card.getRules()))
|
||||||
.noneMatch(s -> s.contains(needTokenName))) {
|
.noneMatch(s -> s.contains(needTokenName))) {
|
||||||
warningsList.add("info, tok-data has un-used tokens: "
|
warningsList.add("info, tok-data has un-used tokens: "
|
||||||
|
|
Loading…
Reference in a new issue