diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-21 10:19:41 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-21 10:19:41 +0000 |
commit | 1b6083af898fb45ab6c1d309b1a383ff85538969 (patch) | |
tree | 52a0ed7e32b993ca157da1859619e3633d50e91d | |
parent | af6dde3945128ffddf3e9b61c9ae9b9ab9064bc0 (diff) | |
download | crawl-ref-1b6083af898fb45ab6c1d309b1a383ff85538969.tar.gz crawl-ref-1b6083af898fb45ab6c1d309b1a383ff85538969.zip |
If a monster surfaces and then submerges again in the same turn then give the
message "The monster surfaces briefly" instead of "The monster surfaces", so
the player will have some idea as to why the monster isn't in view.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8647 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/delay.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 23 |
3 files changed, 34 insertions, 10 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index bbd0ba1f2f..9f76609cc0 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1801,6 +1801,10 @@ inline static bool _monster_warning(activity_interrupt_type ai, else text += " appears from thin air!"; } + // The monster surfaced and submerged in the same turn without + // doing anything else. + else if (at.context == "surfaced") + text += "surfaces briefly."; else if (at.context == "surfaces") text += " surfaces."; else if (at.context.find("bursts forth") != std::string::npos) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index a3a81945bb..a27782b2d3 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -6360,7 +6360,7 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet) case ENCH_SUBMERGED: // XXX: What if the monster was invisible before submerging? - if (!quiet && mons_near(this)) + if (!quiet && you.can_see(this)) { if (type == MONS_AIR_ELEMENTAL) { @@ -6372,6 +6372,16 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet) mprf("%s hides itself under the floor.", name(DESC_CAP_A, true).c_str() ); } + else if (seen_context == "surfaces" + || seen_context == "bursts forth" + || seen_context == "emerges") + { + // The monster surfaced and submerged in the same turn without + // doing anything else. + interrupt_activity(AI_SEE_MONSTER, + activity_interrupt_data(this, + "surfaced")); + } else if (crawl_state.arena) mprf("%s submerges.", name(DESC_CAP_A, true).c_str() ); } @@ -6732,11 +6742,6 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) seen_context = "bursts forth"; else seen_context = "surfaces"; - - // and fire activity interrupts - interrupt_activity(AI_SEE_MONSTER, - activity_interrupt_data(this, - seen_context)); } else if (!quiet) { diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 088619dde6..68bdeb1ddb 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2505,6 +2505,17 @@ void behaviour_event(monsters *mon, int event, int src, if (mons_friendly(mon) && mon->is_patrolling()) break; + if (mon->is_patrolling()) + mprf(MSGCH_DIAGNOSTICS, "ME_ALERT: %s patrolling", + mon->name(DESC_PLAIN, true).c_str()); + + if (mon->travel_target != MTRAV_NONE + || mon->travel_path.size() > 0) + { + mprf(MSGCH_DIAGNOSTICS, "ME_ALERT: %s travelling", + mon->name(DESC_PLAIN, true).c_str()); + } + if (mons_is_sleeping(mon) && mons_near(mon)) remove_auto_exclude(mon, true); @@ -6817,10 +6828,6 @@ static void _handle_monster_move(int i, monsters *monster) if (!monster->alive()) break; - // If the monster is about to do something then its last seen_context - // is out of date. - monster->seen_context.clear(); - #if DEBUG_MONS_SCAN if (!monster_was_floating && mgrd(monster->pos()) != monster->mindex()) @@ -7549,6 +7556,11 @@ static bool _monster_swaps_places( monsters *mon, const coord_def& delta ) m2->check_redraw(c); m2->apply_location_effects(n); + + // The seen context no longer applies if the monster is moving normally. + mon->seen_context.clear(); + m2->seen_context.clear(); + return (false); } @@ -7579,6 +7591,9 @@ static bool _do_move_monster(monsters *monster, const coord_def& delta) return (true); } + // The seen context no longer applies if the monster is moving normally. + monster->seen_context.clear(); + // This appears to be the real one, ie where the movement occurs: _swim_or_move_energy(monster); |