summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/mon-util.cc23
-rw-r--r--crawl-ref/source/mon-util.h1
-rw-r--r--crawl-ref/source/monstuff.cc24
-rw-r--r--crawl-ref/source/view.cc35
-rw-r--r--crawl-ref/source/view.h2
5 files changed, 53 insertions, 32 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 7f7428f023..007b7d8c03 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -551,6 +551,29 @@ monster_type draco_subspecies( const monsters *mon )
return (ret);
}
+int get_shout_noise_level(const shout_type shout)
+{
+ switch (shout)
+ {
+ case S_SILENT:
+ return 0;
+ case S_HISS:
+ case S_VERY_SOFT:
+ return 4;
+ case S_SOFT:
+ return 6;
+ case S_LOUD:
+ return 10;
+ case S_SHOUT2:
+ case S_ROAR:
+ case S_VERY_LOUD:
+ return 12;
+
+ default:
+ return 8;
+ }
+}
+
shout_type mons_shouts(int mc)
{
shout_type u = smc->shouts;
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 08269c8146..9354469d08 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -336,6 +336,7 @@ bool mons_player_visible( struct monsters *mon );
/* ***********************************************************************
* called from: view
* *********************************************************************** */
+int get_shout_noise_level(const shout_type shout);
shout_type mons_shouts(int mclass);
bool mons_is_unique(int mclass);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 5c3cf95dcd..c9775005c9 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4591,6 +4591,30 @@ static void monster_move(monsters *monster)
const int habitat = monster_habitat( monster->type );
bool deep_water_available = false;
+ // Berserking monsters make a lot of racket
+ if (monster->has_ench(ENCH_BERSERK))
+ {
+ int noise_level = get_shout_noise_level(mons_shouts(monster->type));
+ if (noise_level > 0)
+ {
+ if (mons_near(monster) && player_monster_visible(monster))
+ {
+ if (one_chance_in(10))
+ {
+ mprf(MSGCH_TALK_VISUAL, "%s rages.",
+ monster->name(DESC_CAP_THE).c_str());
+ }
+ noisy( noise_level, monster->x, monster->y );
+ }
+ else if (one_chance_in(5))
+ {
+ handle_monster_shouts(monster, true);
+ }
+ else // just be noisy without messaging the player
+ noisy( noise_level, monster->x, monster->y );
+ }
+ }
+
if (monster->confused())
{
if (mmov_x || mmov_y || one_chance_in(15))
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 7f1aa99ea9..0fd7ced541 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -764,7 +764,7 @@ inline static void beogh_follower_convert(monsters *monster)
}
}
-static void handle_monster_shouts(monsters* monster, bool force = false)
+void handle_monster_shouts(monsters* monster, bool force)
{
if (!force
&& (!you.turn_is_over || random2(30) < you.skills[SK_STEALTH]))
@@ -776,13 +776,13 @@ static void handle_monster_shouts(monsters* monster, bool force = false)
// Silent monsters can give noiseless "visual shouts" if the
// player can see them, in which case silence isn't checked for.
- if (mons_friendly(monster)
+ if (!force && mons_friendly(monster)
|| (type == S_SILENT && !player_monster_visible(monster))
|| (type != S_SILENT && (silenced(you.x_pos, you.y_pos)
|| silenced(monster->x, monster->y))))
return;
- int noise_level = 8;
+ int noise_level = get_shout_noise_level(type);
std::string default_msg_key;
switch (type)
@@ -791,10 +791,6 @@ static void handle_monster_shouts(monsters* monster, bool force = false)
case S_RANDOM:
default_msg_key = "__BUGGY";
break;
- case S_SILENT:
- default_msg_key = "";
- noise_level = 0;
- break;
case S_SHOUT:
default_msg_key = "__SHOUT";
break;
@@ -803,11 +799,9 @@ static void handle_monster_shouts(monsters* monster, bool force = false)
break;
case S_SHOUT2:
default_msg_key = "__TWO_SHOUTS";
- noise_level = 12;
break;
case S_ROAR:
default_msg_key = "__ROAR";
- noise_level = 12;
break;
case S_SCREAM:
default_msg_key = "__SCREAM";
@@ -835,30 +829,9 @@ static void handle_monster_shouts(monsters* monster, bool force = false)
break;
case S_HISS:
default_msg_key = "__HISS";
- noise_level = 4; // not very loud -- bwr
- break;
-
- // Loudness setting for shouts that are only defined in dat/shout.txt
- case S_VERY_SOFT:
- default_msg_key = "";
- noise_level = 4;
- break;
- case S_SOFT:
- default_msg_key = "";
- noise_level = 6;
break;
- case S_NORMAL:
- default_msg_key = "";
- noise_level = 8;
- break;
- case S_LOUD:
- default_msg_key = "";
- noise_level = 10;
- break;
- case S_VERY_LOUD:
+ default:
default_msg_key = "";
- noise_level = 12;
- break;
}
// Use get_monster_data(monster->type) to bypass mon_shouts()
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index d1fa30116b..2496d738d5 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -106,7 +106,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
* spells - spells3 - spells4
* *********************************************************************** */
bool noisy( int loudness, int nois_x, int nois_y, const char *msg = NULL );
-
+void handle_monster_shouts(monsters* monster, bool force = false);
// last updated 12may2000 {dlb}
/* ***********************************************************************