summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 17:37:56 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 17:37:56 +0000
commit11c08abe629362a45f0276212dfcd5ca2069b9b8 (patch)
tree94d78cb7d876adab5c7a46ee540694dfdb78c2d7 /crawl-ref/source
parent127bc45cca50bbfc9112612b54969c7b889145cb (diff)
downloadcrawl-ref-11c08abe629362a45f0276212dfcd5ca2069b9b8.tar.gz
crawl-ref-11c08abe629362a45f0276212dfcd5ca2069b9b8.zip
The royal jelly's death triggers wall change even if it is off-level. Also fixed being able to lose the royal jelly when banishing it and crash when killing the royal jelly in the Abyss.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4030 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/dat/lair.des34
-rw-r--r--crawl-ref/source/files.cc3
-rw-r--r--crawl-ref/source/mon-util.cc1
-rw-r--r--crawl-ref/source/monstuff.cc46
-rw-r--r--crawl-ref/source/travel.h5
5 files changed, 46 insertions, 43 deletions
diff --git a/crawl-ref/source/dat/lair.des b/crawl-ref/source/dat/lair.des
index c476cb5581..a17c3be158 100644
--- a/crawl-ref/source/dat/lair.des
+++ b/crawl-ref/source/dat/lair.des
@@ -3,33 +3,6 @@
# branch endings for Shoals, Snake Pit, Slime Pit and Swamp.
##############################################################################
-lua {{
-
--- Special effects for Slime:6
-function slime_wall_morph(x)
- local stone = dgn.feature_number('stone_wall')
- local inlos = false
- for x = 0, dgn.GXM - 1 do
- for y = 0, dgn.GYM - 1 do
- if dgn.grid(x, y) == stone and you.see_grid(x, y) then
- inlos = true
- break
- end
- end
- if inlos then break end
- end
- dgn.replace_feat { stone_wall= "clear_rock_wall" }
- if inlos then
- crawl.mpr("Suddenly all colour oozes out of the stone walls.",
- "monster_enchant")
- else
- crawl.mpr("You feel a strange vibration for a moment.",
- "monster_enchant")
- end
-end
-
-}}
-
##############################################################################
# Lair entries
##############################################################################
@@ -785,11 +758,6 @@ SUBST: " : " .:3, " = .c
NSUBST: P = O / *|
SHUFFLE: ([{
LFLAGS: no_tele_control
-MARKER: X = lua:mons_dies_change_flags { \
- mon_name="royal jelly", \
- trigger=slime_wall_morph \
- }
-SUBST: X = .
MAP
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -823,7 +791,7 @@ xxxxxxxxxxxx'................"cc**|*cc..cc*|**cc"................'''xxxxxxxxxxxx
xxxxxxxxxxxx'................"ccc**c|cc4c|c**ccc"..................xxxxxxxxxxxxx
xxxxxxxxxxx'................."cccccccc.3cccccccc"..................'xxxxxxxxxxxx
xxxxxxxxxxx'................."c.4.c.4.1..4.c.4.c"..................''xxxxxxxxxxx
-xxxxxxxxxxx'..................2.c.4.c.X..c.4.c.2....................'xxxxxxxxxxx
+xxxxxxxxxxx'..................2.c.4.c....c.4.c.2....................'xxxxxxxxxxx
xxxxxxxxxx'..........)......."cccccccc3.cccccccc"...................'xxxxxxxxxxx
xxxxxxxxxx'.................."ccc**c|cc4c|c**ccc"...................'xxxxxxxxxxx
xxxxxxxxxx'.................."cc**|*cc..cc*|**cc"..................'xxxxxxxxxxxx
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index c60c60b706..c98cf0b027 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1510,6 +1510,9 @@ bool apply_to_level(const level_id &level, bool preserve_current,
const level_id original = level_id::current();
if (level != original)
{
+ if (preserve_current)
+ save_level(you.your_level, you.level_type, you.where_are_you);
+
you.where_are_you = level.branch;
you.your_level = level.absdepth();
you.level_type = level.level_type;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 570eac4238..a180c84f50 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3964,6 +3964,7 @@ bool monsters::needs_transit() const
{
return ((mons_is_unique(type)
|| (flags & MF_BANISHED)
+ || type == MONS_ROYAL_JELLY
|| (you.level_type == LEVEL_DUNGEON && hit_dice > 8 + random2(25)))
&& !mons_is_summoned(this));
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index bbdb9b8dcd..2ff479c020 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -640,11 +640,41 @@ static bool _is_mons_mutator_or_rotter(monsters *mons)
return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT);
}
-static bool _slime_pit_enable_teleport_control()
+static bool _slime_pit_unlock(bool silent)
{
- return unset_level_flags(LFLAG_NO_TELE_CONTROL);
+ unset_level_flags(LFLAG_NO_TELE_CONTROL, silent);
+
+ bool in_los = false;
+ if (!silent)
+ {
+ for (int x = 0; x < GXM && !in_los; ++x)
+ for (int y = 0; y < GYM; ++y)
+ if (grd[x][y] == DNGN_STONE_WALL
+ && see_grid(x, y))
+ {
+ in_los = true;
+ break;
+ }
+ }
+
+ replace_area_wrapper(DNGN_STONE_WALL, DNGN_CLEAR_ROCK_WALL);
+
+ if (!silent)
+ {
+ if (in_los)
+ mpr("Suddenly, all colour oozes out of the stone walls.",
+ MSGCH_MONSTER_ENCHANT);
+ else
+ mpr("You feel a strange vibration for a moment.",
+ MSGCH_MONSTER_ENCHANT);
+ }
+
+ return (true);
}
+static bool _slime_pit_unlock_offlevel() { return _slime_pit_unlock(true); }
+static bool _slime_pit_unlock_onlevel() { return _slime_pit_unlock(false); }
+
static void _fire_monster_death_event(monsters *monster,
killer_type killer,
int i)
@@ -658,9 +688,15 @@ static void _fire_monster_death_event(monsters *monster,
monster_index(monster), killer));
if (monster->type == MONS_ROYAL_JELLY)
- apply_to_level( level_id(BRANCH_SLIME_PITS, 6),
- true,
- _slime_pit_enable_teleport_control );
+ {
+ const level_id target(BRANCH_SLIME_PITS, 6);
+ if (is_existing_level(target))
+ apply_to_level(
+ target,
+ true,
+ target == level_id::current()?
+ _slime_pit_unlock_onlevel : _slime_pit_unlock_offlevel );
+ }
}
}
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index bada932b2b..91867b5386 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -204,11 +204,6 @@ public:
level_id(branch_type br, int dep, level_area_type ltype = LEVEL_DUNGEON)
: branch(br), depth(dep), level_type(ltype)
{
- if (level_type != LEVEL_DUNGEON)
- {
- depth = -1;
- branch = NUM_BRANCHES;
- }
}
level_id(const level_id &ot)
: branch(ot.branch), depth(ot.depth), level_type(ot.level_type)