summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/art-data.pl
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-26 04:07:54 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-26 04:07:54 +0000
commit37bed710897dc75714b7dc761da4c6524eb95b66 (patch)
treebef27d99e930646af349a2c43b986b3ead9a254c /crawl-ref/source/util/art-data.pl
parent639b1fdb029edae195bb14c73cacb37871aae59b (diff)
downloadcrawl-ref-37bed710897dc75714b7dc761da4c6524eb95b66.tar.gz
crawl-ref-37bed710897dc75714b7dc761da4c6524eb95b66.zip
Unrandart properites which are either on/off are now turned on via the
BOOL field, with the different properties all listed at once, separated by commas. E.g., "BOOL: poison, life, elec" gives resistance to posion, negative energy and lightning. Added documentation of fields to art-data.txt git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10048 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/util/art-data.pl')
-rwxr-xr-xcrawl-ref/source/util/art-data.pl69
1 files changed, 48 insertions, 21 deletions
diff --git a/crawl-ref/source/util/art-data.pl b/crawl-ref/source/util/art-data.pl
index 48c966ac7a..3eb5b53453 100755
--- a/crawl-ref/source/util/art-data.pl
+++ b/crawl-ref/source/util/art-data.pl
@@ -14,10 +14,10 @@ my %field_type = (
ACC => "num",
ANGRY => "num",
APPEAR => "str",
- BERSERK => "num",
- BLINK => "num",
+ BERSERK => "bool",
+ BLINK => "bool",
BRAND => "enum",
- CANTELEP => "num",
+ CANTELEP => "bool",
COLD => "num",
COLOUR => "enum",
CURSED => "num",
@@ -26,25 +26,25 @@ my %field_type = (
DESC_END => "str",
DESC_ID => "str",
DEX => "num",
- ELEC => "num",
+ ELEC => "bool",
EV => "num",
FIRE => "num",
INT => "num",
- INV => "num",
- LEV => "num",
- LIFE => "num",
+ INV => "bool",
+ LEV => "bool",
+ LIFE => "bool",
MAGIC => "num",
- MAPPING => "num",
+ MAPPING => "bool",
METAB => "num",
MP => "num",
MUTATE => "num",
NAME => "str",
- NOISES => "num",
- NOSPELL => "num",
- NOTELEP => "num",
- POISON => "num",
- RND_TELE => "num",
- SEEINV => "num",
+ NOISES => "bool",
+ NOSPELL => "bool",
+ NOTELEP => "bool",
+ POISON => "bool",
+ RND_TELE => "bool",
+ SEEINV => "bool",
STEALTH => "num",
STR => "num",
@@ -136,7 +136,7 @@ sub finish_art
{
$artefact->{$field} = "";
}
- elsif($type eq "num")
+ elsif($type eq "num" || $type eq "bool")
{
$artefact->{$field} = "0";
}
@@ -203,11 +203,6 @@ sub process_line
return;
}
- if ($value eq "true" && $field_type{$field} eq "num")
- {
- $value = "1";
- }
-
$artefact->{_PREV_FIELD} = $field;
$artefact->{$field} = $value;
@@ -217,7 +212,33 @@ sub process_line
return;
}
- if ($field eq "OBJ")
+ if ($field eq "BOOL")
+ {
+ my @parts = split(/\s*,\s*/, $value);
+ my $part;
+ foreach $part (@parts)
+ {
+ my $up = uc($part);
+ if ($up eq "CURSED")
+ {
+ # Start out cursed, but don't re-curse.
+ $artefact->{CURSED} = -1;
+ }
+ elsif (!exists($field_type{$up}))
+ {
+ error($artefact, "Unknown bool '$part'");
+ }
+ elsif ($field_type{$up} ne "bool")
+ {
+ error($artefact, "'$part' is not a boolean");
+ }
+ else
+ {
+ $artefact->{$up} = 1;
+ }
+ }
+ }
+ elsif ($field eq "OBJ")
{
my @parts = split(m!/!, $value);
@@ -274,6 +295,12 @@ sub process_line
return;
}
+ if ($field_type{$field} eq "bool")
+ {
+ error($artefact, "'$field' should be expressed using BOOL");
+ return;
+ }
+
my $num = is_number($value);
my $type = $field_type{$field} || "";