summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 19:08:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 19:08:03 +0000
commit1e14066ec4bae72628883a11e60460b6794645d0 (patch)
treec8cc530cc264af07d8c73510634da75c8f0886d4 /crawl-ref/source/directn.cc
parentb578218b05ae153f3425278bedbb8efca48e259e (diff)
downloadcrawl-ref-1e14066ec4bae72628883a11e60460b6794645d0.tar.gz
crawl-ref-1e14066ec4bae72628883a11e60460b6794645d0.zip
Fix 1951264: Buggy uniques' wielding messages.
Fix named orcs getting no descriptions. The descriptions will have to be tweaked, probably using lua, to allow for friendly orcs. The descriptions for orc priests look particularly out of place with Beogh. Viewing friendlies now also lists their quiver and alternate weapon. Dualwielders now never will pick up shields, and single wielders will drop their shield if they wield a two-handed weapon. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4755 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc53
1 files changed, 48 insertions, 5 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 9c70996b98..e1ef6b8547 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2165,10 +2165,10 @@ static void describe_monster(const monsters *mon)
std::string get_monster_desc(const monsters *mon, bool full_desc,
description_level_type mondtype)
{
- std::string desc = mon->name(mondtype);
+ std::string desc = "";
+ if (mondtype != DESC_NONE)
+ desc = mon->name(mondtype);
- const int mon_arm = mon->inv[MSLOT_ARMOUR];
- const int mon_shd = mon->inv[MSLOT_SHIELD];
std::string weap = "";
if (mon->type != MONS_DANCING_WEAPON)
@@ -2183,22 +2183,65 @@ std::string get_monster_desc(const monsters *mon, bool full_desc,
if (full_desc)
{
+ const int mon_arm = mon->inv[MSLOT_ARMOUR];
+ const int mon_shd = mon->inv[MSLOT_SHIELD];
+ const int mon_qvr = mon->inv[MSLOT_MISSILE];
+ const int mon_alt = mon->inv[MSLOT_ALT_WEAPON];
+
+ const bool need_quiver = (mon_qvr != NON_ITEM && mons_friendly(mon));
+ const bool need_alt_wpn = (mon_alt != NON_ITEM && mons_friendly(mon)
+ && !mons_wields_two_weapons(mon));
+ bool found_sth = !weap.empty();
+
+
if (mon_arm != NON_ITEM)
{
desc += ", ";
- if (!weap.empty() && mon_shd == NON_ITEM)
+ if (found_sth && mon_shd == NON_ITEM && !need_quiver
+ && !need_alt_wpn)
+ {
desc += "and ";
+ }
desc += "wearing ";
desc += mitm[mon_arm].name(DESC_NOCAP_A);
+ if (!found_sth)
+ found_sth = true;
}
if (mon_shd != NON_ITEM)
{
desc += ", ";
- if (!weap.empty() || mon_arm != NON_ITEM)
+ if (found_sth && !need_quiver && !need_alt_wpn)
desc += "and ";
desc += "wearing ";
desc += mitm[mon_shd].name(DESC_NOCAP_A);
+ if (!found_sth)
+ found_sth = true;
+ }
+
+ // For friendly monsters, also list quivered missiles
+ // and alternate weapon.
+ if (mons_friendly(mon))
+ {
+ if (mon_qvr != NON_ITEM)
+ {
+ desc += ", ";
+ if (found_sth && !need_alt_wpn)
+ desc += "and ";
+ desc += "quivering ";
+ desc += mitm[mon_qvr].name(DESC_NOCAP_A);
+ if (!found_sth)
+ found_sth = true;
+ }
+
+ if (need_alt_wpn)
+ {
+ desc += ", ";
+ if (found_sth)
+ desc += "and ";
+ desc += "carrying ";
+ desc += mitm[mon_alt].name(DESC_NOCAP_A);
+ }
}
}