Skip to content

Commit

Permalink
Tests: added additional checks on boosters (see #8081);
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Jul 31, 2021
1 parent 1ac33ef commit 5e91099
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Mage.Sets/src/mage/sets/StarWars.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ private StarWars() {
this.numBoosterCommon = 10;
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.numBoosterDoubleFaced = 1;
this.ratioBoosterMythic = 8;

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("Acklay of the Arena", 161, Rarity.RARE, mage.cards.a.AcklayOfTheArena.class));
Expand Down
15 changes: 15 additions & 0 deletions Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,16 @@ public void test_checkMissingCardData() {
cardNames.add(cardInfo.getName());
}

boolean containsDoubleSideCards = false;
for (ExpansionSet.SetCardInfo cardInfo : set.getSetCardInfo()) {
Card card = CardImpl.createCard(cardInfo.getCardClass(), new CardSetInfo(cardInfo.getName(), set.getCode(),
cardInfo.getCardNumber(), cardInfo.getRarity(), cardInfo.getGraphicInfo()));
Assert.assertNotNull(card);

if (card.getSecondCardFace() != null) {
containsDoubleSideCards = true;
}

// CHECK: all planeswalkers must be 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());
Expand All @@ -940,6 +945,16 @@ public void test_checkMissingCardData() {
}
*/
}

// 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);
Expand Down
4 changes: 4 additions & 0 deletions Mage/src/main/java/mage/cards/ExpansionSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -672,4 +672,8 @@ public int getMaxCardNumberInBooster() {
return maxCardNumberInBooster;
}

public int getNumBoosterDoubleFaced() {
return numBoosterDoubleFaced;
}

}

0 comments on commit 5e91099

Please sign in to comment.