From 11c08abe629362a45f0276212dfcd5ca2069b9b8 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 1 Apr 2008 17:37:56 +0000 Subject: 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 --- crawl-ref/source/monstuff.cc | 46 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') 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 ); + } } } -- cgit v1.2.3-54-g00ecf