diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-11 02:04:06 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-11 02:04:06 +0000 |
commit | da22878d26b040a59f621a3a79730ee4dd7f9816 (patch) | |
tree | f5685508acc38089b9248e2a908d00e3c912e53a /crawl-ref/source/itemname.cc | |
parent | c811dc1ac36c6e69df242cb04d5f7512d4fe4d5b (diff) | |
download | crawl-ref-da22878d26b040a59f621a3a79730ee4dd7f9816.tar.gz crawl-ref-da22878d26b040a59f621a3a79730ee4dd7f9816.zip |
Allow for the creation of named zombies and spectral things from named
non-unique monsters (including polymorphed uniques, so you can get things like
"A rat shaped Royal Jelly zombie").
Include the name of unique and named monsters in their corpse names, for things
like "The corpse of the Lernaean hydra" or "The human corpse of Sigmund".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8407 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r-- | crawl-ref/source/itemname.cc | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 6d9d551378..ee55efb22b 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -124,6 +124,29 @@ std::string item_def::name(description_level_type descrip, if (terse && descrip != DESC_DBNAME) descrip = DESC_PLAIN; + if (base_type == OBJ_CORPSES && is_named_corpse(*this) + && !starts_with(get_corpse_name(*this), "shaped ")) + { + switch (descrip) + { + case DESC_CAP_A: + case DESC_CAP_YOUR: + descrip = DESC_CAP_THE; + break; + + case DESC_NOCAP_A: + case DESC_NOCAP_YOUR: + case DESC_NOCAP_ITS: + case DESC_INVENTORY_EQUIP: + case DESC_INVENTORY: + descrip = DESC_NOCAP_THE; + break; + + default: + break; + } + } + if (this->base_type == OBJ_ORBS || (ident || item_type_known( *this )) && (this->base_type == OBJ_MISCELLANY @@ -1566,19 +1589,32 @@ std::string item_def::name_aux( description_level_type desc, break; case OBJ_CORPSES: + { if (food_is_rotten(*this) && !dbname) buff << "rotting "; - if (!dbname) + const std::string _name = get_corpse_name(*this); + const bool shaped = starts_with(_name, "shaped "); + + if (!dbname && !starts_with(_name, "the ")) + { buff << mons_type_name(it_plus, DESC_PLAIN) << ' '; + if (!_name.empty() && shaped) + buff << _name << ' '; + } + if (item_typ == CORPSE_BODY) buff << "corpse"; else if (item_typ == CORPSE_SKELETON) buff << "skeleton"; else buff << "corpse bug"; + + if (!_name.empty() && !shaped) + buff << " of " << _name; break; + } default: buff << "!"; @@ -2867,3 +2903,20 @@ std::vector<std::string> item_name_list_for_glyph(unsigned glyph) std::vector<std::string> empty; return empty; } + +bool is_named_corpse(const item_def &corpse) +{ + ASSERT(corpse.base_type == OBJ_CORPSES); + + return (corpse.props.exists(CORPSE_NAME_KEY)); +} + +std::string get_corpse_name(const item_def &corpse) +{ + ASSERT(corpse.base_type == OBJ_CORPSES); + + if (!corpse.props.exists(CORPSE_NAME_KEY)) + return (""); + + return (corpse.props[CORPSE_NAME_KEY].get_string()); +} |