mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
tests: added mtgjson rules output in test_showCardInfo
This commit is contained in:
parent
66d132776e
commit
bcea598fbd
2 changed files with 22 additions and 12 deletions
|
|
@ -63,6 +63,10 @@ public final class MtgJsonService {
|
||||||
return SetHolder.sets;
|
return SetHolder.sets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, MtgJsonCard> cards() {
|
||||||
|
return CardHolder.cards;
|
||||||
|
}
|
||||||
|
|
||||||
public static MtgJsonMetadata meta() {
|
public static MtgJsonMetadata meta() {
|
||||||
return SetHolder.meta;
|
return SetHolder.meta;
|
||||||
}
|
}
|
||||||
|
|
@ -94,19 +98,10 @@ public final class MtgJsonService {
|
||||||
|
|
||||||
private static <T> T findReference(Map<String, T> reference, String name) {
|
private static <T> T findReference(Map<String, T> reference, String name) {
|
||||||
T ref = reference.get(name);
|
T ref = reference.get(name);
|
||||||
if (ref == null) {
|
|
||||||
//name = name.replaceFirst("\\bA[Ee]", "Æ");
|
|
||||||
//ref = reference.get(name);
|
|
||||||
}
|
|
||||||
if (ref == null) {
|
|
||||||
//name = name.replace("'", "\""); // for Kongming, "Sleeping Dragon" & Pang Tong, "Young Phoenix"
|
|
||||||
//ref = reference.get(name);
|
|
||||||
}
|
|
||||||
if (ref == null) {
|
if (ref == null) {
|
||||||
name = convertXmageToMtgJsonCardName(name);
|
name = convertXmageToMtgJsonCardName(name);
|
||||||
ref = reference.get(name);
|
ref = reference.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,6 @@ public class VerifyCardDataTest {
|
||||||
// file name must be related to sample-decks folder
|
// file name must be related to sample-decks folder
|
||||||
// for linux/windows build system use paths constructor
|
// for linux/windows build system use paths constructor
|
||||||
skipListAddName(SKIP_LIST_SAMPLE_DECKS, Paths.get("Jumpstart", "jumpstart_custom.txt").toString()); // it's not a deck file
|
skipListAddName(SKIP_LIST_SAMPLE_DECKS, Paths.get("Jumpstart", "jumpstart_custom.txt").toString()); // it's not a deck file
|
||||||
skipListAddName(SKIP_LIST_SAMPLE_DECKS, Paths.get("Commander", "Commander 2019", "Merciless Rage.dck").toString()); // TODO: delete after Aeon Engine implemented
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ArrayList<String> outputMessages = new ArrayList<>();
|
private final ArrayList<String> outputMessages = new ArrayList<>();
|
||||||
|
|
@ -2121,13 +2120,18 @@ public class VerifyCardDataTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_showCardInfo() {
|
public void test_showCardInfo() {
|
||||||
// debug only: show direct card info from class file without db-recreate
|
// debug only: show direct card rules from a class file without db-recreate
|
||||||
// - search by card name: Spark Double
|
// - search by card name: Spark Double
|
||||||
// - search by class name: SparkDouble
|
// - search by class name: SparkDouble
|
||||||
// - multiple searches: name1;class2;name3
|
// - multiple searches: name1;class2;name3
|
||||||
String cardSearches = "Spark Double";
|
String cardSearches = "Spark Double;AbandonedSarcophagus";
|
||||||
|
|
||||||
|
// prepare DBs
|
||||||
CardScanner.scan();
|
CardScanner.scan();
|
||||||
|
MtgJsonService.cards();
|
||||||
|
|
||||||
Arrays.stream(cardSearches.split(";")).forEach(searchName -> {
|
Arrays.stream(cardSearches.split(";")).forEach(searchName -> {
|
||||||
|
// original card
|
||||||
searchName = searchName.trim();
|
searchName = searchName.trim();
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(searchName);
|
CardInfo cardInfo = CardRepository.instance.findCard(searchName);
|
||||||
if (cardInfo == null) {
|
if (cardInfo == null) {
|
||||||
|
|
@ -2144,6 +2148,7 @@ public class VerifyCardDataTest {
|
||||||
}
|
}
|
||||||
CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), "test", "123", Rarity.COMMON);
|
CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), "test", "123", Rarity.COMMON);
|
||||||
Card card = CardImpl.createCard(cardInfo.getClassName(), testSet);
|
Card card = CardImpl.createCard(cardInfo.getClassName(), testSet);
|
||||||
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(card.getName() + " " + card.getManaCost().getText());
|
System.out.println(card.getName() + " " + card.getManaCost().getText());
|
||||||
if (card instanceof SplitCard || card instanceof ModalDoubleFacedCard) {
|
if (card instanceof SplitCard || card instanceof ModalDoubleFacedCard) {
|
||||||
|
|
@ -2151,6 +2156,16 @@ public class VerifyCardDataTest {
|
||||||
} else {
|
} else {
|
||||||
card.getRules().forEach(this::printAbilityText);
|
card.getRules().forEach(this::printAbilityText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ref card
|
||||||
|
System.out.println();
|
||||||
|
MtgJsonCard ref = MtgJsonService.card(card.getName());
|
||||||
|
if (ref != null) {
|
||||||
|
System.out.println("ref: " + ref.getNameAsFace() + " " + ref.manaCost);
|
||||||
|
System.out.println(ref.text);
|
||||||
|
} else {
|
||||||
|
System.out.println("WARNING, can't find mtgjson ref for " + card.getName());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue