Tests: added additional checks on boosters (see #8081);

This commit is contained in:
Oleg Agafonov 2021-07-31 19:50:57 +04:00
parent 1ac33efd1b
commit 5e91099f62
3 changed files with 21 additions and 0 deletions

View file

@ -28,7 +28,9 @@ public final class StarWars extends ExpansionSet {
this.numBoosterCommon = 10; this.numBoosterCommon = 10;
this.numBoosterUncommon = 3; this.numBoosterUncommon = 3;
this.numBoosterRare = 1; this.numBoosterRare = 1;
this.numBoosterDoubleFaced = 1;
this.ratioBoosterMythic = 8; this.ratioBoosterMythic = 8;
cards.add(new SetCardInfo("A-Wing", 96, Rarity.UNCOMMON, mage.cards.a.AWing.class)); cards.add(new SetCardInfo("A-Wing", 96, Rarity.UNCOMMON, mage.cards.a.AWing.class));
cards.add(new SetCardInfo("AAT-1", 160, Rarity.UNCOMMON, mage.cards.a.AAT1.class)); cards.add(new SetCardInfo("AAT-1", 160, Rarity.UNCOMMON, mage.cards.a.AAT1.class));
cards.add(new SetCardInfo("Acklay of the Arena", 161, Rarity.RARE, mage.cards.a.AcklayOfTheArena.class)); cards.add(new SetCardInfo("Acklay of the Arena", 161, Rarity.RARE, mage.cards.a.AcklayOfTheArena.class));

View file

@ -911,11 +911,16 @@ public class VerifyCardDataTest {
cardNames.add(cardInfo.getName()); cardNames.add(cardInfo.getName());
} }
boolean containsDoubleSideCards = false;
for (ExpansionSet.SetCardInfo cardInfo : set.getSetCardInfo()) { for (ExpansionSet.SetCardInfo cardInfo : set.getSetCardInfo()) {
Card card = CardImpl.createCard(cardInfo.getCardClass(), new CardSetInfo(cardInfo.getName(), set.getCode(), Card card = CardImpl.createCard(cardInfo.getCardClass(), new CardSetInfo(cardInfo.getName(), set.getCode(),
cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo())); cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo()));
Assert.assertNotNull(card); Assert.assertNotNull(card);
if (card.getSecondCardFace() != null) {
containsDoubleSideCards = true;
}
// CHECK: all planeswalkers must be legendary // CHECK: all planeswalkers must be legendary
if (card.isPlaneswalker() && !card.getSuperType().contains(SuperType.LEGENDARY)) { if (card.isPlaneswalker() && !card.getSuperType().contains(SuperType.LEGENDARY)) {
errorsList.add("Error: planeswalker must have legendary type: " + set.getCode() + " - " + set.getName() + " - " + card.getName() + " - " + card.getCardNumber()); errorsList.add("Error: planeswalker must have legendary type: " + set.getCode() + " - " + set.getName() + " - " + card.getName() + " - " + card.getCardNumber());
@ -940,6 +945,16 @@ public class VerifyCardDataTest {
} }
*/ */
} }
// CHECK: double side cards must be in boosters
boolean hasBoosterSettings = (set.getNumBoosterDoubleFaced() > 0);
if (set.hasBoosters()
&& (set.getNumBoosterDoubleFaced() != -1) // -1 must ignore double cards in booster
&& containsDoubleSideCards
&& !hasBoosterSettings) {
errorsList.add("Error: set with boosters contains second side cards, but numBoosterDoubleFaced is not set - "
+ set.getCode() + " - " + set.getName());
}
} }
printMessages(warningsList); printMessages(warningsList);

View file

@ -672,4 +672,8 @@ public abstract class ExpansionSet implements Serializable {
return maxCardNumberInBooster; return maxCardNumberInBooster;
} }
public int getNumBoosterDoubleFaced() {
return numBoosterDoubleFaced;
}
} }