diff --git a/Utils/cardclass.tmpl b/Utils/cardclass.tmpl index 852d9a4749..7033dfe295 100644 --- a/Utils/cardclass.tmpl +++ b/Utils/cardclass.tmpl @@ -44,7 +44,8 @@ public class [=$classname=] extends CardImpl<[=$classname=]> { public [=$classname=] (UUID ownerId) { super(ownerId, [=$collector=], "[=$name=]", Rarity.[=$rarity=], new CardType[]{[=$type=]}, "[=$manacost=]"); this.expansionSetCode = "[=$setcode=]"; - this.subtype.add("");[= $colors=] + [=$subtype=] + [=$colors=] [=if (defined($power)) { $OUT .= "this.power = new MageInt($power);\n"; }=][=if (defined($toughness)) { diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index 5b732cbd57..adc9c2bb97 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -246,6 +246,12 @@ $manatocolor{'Green'} = " this.color.setGreen(true);"; $manatocolor{'Red'} = " this.color.setRed(true);"; $manatocolor{'White'} = " this.color.setWhite(true);"; +my %cardtypes; +$cardtypes{'Artifact'} = "CardType.ARTIFACT"; +$cardtypes{'Creature'} = "CardType.CREATURE"; +$cardtypes{'Instant'} = "CardType.INSTANT"; +$cardtypes{'Sorcery'} = "CardType.SORCERY"; + my %normalid; print "Enter a card name: "; @@ -295,15 +301,28 @@ foreach my $div (@divs) { } } if ($id =~m/typeRow/) { + my $typestring = ""; + my $subtype = ""; foreach my $sub ($div->look_down('_tag', 'div')) { if (defined($sub->attr('class')) && $sub->attr('class') eq 'value') { my $type = $sub->as_text(); chomp $type; while ( $type =~ m/([a-zA-z]+)( )*/g ) { push @types, $1; + if (exists($cardtypes{$1})) { + if (length($typestring) > 0) { + $typestring .= ", " . $cardtypes{$1}; + } else { + $typestring = $cardtypes{$1}; + } + } else { + $subtype .= " this.subtype.add(\"$1\");\n"; + } } } } + $vars{'type'} = $typestring; + $vars{'subtype'} = $subtype; } if ($id =~m/manaRow/) { my $findedcolors;