From fac85079e634c937a85dae090eb613f572bb41a0 Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Fri, 13 Nov 2009 16:19:46 -0500 Subject: Improve Fedhas' interaction with auto-exclusions Make neutralization work on monsters that are out of sight, also make it clear auto-exclusions for e.g. oklobs that previously got auto-ann. but are now out of sight. Make the monster_hostile stuff put auto-exclusions on oklobs you have already seen (if it turns them hostile). --- crawl-ref/source/attitude-change.cc | 6 +++--- crawl-ref/source/exclude.cc | 4 +++- crawl-ref/source/mon-act.cc | 3 +++ crawl-ref/source/view.cc | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc index 0cb8d91949..a0029ae21c 100644 --- a/crawl-ref/source/attitude-change.cc +++ b/crawl-ref/source/attitude-change.cc @@ -137,8 +137,7 @@ void fedhas_neutralise(monsters* monster) { fedhas_neutralise_plant(monster); monster->flags |= MF_ATT_CHANGE_ATTEMPT; - - stop_running(); + del_exclude(monster->pos()); } } @@ -612,7 +611,7 @@ static bool _fedhas_plants_on_level_hostile() { for (monster_iterator mi; mi; ++mi) { - if (mons_is_plant(*mi)) + if (mi->alive() && mons_is_plant(*mi)) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Plant hostility: %s on level %d, branch %d", @@ -629,6 +628,7 @@ static bool _fedhas_plants_on_level_hostile() mi->attitude = ATT_HOSTILE; mi->del_ench(ENCH_CHARM, true); behaviour_event(*mi, ME_ALERT, MHITYOU); + set_auto_exclude(*mi); // For now WAS_NEUTRAL stays. } } diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc index 73f99b167f..8ce5d7923b 100644 --- a/crawl-ref/source/exclude.cc +++ b/crawl-ref/source/exclude.cc @@ -38,7 +38,9 @@ static bool _mon_needs_auto_exclude(const monsters *mon, bool sleepy = false) bool need_auto_exclude(const monsters *mon, bool sleepy) { // This only works if the name is lowercased. - std::string name = mon->name(DESC_BASENAME); + std::string name = mon->name(DESC_BASENAME, + mons_is_stationary(mon) + && testbits(mon->flags, MF_SEEN)); lowercase(name); for (unsigned i = 0; i < Options.auto_exclude.size(); ++i) diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 54bf8c2afe..4349a2f3c3 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -12,6 +12,7 @@ #endif #include "arena.h" +#include "attitude-change.h" #include "beam.h" #include "cloud.h" #include "dbg-scan.h" @@ -1582,6 +1583,8 @@ static void _handle_monster_move(monsters *monster) monster->hit_points = std::min(monster->max_hit_points, monster->hit_points); + fedhas_neutralise(monster); + // Monster just summoned (or just took stairs), skip this action. if (testbits( monster->flags, MF_JUST_SUMMONED )) { diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index a97b066c0f..4d91e96a46 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -132,7 +132,6 @@ void monster_grid_updates() handle_monster_shouts(*mi); } - fedhas_neutralise(*mi); if (!mi->visible_to(&you)) continue; -- cgit v1.2.3-54-g00ecf