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) {
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)) {

View file

@ -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;