@@ -602,7 +602,7 @@ private void checkAll(Card card, JsonCard ref) {
602
602
//checkNumbers(card, ref); // TODO: load data from allsets.json and check it (allcards.json do not have card numbers)
603
603
checkBasicLands (card , ref );
604
604
checkMissingAbilities (card , ref );
605
- //checkWrongCosts (card, ref);
605
+ checkWrongAbilitiesText (card , ref );
606
606
}
607
607
608
608
private void checkColors (Card card , JsonCard ref ) {
@@ -734,13 +734,23 @@ public void showCardInfo() throws Exception {
734
734
card .getRules ().stream ().forEach (System .out ::println );
735
735
}
736
736
737
- private void checkWrongCosts (Card card , JsonCard ref ) {
738
- // checks missing or wrong cost
739
- if (!card .getExpansionSetCode ().equals ("RNA " )) {
737
+ private void checkWrongAbilitiesText (Card card , JsonCard ref ) {
738
+ // checks missing or wrong text
739
+ if (!card .getExpansionSetCode ().equals ("WAR " )) {
740
740
return ;
741
741
}
742
742
743
- String [] refRules = ref .text .split ("[\\ $\\ \n ]" ); // ref card's abilities can be splited by \n or $ chars
743
+ if (ref .text == null || ref .text .isEmpty ()) {
744
+ return ;
745
+ }
746
+
747
+ String refText = ref .text ;
748
+ // lands fix
749
+ if (refText .startsWith ("(" ) && refText .endsWith (")" )) {
750
+ refText = refText .substring (1 , refText .length () - 1 );
751
+ }
752
+
753
+ String [] refRules = refText .split ("[\\ $\\ \n ]" ); // ref card's abilities can be splited by \n or $ chars
744
754
for (int i = 0 ; i < refRules .length ; i ++) {
745
755
refRules [i ] = prepareRule (card .getName (), refRules [i ]);
746
756
}
@@ -752,17 +762,15 @@ private void checkWrongCosts(Card card, JsonCard ref) {
752
762
753
763
for (String cardRule : cardRules ) {
754
764
boolean isAbilityFounded = false ;
755
- boolean isCostOk = false ;
756
765
for (String refRule : refRules ) {
757
766
if (cardRule .equals (refRule )) {
758
767
isAbilityFounded = true ;
759
- isCostOk = true ;
760
768
break ;
761
769
}
762
770
}
763
771
764
- if (!isCostOk ) {
765
- fail (card , "abilities" , " card ability have cost, but can't find in ref [" + "xxx" + ": " + card . getRules () + "]" );
772
+ if (!isAbilityFounded ) {
773
+ warn (card , "card ability can't be found in ref [" + card . getName () + ": " + cardRule + "]" );
766
774
}
767
775
}
768
776
}
0 commit comments