From eae49c6fcb7586e447e4b2fe2a7f2eb5b6bb7a2e Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Thu, 12 Nov 2009 22:08:45 +1000 Subject: Further tweaks to Dowan/Duvessa death effects. New MF_GOING_BERSERK flag: monsters with this flag will go berserk the next turn after they see you. Remove sight limitations from Dowan/Duvessa death effects. Flavour messages will now always occur, as will Dowan's fear effect, even if you cannot see him. Duvessa's berserk effect is only triggered if you are in her line of sight upon Dowan's death. If you are not, she's given the MF_GOING_BERSERK flag, and will go berserk when she next sees you. Reasoning is that they have some magical ability to sense the other's death. --- crawl-ref/source/mon-stuff.cc | 44 +++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source/mon-stuff.cc') 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()) -- cgit v1.2.3-54-g00ecf