From 37bed710897dc75714b7dc761da4c6524eb95b66 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Fri, 26 Jun 2009 04:07:54 +0000 Subject: 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 --- crawl-ref/source/util/art-data.pl | 69 +++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 21 deletions(-) (limited to 'crawl-ref/source/util/art-data.pl') 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} || ""; -- cgit v1.2.3-54-g00ecf