From 9ea804adc31235b649583d839f409c2fd257fdfd Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Tue, 10 Nov 2009 22:35:41 +1000 Subject: Dowan and Duvessa "death" effects: berserk and fear. Dowan now flees (ENCH_FEAR) when Duvessa is killed nearby (in your line of sight, while Dowan is in your line of sight). Likewise, Duvessa goes into a berserk rage. Flavour mesages for both situations provided! --- crawl-ref/source/dat/database/monspeak.txt | 15 ++++++++ crawl-ref/source/monstuff.cc | 56 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/dat/database/monspeak.txt b/crawl-ref/source/dat/database/monspeak.txt index b20adb947f..1ed51315bc 100644 --- a/crawl-ref/source/dat/database/monspeak.txt +++ b/crawl-ref/source/dat/database/monspeak.txt @@ -1760,7 +1760,14 @@ VISUAL:@The_monster@ robes are whipped around by a magical breeze. @The_monster@ says @to_foe@, "There's a certain beauty in death, don't you think?" @The_monster@ laughs at you. "Don't get delusional, you can't win!" +%%%% +_Dowan_Duvessa_dies_ + +@The_monster@ screams, "No! No!" +@The_monster@ starts to cry. + +@The_monster@ screams, "No! Oh no!" %%%% ############ DUANE ### A mercenary guarding the dungeon Duane @@ -1798,6 +1805,14 @@ _Duvessa_rare_ @The_monster@ says @to_foe@, "Practice, practice, practice! One day you'll be as good as me." @player_only@ %%%% +_Duvessa_Dowan_dies_ + +@The_monster@ screams in rage. + +@The_monster@ screams, "No! How DARE you!" + +@The_monster@ weeps, then rights herself and shakes her weapon. +%%%% ############ EDMUND ### A mercenary guarding the dungeon Edmund diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 2a31fcbeb8..8adaf37642 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -20,6 +20,7 @@ #include "artefact.h" #include "attitude-change.h" #include "cloud.h" +#include "database.h" #include "delay.h" #include "dgnevent.h" #include "directn.h" @@ -1202,6 +1203,56 @@ void _monster_die_cloud(const monsters* monster, bool corpse, bool silent, } } +// XXX: Another hackish function! May do weird things if multiple copies of +// the band have been placed using wizard mode. {due} +static void _elven_twin_died(monsters* twin) +{ + bool found_duvessa = false; + bool found_dowan = false; + monsters *monster; + + for (int i = 0; i < MAX_MONSTERS; ++i) + { + monster = &menv[i]; + if (monster->alive() && monster->type == MONS_DUVESSA) + { + found_duvessa = true; + break; + } + else if (monster->alive() && monster->type == MONS_DOWAN) + { + found_dowan = true; + break; + } + } + + if ((found_duvessa || found_dowan) && monster->observable()) + { + // 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 death_message = getSpeakString("_" + + monster->name(DESC_CAP_THE, true) + "_" + + twin->name(DESC_CAP_THE) + "_dies_"); + + if (!death_message.empty()) + mons_speaks_msg(monster, death_message, MSGCH_TALK, silenced(you.pos())); + } + + if (found_duvessa && monster->observable()) + { + // Provides its own flavour message. + monster->go_berserk(true); + } + else if (found_dowan && monster->observable()) + { + // Doesn't provide any message, so needs one. + simple_monster_message(monster, " turns to flee."); + monster->add_ench(mon_enchant(ENCH_FEAR, 0, KC_YOU)); + behaviour_event(monster, ME_SCARE, MHITNOT); + } +} + void pikel_band_neutralise () { // XXX: This is a really ugly hack. It should be replaced by something else @@ -2043,6 +2094,11 @@ int monster_die(monsters *monster, killer_type killer, "back into the water like the carrion they now are."); } } + else if ((monster->type == MONS_DOWAN || monster->type == MONS_DUVESSA) + && monster->observable()) + { + _elven_twin_died(monster); + } else if (!monster->is_summoned()) { if (mons_genus(monster->type) == MONS_MUMMY) -- cgit v1.2.3-54-g00ecf