summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-21 18:54:28 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-21 18:54:28 +0000
commit8138928e141a983b076cc6d116a74539c6726f8f (patch)
tree110554ae5a107dae92fea49cb965e140a425b0c0 /crawl-ref/source/describe.cc
parent9fd12611e22411e75014d154ca4026a1fe726811 (diff)
downloadcrawl-ref-8138928e141a983b076cc6d116a74539c6726f8f.tar.gz
crawl-ref-8138928e141a983b076cc6d116a74539c6726f8f.zip
Another fix of randart auto inscriptions, this time concerning
the number of "plusses" shown for mutagenic and stealth. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3453 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc43
1 files changed, 29 insertions, 14 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 9faa461141..d485075117 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -203,10 +203,10 @@ static std::vector<std::string> randart_propnames( const item_def& item )
// These come first, so they don't get chopped off!
{ "-CAST", RAP_PREVENT_SPELLCASTING, 2 },
{ "-TELE", RAP_PREVENT_TELEPORTATION, 2 },
- { "MUT", RAP_MUTAGENIC, 2 },
+ { "MUT", RAP_MUTAGENIC, 2 }, // handled specially
{ "*Rage", RAP_ANGRY, 2 },
{ "*TELE", RAP_CAUSE_TELEPORTATION, 2 },
- { "Hunger", RAP_METABOLISM, 1 },
+ { "Hunger", RAP_METABOLISM, 2 }, // handled specially
{ "Noisy", RAP_NOISES, 2 },
// Evokable abilities come second
@@ -218,7 +218,7 @@ static std::vector<std::string> randart_propnames( const item_def& item )
{ "+Map", RAP_MAPPING, 2 },
// Resists, also really important
- { "rElec", RAP_ELECTRICITY, 1 },
+ { "rElec", RAP_ELECTRICITY, 2 },
{ "rPois", RAP_POISON, 2 },
{ "rF", RAP_FIRE, 1 },
{ "rC", RAP_COLD, 1 },
@@ -237,7 +237,7 @@ static std::vector<std::string> randart_propnames( const item_def& item )
// Positive, qualitative attributes
{ "MP", RAP_MAGICAL_POWER, 0 },
{ "SInv", RAP_EYESIGHT, 2 },
- { "Stlth", RAP_STEALTH, 2 }
+ { "Stlth", RAP_STEALTH, 2 } // handled specially
};
// For randart jewellery, note the base jewellery type if it's not
@@ -255,9 +255,17 @@ static std::vector<std::string> randart_propnames( const item_def& item )
std::string ego = weapon_brand_name(item, true);
if (!ego.empty())
{
- // ugly hack...
+ // ugly hack to remove the brackets...
ego = ego.substr(2, ego.length()-3);
- ego += ",";
+
+ // and another one for adding a comma if needed
+ for ( unsigned i = 0; i < ARRAYSIZE(propanns); ++i )
+ if (known_proprt(propanns[i].prop))
+ {
+ ego += ",";
+ break;
+ }
+
propnames.push_back(ego);
}
}
@@ -276,20 +284,27 @@ static std::vector<std::string> randart_propnames( const item_def& item )
case 1: // e.g. F++
{
int sval = std::min(std::abs(val), 3);
-
- // list one '+' less for hunger, stealth, and shock resistance
- if ((propanns[i].prop == RAP_METABOLISM
- || propanns[i].prop == RAP_STEALTH
- || propanns[i].prop == RAP_ELECTRICITY) && sval > 0)
- {
- sval--;
- }
work << propanns[i].name
<< std::string(sval, (val > 0 ? '+' : '-'));
break;
}
case 2: // e.g. rPois or SInv
work << propanns[i].name;
+
+ // these need special handling, so we don't give anything away
+ if (propanns[i].prop == RAP_METABOLISM && val > 2
+ || propanns[i].prop == RAP_MUTAGENIC && val > 3
+ || propanns[i].prop == RAP_STEALTH && val > 20)
+ {
+ work << "+";
+ }
+ else if (propanns[i].prop == RAP_STEALTH && val < 0)
+ {
+ if (val < -20)
+ work << "--";
+ else
+ work << "-";
+ }
break;
}
propnames.push_back(work.str());