summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/dat/database/monspeak.txt12
-rw-r--r--crawl-ref/source/enum.h4
-rw-r--r--crawl-ref/source/mon-stuff.cc44
-rw-r--r--crawl-ref/source/view.cc9
4 files changed, 50 insertions, 19 deletions
diff --git a/crawl-ref/source/dat/database/monspeak.txt b/crawl-ref/source/dat/database/monspeak.txt
index a60da963d8..78c0f659af 100644
--- a/crawl-ref/source/dat/database/monspeak.txt
+++ b/crawl-ref/source/dat/database/monspeak.txt
@@ -1732,6 +1732,10 @@ Dowan
w:2
@_Dowan_rare_@
%%%%
+fleeing Dowan
+
+VISUAL:@The_monster@ cries in horror.
+%%%%
_Dowan_common_
VISUAL:@The_monster@ smirks and points a slender finger @at_foe@.
@@ -1773,6 +1777,10 @@ _Dowan_Duvessa_dies_invisible_
@The_monster@ screams, "No! No! NO!"
%%%%
+_Dowan_Duvessa_dies_distance_
+
+You hear a distant wail of despair.
+%%%%
############ DUANE ### A mercenary guarding the dungeon
Duane
@@ -1825,6 +1833,10 @@ _Duvessa_Dowan_dies_invisible_
@The_monster@ shouts wrathfully, "No!"
%%%%
+_Duvessa_Dowan_dies_distance_
+
+You hear a distant scream of rage.
+%%%%
############ EDMUND ### A mercenary guarding the dungeon
Edmund
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index aab7442d05..4f0684d1d4 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2153,8 +2153,10 @@ enum monster_flag_type
MF_SPELLCASTER = 0x200000,
MF_ACTUAL_SPELLS = 0x400000, // Can use spells and is a spellcaster for
// Trog purposes.
- MF_PRIEST = 0x800000 // Is a priest (divine spells)
+ MF_PRIEST = 0x800000, // Is a priest (divine spells)
// for the conduct.
+
+ MF_GOING_BERSERK = 0x1000000 // Is about to go berserk!
};
// Adding slots breaks saves. YHBW.
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index d337cd45ab..2a5d903ebc 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -1224,7 +1224,7 @@ static void _elven_twin_died(monsters* twin)
found_duvessa = true;
break;
}
- else if (monster->type == MONS_DOWAN)
+ else if (mi->type == MONS_DOWAN)
{
monster = *mi;
found_dowan = true;
@@ -1232,29 +1232,37 @@ static void _elven_twin_died(monsters* twin)
}
}
- if ((found_duvessa || found_dowan) && mons_near(monster))
- {
- // Will generate strings such as 'Duvessa_Duvessa_dies' or, alternately
- // 'Dowan_Dowan_dies', but as neither will match, these can safely be
- // ignored.
- std::string key = "_" + monster->name(DESC_CAP_THE, true) + "_"
- + twin->name(DESC_CAP_THE) + "_dies_";
+ if (!found_duvessa && !found_dowan)
+ return;
- if (!monster->observable())
- key += "invisible_";
+ // Will generate strings such as 'Duvessa_Duvessa_dies' or, alternately
+ // 'Dowan_Dowan_dies', but as neither will match, these can safely be
+ // ignored.
+ std::string key = "_" + monster->name(DESC_CAP_THE, true) + "_"
+ + twin->name(DESC_CAP_THE) + "_dies_";
- std::string death_message = getSpeakString(key);
+ if (mons_near(monster) && !monster->observable())
+ key += "invisible_";
+ else
+ key += "distance_";
- if (!death_message.empty())
- mons_speaks_msg(monster, death_message, MSGCH_TALK, silenced(you.pos()));
- }
+ std::string death_message = getSpeakString(key);
- if (found_duvessa && mons_near(monster))
+ if (mons_near(monster) && !death_message.empty())
+ mons_speaks_msg(monster, death_message, MSGCH_TALK, silenced(you.pos()));
+ else
+ mprf("%s", death_message.c_str());
+
+ if (found_duvessa)
{
- // Provides its own flavour message.
- monster->go_berserk(true);
+ if (mons_near(monster))
+ // Provides its own flavour message.
+ monster->go_berserk(true);
+ else
+ // She'll go berserk the next time she sees you
+ monster->flags |= MF_GOING_BERSERK;
}
- else if (found_dowan && mons_near(monster))
+ else if (found_dowan)
{
// Doesn't provide any message, so needs one, but only if visible.
if (monster->observable())
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 35efb6d0a2..8bcadd08fe 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -139,6 +139,15 @@ void monster_grid_updates()
beogh_follower_convert(*mi);
slime_convert(*mi);
fedhas_neutralise(*mi);
+
+ // XXX: Probably quite hackish. Allows for monsters going berserk when
+ // they see the player. Currently only used for Duvessa, see the
+ // function _elven_twin_dies in mon-stuff.cc.
+ if (mi->flags & MF_GOING_BERSERK)
+ {
+ mi->flags &= ~MF_GOING_BERSERK;
+ mi->go_berserk(true);
+ }
}
}