summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 08:45:04 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 08:45:04 +0000
commit2b0fe052f4617b1b52fd952a35bfbc4f273dac81 (patch)
treed8f7f5960ff1fb5935de10f4a0f99749a30bed7d
parent62cba73fa0b680b992c6c11ba59268617abd35ae (diff)
downloadcrawl-ref-2b0fe052f4617b1b52fd952a35bfbc4f273dac81.tar.gz
crawl-ref-2b0fe052f4617b1b52fd952a35bfbc4f273dac81.zip
If a submerged monster moves onto a grid in which it can't be submerged,
force it to unsuberge (i.e., a mermaid moving directly from water onto floor without first unsubmerign). If a submerged monster shouts, force it to unsubmerge first. If a visible submerged monster unsubmerges within view of the player, say that it "bursts forth from the water" if it can travel over land, and that it "surfaces" otherwise, rather than saying that it "comes into view". If an invisble sumberged monster unsubmerges within view of a player who can't see invisible, and it can move over land, say "something invisble bursts forth from the water". git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2466 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/delay.cc4
-rw-r--r--crawl-ref/source/mon-util.cc47
-rw-r--r--crawl-ref/source/view.cc5
3 files changed, 44 insertions, 12 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index bfbfd9d747..c9de8e7d4e 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1113,6 +1113,10 @@ inline static void monster_warning(activity_interrupt_type ai,
else
text += " appears from thin air.";
}
+ else if (at.context == "surfaces")
+ text += " surfaces.";
+ else if (at.context == "bursts forth")
+ text += " bursts forth from the water.";
else
text += " comes into view.";
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index f2396cda5b..f3aa90b870 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -4089,26 +4089,43 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
break;
case ENCH_SUBMERGED:
- if (type == MONS_AIR_ELEMENTAL)
+ if (you.can_see(this))
{
- if (mons_near(this))
+ if (!mons_is_safe( static_cast<const monsters*>(this))
+ && is_run_delay(current_delay_action()))
{
- if (!mons_is_safe( static_cast<const monsters*>(this)))
- {
- activity_interrupt_data aid(this);
+ activity_interrupt_data aid(this);
+
+ if (type == MONS_AIR_ELEMENTAL)
aid.context = "thin air";
- interrupt_activity( AI_SEE_MONSTER, aid );
- }
- else if (!quiet)
+ else if (monster_habitable_grid(this, DNGN_FLOOR))
+ aid.context = "bursts forth";
+ else
+ aid.context = "surfaces";
+
+ interrupt_activity( AI_SEE_MONSTER, aid );
+ }
+ else if (!quiet)
+ {
+ if (type == MONS_AIR_ELEMENTAL)
mprf("%s forms itself from the air!",
name(DESC_CAP_A, true).c_str() );
+ else if (monster_habitable_grid(this, DNGN_FLOOR))
+ mprf("%s bursts forth from the water!",
+ name(DESC_CAP_A, true).c_str() );
+ }
- seen_monster( this );
+ seen_monster( this );
- // Monster was viewed this turn
- flags |= MF_WAS_IN_VIEW;
- }
+ // Monster was viewed this turn
+ flags |= MF_WAS_IN_VIEW;
+ }
+ else if (mons_near(this) && monster_habitable_grid(this, DNGN_FLOOR))
+ {
+ mpr("Something invisble bursts forth from the water.");
+ interrupt_activity( AI_FORCE_INTERRUPT );
}
+
break;
default:
@@ -4891,6 +4908,12 @@ void monsters::apply_location_effects()
if (alive())
mons_check_pool(this);
+
+ if (alive() && has_ench(ENCH_SUBMERGED)
+ && !monster_can_submerge(type, grd[x][y]))
+ {
+ del_ench(ENCH_SUBMERGED);
+ }
}
bool monsters::do_shaft()
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index c7018aa032..d5994bd05b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -938,6 +938,11 @@ void handle_monster_shouts(monsters* monster, bool force)
else if (param == "SOUND")
channel = MSGCH_SOUND;
+ // Monster must come up from being submerged if it wants to
+ // shout.
+ if (mons_is_submerged(monster))
+ monster->del_ench(ENCH_SUBMERGED);
+
msg::streams(channel) << msg << std::endl;
}