summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/behold.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-12-06 23:33:38 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-12-06 23:33:38 -0800
commitaf6becb7a7f2e997daed1a7ecbb08757384ce45b (patch)
tree20c9f4aadb261060bd93c248a8794ce722e5a13b /crawl-ref/source/behold.cc
parent468799bc8d1ef51c34cfcc37f395c8c1439939dd (diff)
downloadcrawl-ref-af6becb7a7f2e997daed1a7ecbb08757384ce45b.tar.gz
crawl-ref-af6becb7a7f2e997daed1a7ecbb08757384ce45b.zip
Beholding + berserk/fleeing/sanctuary
If a mermaid goes berserk or starts fleeing it stops singing, and if the player is in Sanctuary then the mermaid's song sounds muted and has no effect on the player.
Diffstat (limited to 'crawl-ref/source/behold.cc')
-rw-r--r--crawl-ref/source/behold.cc35
1 files changed, 33 insertions, 2 deletions
diff --git a/crawl-ref/source/behold.cc b/crawl-ref/source/behold.cc
index b1235c6a85..e529c8e55f 100644
--- a/crawl-ref/source/behold.cc
+++ b/crawl-ref/source/behold.cc
@@ -10,6 +10,7 @@
#include "coord.h"
#include "debug.h"
#include "env.h"
+#include "fprop.h"
#include "los.h"
#include "mon-util.h"
#include "monster.h"
@@ -22,6 +23,20 @@
// Add a monster to the list of beholders.
void player::add_beholder(const monsters* mon)
{
+ if (is_sanctuary(you.pos()))
+ {
+ if (you.can_see(mon))
+ {
+ mprf("%s's singing sounds muted, and has no effect on you.",
+ mon->name(DESC_CAP_THE).c_str());
+ }
+ else
+ {
+ mpr("The melody is strangely muted, and has no effect on you.");
+ }
+ return;
+ }
+
if (!duration[DUR_MESMERISED])
{
you.set_duration(DUR_MESMERISED, 7, 12);
@@ -34,7 +49,8 @@ void player::add_beholder(const monsters* mon)
you.increase_duration(DUR_MESMERISED, 5, 12);
if (!beheld_by(mon))
beholders.push_back(mon->mindex());
- }}
+ }
+}
// Whether player is mesmerised.
bool player::beheld() const
@@ -115,6 +131,19 @@ static void _removed_beholder_msg(const monsters* mon)
return;
}
+ if (is_sanctuary(you.pos()) && !mons_is_fleeing(mon))
+ {
+ if (you.can_see(mon))
+ {
+ mprf("%s's singing becomes strangely muted.",
+ mon->name(DESC_CAP_THE).c_str());
+ }
+ else
+ mpr("Something's singing becomes strangely muted.");
+
+ return;
+ }
+
if (you.can_see(mon))
{
if (silenced(you.pos()) || silenced(mon->pos()))
@@ -190,5 +219,7 @@ bool player::_possible_beholder(const monsters *mon) const
&& mon->alive() && mons_genus(mon->type) == MONS_MERMAID
&& !mon->submerged() && !mon->confused()
&& !mon->asleep() && !mon->cannot_move()
- && !mon->wont_attack() && !mon->pacified());
+ && !mon->wont_attack() && !mon->pacified()
+ && !mon->berserk() && !mons_is_fleeing(mon)
+ && !is_sanctuary(you.pos()));
}