diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-10 22:35:41 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-10 22:38:31 +1000 |
commit | 9ea804adc31235b649583d839f409c2fd257fdfd (patch) | |
tree | 98ced78d35289f2dbf6ba2c7f0bdb74c40c5ec2e /crawl-ref/source/monstuff.cc | |
parent | 84d08117f4335ef54ae2cfac9df89fb10cef5548 (diff) | |
download | crawl-ref-9ea804adc31235b649583d839f409c2fd257fdfd.tar.gz crawl-ref-9ea804adc31235b649583d839f409c2fd257fdfd.zip |
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!
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 56 |
1 files changed, 56 insertions, 0 deletions
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) |