summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/delay.cc4
-rw-r--r--crawl-ref/source/mon-util.cc17
-rw-r--r--crawl-ref/source/monstuff.cc23
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);