summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-14 13:20:08 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-14 13:22:05 +1000
commitd39ce6d858545bf41a3b0b7e77e06807bc378ddc (patch)
tree0c24aa8774f13506920907c0060ff001986bbf38 /crawl-ref
parent59caf0a6e21f6437e001c5ed07590f32b6ea86a7 (diff)
downloadcrawl-ref-d39ce6d858545bf41a3b0b7e77e06807bc378ddc.tar.gz
crawl-ref-d39ce6d858545bf41a3b0b7e77e06807bc378ddc.zip
New monster vault flags: name_descriptor, name_definite.
This changes the mechanics of naming slightly, allowing you to give a monster a name that is a descriptor and will be treated with the usual articles (your, the, a, etc) rather than as a name. See documentation.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/develop/levels/syntax.txt24
-rw-r--r--crawl-ref/source/dat/float.des20
-rw-r--r--crawl-ref/source/dat/mini.des6
-rw-r--r--crawl-ref/source/enum.h9
-rw-r--r--crawl-ref/source/mapdef.cc13
-rw-r--r--crawl-ref/source/monster.cc14
6 files changed, 70 insertions, 16 deletions
diff --git a/crawl-ref/docs/develop/levels/syntax.txt b/crawl-ref/docs/develop/levels/syntax.txt
index 337580013d..d06192dd99 100644
--- a/crawl-ref/docs/develop/levels/syntax.txt
+++ b/crawl-ref/docs/develop/levels/syntax.txt
@@ -612,6 +612,30 @@ MONS: (list of monsters)
Will result in "Durwent" rather than "Durwent the Kobold".
+ In combinaton with name_replace, there are two further tags that
+ can be used when renaming monsters, but not giving them an actual
+ "name": name_descriptor, and name_definite.
+
+ For example:
+ MONS: kobold name:goblin name_replace
+
+ Will result in "goblin hits you". However, adding name_descriptor
+ from the above flags will result in "The goblin hits you" and in the
+ description of the monster, "A goblin".
+ MONS: kobold name:goblin name_replace name_descriptor
+
+ The name_definite flag ensures that it is never referred to as "a" or
+ "an", but that the definite object is always used. Therefore, you will
+ see "The goblin hits you", as per above, but also "The goblin" in its
+ description. Setting name_definite will automatically set the flag
+ name_descriptor, therefore meaning that:
+ MONS: kobold name:goblin name_replace name_definite
+
+ Is exactly the smae as:
+ MONS: kobold name:goblin name_replace name_descriptor name_definite
+
+ This allows for shorter definitions.
+
Monster names should be used very sparingly.
Overriding Monster Spells:
diff --git a/crawl-ref/source/dat/float.des b/crawl-ref/source/dat/float.des
index 786194e870..3402eba9e0 100644
--- a/crawl-ref/source/dat/float.des
+++ b/crawl-ref/source/dat/float.des
@@ -958,25 +958,25 @@ ORIENT: float
FLAGS: no_item_gen no_monster_gen
KFEAT: ABCDEFG = metal_wall
KMONS: 1 = col:gold skeletal warrior name:ancient_champion name_replace \
- spells:iron_shot;.;haste;pain;.;. actual_spells \
+ name_descriptor spells:iron_shot;.;haste;pain;.;. actual_spells \
; plate mail ego:fire_resistance | plate mail ego:cold_resistance . \
great sword ego:pain | great sword ego:draining | great sword \
ego:flaming | w:3 triple sword ego:vorpal
KMONS: 2 = col:gold skeletal warrior name:ancient_champion name_replace \
- spells:bolt_of_draining;.;haste;throw_frost;.;. actual_spells \
- ; plate mail ego:fire_resistance | plate mail ego:cold_resistance . \
- great mace ego:vorpal | great mace ego:draining
+ name_descriptor spells:bolt_of_draining;.;haste;throw_frost;.;. \
+ actual_spells ; plate mail ego:fire_resistance | plate mail \
+ ego:cold_resistance . great mace ego:vorpal | great mace ego:draining
KMONS: 3 = col:gold skeletal warrior name:ancient_champion name_replace \
- spells:venom_bolt;.;haste;haunt;.;. actual_spells \
+ name_descriptor spells:venom_bolt;.;haste;haunt;.;. actual_spells \
; plate mail ego:fire_resistance | plate mail ego:cold_resistance . \
battleaxe ego:vorpal | battleaxe ego:pain | \
w:3 executioner's axe ego:vorpal
KMONS: 4 = col:gold skeletal warrior name:ancient_champion name_replace \
- spells:iskenderun's_mystic_blast;slow;haste;.;.;. actual_spells \
- ; plate mail ego:fire_resistance | plate mail ego:cold_resistance . \
- great sword ego:pain | great sword ego:draining | great sword \
- ego:flaming | battleaxe ego:vorpal | battleaxe ego:pain | \
- triple sword ego:vorpal | executioner's axe ego:vorpal
+ name_descriptor spells:iskenderun's_mystic_blast;slow;haste;.;.;. \
+ actual_spells ; plate mail ego:fire_resistance | plate mail \
+ ego:cold_resistance . great sword ego:pain | great sword ego:draining \
+ | great sword ego:flaming | battleaxe ego:vorpal | battleaxe ego:pain \
+ | triple sword ego:vorpal | executioner's axe ego:vorpal
SHUFFLE: 123
KPROP: ]v.1234+ABCDEFG!n$wr|" = no_rtele_into
KITEM: w = acquire weapon
diff --git a/crawl-ref/source/dat/mini.des b/crawl-ref/source/dat/mini.des
index b27857e9fc..da3db7bd69 100644
--- a/crawl-ref/source/dat/mini.des
+++ b/crawl-ref/source/dat/mini.des
@@ -35,6 +35,12 @@ default-depth: D:8-27
##############################################################################
# Minivault balancer
#
+NAME: mini_test
+MONS: skeletal warrior name:ancient_champion name_replace name_descriptor name_definite
+MAP
+1
+ENDMAP
+
NAME: mini_dummy
DEPTH: 1-50, !D:1-27
TAGS: dummy
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index d33a2ec149..5234f373b1 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2158,7 +2158,14 @@ enum monster_flag_type
MF_PRIEST = 0x800000, // Is a priest (divine spells)
// for the conduct.
- MF_GOING_BERSERK = 0x1000000 // Is about to go berserk!
+ MF_GOING_BERSERK = 0x1000000,// Is about to go berserk!
+
+ MF_NAME_DESCRIPTOR = 0x2000000,// mname should be treated with normal
+ // grammar, ie, prevent "You hit red rat"
+ // and other such constructs.
+ MF_NAME_DEFINITE = 0x4000000 // give this monster the definite "the"
+ // article, instead of the indefinite "a"
+ // article.
};
// Adding slots breaks saves. YHBW.
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index bfa32eed3b..0ff5a83843 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2603,6 +2603,19 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
mspec.extra_monster_flags |= MF_NAME_ADJECTIVE;
else if (strip_tag(mon_str, "name_replace"))
mspec.extra_monster_flags |= MF_NAME_REPLACE;
+
+ // We should be able to combine this with name_replace.
+ if (strip_tag(mon_str, "name_descriptor"))
+ mspec.extra_monster_flags |= MF_NAME_DESCRIPTOR;
+ // Reasoning for this setting both flags: it does nothing with the
+ // description unless NAME_DESCRIPTOR is also set; thus, you end up
+ // with bloated vault description lines akin to: "name:blah_blah
+ // name_replace name_descrpitor name_definite".
+ if (strip_tag(mon_str, "name_definite"))
+ {
+ mspec.extra_monster_flags |= MF_NAME_DEFINITE;
+ mspec.extra_monster_flags |= MF_NAME_DESCRIPTOR;
+ }
}
trim_string(mon_str);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 3b3fab4bee..ab2e7f78b1 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -2051,7 +2051,8 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
// If the monster has an explicit name, return that, handling it like
// a unique's name. Special handling for named hydras.
if (desc != DESC_BASENAME && !mon.mname.empty()
- && mons_genus(nametype) != MONS_HYDRA)
+ && mons_genus(nametype) != MONS_HYDRA
+ && !testbits(mon.flags, MF_NAME_DESCRIPTOR))
{
return (mon.mname);
}
@@ -2063,7 +2064,8 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
// Start with the prefix.
// (Uniques don't get this, because their names are proper nouns.)
if (!mons_is_unique(nametype)
- && (mon.mname.empty() || mons_genus(nametype) == MONS_HYDRA))
+ && ((mon.mname.empty() || testbits(mon.flags, MF_NAME_DESCRIPTOR))
+ || mons_genus(nametype) == MONS_HYDRA))
{
const bool use_your = mon.friendly();
switch (desc)
@@ -2075,13 +2077,15 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
result = (use_your ? "your " : "the ");
break;
case DESC_CAP_A:
- if (mon.mname.empty())
+ if (mon.mname.empty() || (testbits(mon.flags, MF_NAME_DESCRIPTOR)
+ && !testbits(mon.flags, MF_NAME_DEFINITE)))
result = "A ";
else
result = "The ";
break;
case DESC_NOCAP_A:
- if (mon.mname.empty())
+ if (mon.mname.empty() || (testbits(mon.flags, MF_NAME_DESCRIPTOR)
+ && !testbits(mon.flags, MF_NAME_DEFINITE)))
result = "a ";
else
result = "the ";
@@ -2272,7 +2276,7 @@ std::string monsters::full_name(description_level_type desc,
const unsigned long flag = flags & MF_NAME_MASK;
- if (flag == MF_NAME_REPLACE)
+ if (flag == MF_NAME_REPLACE && !testbits(flags, MF_NAME_DESCRIPTOR))
{
switch(desc)
{