summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-19 19:04:23 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-19 19:04:23 +0000
commit2817900512f1f92a5d8738723373ab378fd1d6e5 (patch)
treebe26e14a39ad8bafe9b5a63b48b01ebb8772d9c2 /crawl-ref/source/monstuff.cc
parentaf7b69fc5936d24c9ee0bbb5bc787cb194f7c26f (diff)
downloadcrawl-ref-2817900512f1f92a5d8738723373ab378fd1d6e5.tar.gz
crawl-ref-2817900512f1f92a5d8738723373ab378fd1d6e5.zip
Add yet more Jiyva-related cleanups. Make sure his altars are never
generated if the royal jelly is dead, you don't worship Jiyva, and you're not under penance from Jiyva; don't destroy Jiyva's altars if the royal jelly dies after you start worshipping him or go under penance from him; and clean up the alternate method for unlocking the Slime Pits. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10332 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc115
1 files changed, 89 insertions, 26 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index adeaeeddf2..2c10d1e735 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -776,21 +776,35 @@ static bool _remove_jiyva_altars()
return (success);
}
-static bool _slime_pit_unlock(bool silent)
+static bool _slime_vault_in_los()
+{
+ bool in_los = false;
+
+ for (int x = 0; x < GXM && !in_los; ++x)
+ {
+ for (int y = 0; y < GYM; ++y)
+ {
+ if ((grd[x][y] == DNGN_STONE_WALL
+ || grd[x][y] == DNGN_CLEAR_STONE_WALL)
+ && see_grid(x, y))
+ {
+ in_los = true;
+ break;
+ }
+ }
+ }
+
+ return (in_los);
+}
+
+static bool _slime_vault_to_glass(bool silent)
{
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;
- }
- }
+ in_los = _slime_vault_in_los();
replace_area_wrapper(DNGN_STONE_WALL, DNGN_CLEAR_ROCK_WALL);
// In case it was already vitrified, but then it's less noticeable.
@@ -812,27 +826,81 @@ static bool _slime_pit_unlock(bool silent)
apply_to_all_dungeons(_remove_jiyva_altars);
- if (!silenced(you.pos()))
+ if (silenced(you.pos()))
{
- mpr("With infernal noise, the power ruling this place vanishes!",
+ mpr("With an infernal shudder, the power ruling this place vanishes!",
MSGCH_MONSTER_ENCHANT);
}
else
{
- mpr("With an infernal shudder, the power ruling this place vanishes!",
+ mpr("With infernal noise, the power ruling this place vanishes!",
MSGCH_MONSTER_ENCHANT);
}
return (true);
}
-static bool _slime_pit_unlock_offlevel()
+static bool _slime_vault_to_glass_offlevel()
{
- return _slime_pit_unlock(true);
+ return _slime_vault_to_glass(true);
}
-static bool _slime_pit_unlock_onlevel()
+
+static bool _slime_vault_to_glass_onlevel()
{
- return _slime_pit_unlock(false);
+ return _slime_vault_to_glass(false);
+}
+
+static bool _slime_vault_to_floor(bool silent)
+{
+ unset_level_flags(LFLAG_NO_TELE_CONTROL, silent);
+
+ bool in_los = false;
+
+ if (!silent)
+ in_los = _slime_vault_in_los();
+
+ replace_area_wrapper(DNGN_STONE_WALL, DNGN_FLOOR);
+ // In case it was already vitrified, but then it's less noticeable.
+ replace_area_wrapper(DNGN_CLEAR_STONE_WALL, DNGN_FLOOR);
+
+ if (silenced(you.pos()))
+ mpr("An unexplained breeze blows through the dungeon.", MSGCH_GOD);
+ else
+ mpr("You hear the sound of toppling stones.", MSGCH_GOD);
+
+ return (true);
+}
+
+static bool _slime_vault_to_floor_offlevel()
+{
+ return _slime_vault_to_floor(true);
+}
+
+static bool _slime_vault_to_floor_onlevel()
+{
+ return _slime_vault_to_floor(false);
+}
+
+void slime_vault_change(bool glass)
+{
+ const level_id target(BRANCH_SLIME_PITS, 6);
+ if (is_existing_level(target))
+ {
+ if (glass)
+ {
+ apply_to_level(target, true,
+ target == level_id::current() ?
+ _slime_vault_to_glass_onlevel :
+ _slime_vault_to_glass_offlevel);
+ }
+ else
+ {
+ apply_to_level(target, true,
+ target == level_id::current() ?
+ _slime_vault_to_floor_onlevel :
+ _slime_vault_to_floor_offlevel);
+ }
+ }
}
static void _fire_monster_death_event(monsters *monster,
@@ -877,15 +945,10 @@ static void _fire_monster_death_event(monsters *monster,
// has to kill whatever it polymorphed into.
if (type == MONS_ROYAL_JELLY && !polymorph)
{
- 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);
- }
+ you.royal_jelly_dead = true;
+
+ if (jiyva_is_dead())
+ slime_vault_change(true);
}
}