subtypes detection

This commit is contained in:
Loki 2010-12-21 20:49:49 +02:00
parent 33bc20af68
commit 9a746bac6a
2 changed files with 21 additions and 1 deletions

View file

@ -44,7 +44,8 @@ public class [=$classname=] extends CardImpl<[=$classname=]> {
public [=$classname=] (UUID ownerId) { public [=$classname=] (UUID ownerId) {
super(ownerId, [=$collector=], "[=$name=]", Rarity.[=$rarity=], new CardType[]{[=$type=]}, "[=$manacost=]"); super(ownerId, [=$collector=], "[=$name=]", Rarity.[=$rarity=], new CardType[]{[=$type=]}, "[=$manacost=]");
this.expansionSetCode = "[=$setcode=]"; this.expansionSetCode = "[=$setcode=]";
this.subtype.add("");[= $colors=] [=$subtype=]
[=$colors=]
[=if (defined($power)) { [=if (defined($power)) {
$OUT .= "this.power = new MageInt($power);\n"; $OUT .= "this.power = new MageInt($power);\n";
}=][=if (defined($toughness)) { }=][=if (defined($toughness)) {

View file

@ -246,6 +246,12 @@ $manatocolor{'Green'} = " this.color.setGreen(true);";
$manatocolor{'Red'} = " this.color.setRed(true);"; $manatocolor{'Red'} = " this.color.setRed(true);";
$manatocolor{'White'} = " this.color.setWhite(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; my %normalid;
print "Enter a card name: "; print "Enter a card name: ";
@ -295,16 +301,29 @@ foreach my $div (@divs) {
} }
} }
if ($id =~m/typeRow/) { if ($id =~m/typeRow/) {
my $typestring = "";
my $subtype = "";
foreach my $sub ($div->look_down('_tag', 'div')) { foreach my $sub ($div->look_down('_tag', 'div')) {
if (defined($sub->attr('class')) && $sub->attr('class') eq 'value') { if (defined($sub->attr('class')) && $sub->attr('class') eq 'value') {
my $type = $sub->as_text(); my $type = $sub->as_text();
chomp $type; chomp $type;
while ( $type =~ m/([a-zA-z]+)( )*/g ) { while ( $type =~ m/([a-zA-z]+)( )*/g ) {
push @types, $1; 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/) { if ($id =~m/manaRow/) {
my $findedcolors; my $findedcolors;
foreach my $sub ($div->look_down('_tag', 'img')) { foreach my $sub ($div->look_down('_tag', 'img')) {