summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-06 12:09:54 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-06 12:09:54 +0000
commitc1e82ffdede890ab2ba3cea0861fb937ac02c38b (patch)
tree311c03227cca6a6b28718f68cd841095f16e1f40
parentb65a80651c57c97676d17e5fe9a1060ce9e8eef4 (diff)
downloadcrawl-ref-c1e82ffdede890ab2ba3cea0861fb937ac02c38b.tar.gz
crawl-ref-c1e82ffdede890ab2ba3cea0861fb937ac02c38b.zip
Fix 2038651: real/fake rakshasa identity being leaked by monster pane window
and 'x' description. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6783 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/directn.cc10
-rw-r--r--crawl-ref/source/output.cc38
2 files changed, 32 insertions, 16 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 74b1143a49..095f917f1d 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2803,8 +2803,14 @@ std::string get_monster_desc(const monsters *mon, bool full_desc,
std::string weap = "";
- if (mon->type != MONS_DANCING_WEAPON)
+ // We don't report rakshasa equipment in order not to give away the
+ // true rakshasa when it summons.
+
+ if (mon->type != MONS_DANCING_WEAPON
+ && (mon->type != MONS_RAKSHASA || mons_friendly(mon)))
+ {
weap = _describe_monster_weapon(mon);
+ }
if (!weap.empty())
{
@@ -2814,7 +2820,7 @@ std::string get_monster_desc(const monsters *mon, bool full_desc,
}
// Print the rest of the equipment only for full descriptions.
- if (full_desc)
+ if (full_desc && (mon->type != MONS_RAKSHASA || mons_friendly(mon)))
{
const int mon_arm = mon->inv[MSLOT_ARMOUR];
const int mon_shd = mon->inv[MSLOT_SHIELD];
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 744a87b326..a9e7105c7a 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1176,10 +1176,14 @@ monster_pane_info::monster_pane_info(const monsters *m)
// will break saves a little bit though.
m_attitude = mons_attitude(m);
+ int mtype = m->type;
+ if ( mtype == MONS_RAKSHASA_FAKE )
+ mtype = MONS_RAKSHASA;
+
// Currently, difficulty is defined as "average hp". Leaks too much info?
- const monsterentry* me = get_monster_data(m->type);
+ const monsterentry* me = get_monster_data(mtype);
// [ds] XXX: Use monster experience value as a better indicator of diff.?
- m_difficulty = me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]>>1))
+ m_difficulty = me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]/2))
+ me->hpdice[3];
// [ds] XXX: Kill the magic numbers.
@@ -1205,12 +1209,21 @@ bool monster_pane_info::less_than(const monster_pane_info& m1,
else if (m1.m_attitude > m2.m_attitude)
return (false);
+ int m1type = m1.m_mon->type;
+ int m2type = m2.m_mon->type;
+
+ // Don't differentiate real rakshasas from fake ones.
+ if ( m1type == MONS_RAKSHASA_FAKE )
+ m1type = MONS_RAKSHASA;
+ if ( m2type == MONS_RAKSHASA_FAKE )
+ m2type = MONS_RAKSHASA;
+
// Force plain but different coloured draconians to be treated like the
// same sub-type.
- if (!zombified && m1.m_mon->type >= MONS_DRACONIAN
- && m1.m_mon->type <= MONS_PALE_DRACONIAN
- && m2.m_mon->type >= MONS_DRACONIAN
- && m2.m_mon->type <= MONS_PALE_DRACONIAN)
+ if (!zombified && m1type >= MONS_DRACONIAN
+ && m1type <= MONS_PALE_DRACONIAN
+ && m2type >= MONS_DRACONIAN
+ && m2type <= MONS_PALE_DRACONIAN)
{
return (false);
}
@@ -1222,20 +1235,17 @@ bool monster_pane_info::less_than(const monster_pane_info& m1,
return (false);
// Force mimics of different types to be treated like the same one.
- if (mons_is_mimic(m1.m_mon->type)
- && mons_is_mimic(m2.m_mon->type))
- {
+ if (mons_is_mimic(m1type) && mons_is_mimic(m2type))
return (false);
- }
- if (m1.m_mon->type < m2.m_mon->type)
+ if (m1type < m2type)
return (true);
- else if (m1.m_mon->type > m2.m_mon->type)
+ else if (m1type > m2type)
return (false);
// Never distinguish between dancing weapons.
// The above checks guarantee that *both* monsters are of this type.
- if (m1.m_mon->type == MONS_DANCING_WEAPON)
+ if (m1type == MONS_DANCING_WEAPON)
return (false);
if (zombified)
@@ -1256,7 +1266,7 @@ bool monster_pane_info::less_than(const monster_pane_info& m1,
}
}
- if (m1.m_fullname && m2.m_fullname || m1.m_mon->type == MONS_PLAYER_GHOST)
+ if (m1.m_fullname && m2.m_fullname || m1type == MONS_PLAYER_GHOST)
return (m1.m_mon->name(DESC_PLAIN) < m1.m_mon->name(DESC_PLAIN));
#if 0 // for now, sort brands together.