VerifyCardDataTest - update showCardInfo to check reference for both sides of the card

This commit is contained in:
jmlundeen 2025-11-28 10:30:33 -06:00
parent 97738afb9e
commit 436ac5bbbd

View file

@ -2788,8 +2788,12 @@ public class VerifyCardDataTest {
// format to print main card then spell card // format to print main card then spell card
card.getInitAbilities().getRules().forEach(this::printAbilityText); card.getInitAbilities().getRules().forEach(this::printAbilityText);
((CardWithSpellOption) card).getSpellCard().getAbilities().getRules().forEach(r -> printAbilityText(r.replace("— ", "\n"))); ((CardWithSpellOption) card).getSpellCard().getAbilities().getRules().forEach(r -> printAbilityText(r.replace("— ", "\n")));
} else if (card instanceof SplitCard || card instanceof ModalDoubleFacedCard) { } else if (card instanceof SplitCard || card instanceof DoubleFacedCard) {
card.getAbilities().getRules().forEach(this::printAbilityText); // format to print each side separately
System.out.println("=== " + ((CardWithHalves) card).getLeftHalfCard().getName() + " ===");
((CardWithHalves) card).getLeftHalfCard().getAbilities().getRules().forEach(this::printAbilityText);
System.out.println("=== " + ((CardWithHalves) card).getRightHalfCard().getName() + " ===");
((CardWithHalves) card).getRightHalfCard().getAbilities().getRules().forEach(this::printAbilityText);
} else { } else {
card.getRules().forEach(this::printAbilityText); card.getRules().forEach(this::printAbilityText);
} }
@ -2797,9 +2801,17 @@ public class VerifyCardDataTest {
// ref card // ref card
System.out.println(); System.out.println();
MtgJsonCard refMain = MtgJsonService.card(card.getName()); MtgJsonCard refMain = MtgJsonService.card(card.getName());
MtgJsonCard refSpell = null; Card cardMain = card;
MtgJsonCard refTwo = null;
Card cardTwo = null;
if (card instanceof CardWithSpellOption) { if (card instanceof CardWithSpellOption) {
refSpell = MtgJsonService.card(((CardWithSpellOption) card).getSpellCard().getName()); refTwo = MtgJsonService.card(((CardWithSpellOption) card).getSpellCard().getName());
cardTwo = ((CardWithSpellOption) card).getSpellCard();
} else if (card instanceof CardWithHalves) {
refMain = MtgJsonService.card(((CardWithHalves) card).getLeftHalfCard().getName());
cardMain = ((CardWithHalves) card).getLeftHalfCard();
refTwo = MtgJsonService.card(((CardWithHalves) card).getRightHalfCard().getName());
cardTwo = ((CardWithHalves) card).getRightHalfCard();
} }
if (refMain == null) { if (refMain == null) {
refMain = MtgJsonService.cardByClassName(foundClassName); refMain = MtgJsonService.cardByClassName(foundClassName);
@ -2807,9 +2819,9 @@ public class VerifyCardDataTest {
if (refMain != null) { if (refMain != null) {
System.out.println("ref: " + refMain.getNameAsFace() + " " + refMain.manaCost); System.out.println("ref: " + refMain.getNameAsFace() + " " + refMain.manaCost);
System.out.println(refMain.text); System.out.println(refMain.text);
if (refSpell != null) { if (refTwo != null) {
System.out.println(refSpell.getNameAsFace() + " " + refSpell.manaCost); System.out.println("ref: " + refTwo.getNameAsFace() + " " + refTwo.manaCost);
System.out.println(refSpell.text); System.out.println(refTwo.text);
} }
} else { } else {
System.out.println("WARNING, can't find mtgjson ref for " + card.getName()); System.out.println("WARNING, can't find mtgjson ref for " + card.getName());
@ -2817,9 +2829,10 @@ public class VerifyCardDataTest {
// additional check to simulate diff in rules // additional check to simulate diff in rules
if (refMain != null) { if (refMain != null) {
checkWrongAbilitiesText(card, refMain, 0, true); checkWrongAbilitiesText(cardMain, refMain, 0, true);
} else if (refSpell != null) { }
checkWrongAbilitiesText(((CardWithSpellOption) card).getSpellCard(), refSpell, 0, true); if (refTwo != null) {
checkWrongAbilitiesText(cardTwo, refTwo, 0, true);
} }
}); });
} }