summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abyss.cc4
-rw-r--r--crawl-ref/source/artefact.cc3
-rw-r--r--crawl-ref/source/decks.cc4
-rw-r--r--crawl-ref/source/dungeon.cc10
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/misc.cc38
-rw-r--r--crawl-ref/source/misc.h1
-rw-r--r--crawl-ref/source/monstuff.cc115
-rw-r--r--crawl-ref/source/monstuff.h2
-rw-r--r--crawl-ref/source/player.cc15
-rw-r--r--crawl-ref/source/religion.cc50
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/tags.cc5
-rw-r--r--crawl-ref/source/tags.h3
14 files changed, 156 insertions, 96 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index cdc11b55eb..b4136e8ba2 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -305,7 +305,9 @@ static void _generate_area(const coord_def& topleft,
}
while (grd(*ri) == DNGN_ALTAR_ZIN
|| grd(*ri) == DNGN_ALTAR_SHINING_ONE
- || grd(*ri) == DNGN_ALTAR_ELYVILON);
+ || grd(*ri) == DNGN_ALTAR_ELYVILON
+ || (jiyva_is_dead() ?
+ grd(*ri) == DNGN_ALTAR_JIYVA : false));
// Lugonu has a flat 50% chance of corrupting the altar.
if (coinflip())
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 18d8343723..a311b2ea4a 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -46,6 +46,9 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item,
if (which_god == GOD_NO_GOD)
return (false);
+ if (which_god == GOD_JIYVA && jiyva_is_dead())
+ return (false);
+
// First check the item's base_type and sub_type, then check the
// item's brand and other randart properties.
bool type_bad = false;
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 263a41dd4a..3636d4ce57 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2532,6 +2532,10 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
{
// Might get GOD_NO_GOD and no altar.
god_type rgod = static_cast<god_type>(random2(NUM_GODS));
+
+ if (rgod == GOD_JIYVA && jiyva_is_dead())
+ rgod = GOD_NO_GOD;
+
grd(you.pos()) = altar_for_god(rgod);
if (grd(you.pos()) != DNGN_FLOOR)
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 7d51dc92ea..ee9d3f61d4 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -45,6 +45,7 @@ REVISION("$Rev$");
#include "notes.h"
#include "place.h"
#include "player.h"
+#include "religion.h"
#include "spells3.h"
#include "spl-book.h"
#include "state.h"
@@ -4894,6 +4895,9 @@ static void _vault_grid( vault_placement &place,
(vgrid == '\0')? DNGN_ROCK_WALL
: DNGN_FLOOR); // includes everything else
+ if (grd(where) == DNGN_ALTAR_JIYVA && jiyva_is_dead())
+ grd(where) = DNGN_FLOOR;
+
// then, handle oddball grids {dlb}:
switch (vgrid)
{
@@ -5048,7 +5052,7 @@ static void _vault_grid( vault_placement &place,
"else; please file a bug report.",
mons_type_name(monster_type_thing.mid,
DESC_CAP_THE).c_str());
- // Force it to be generated anyways.
+ // Force it to be generated anyway.
you.unique_creatures[monster_type_thing.mid] = false;
}
}
@@ -5340,7 +5344,7 @@ static dungeon_feature_type _pick_an_altar()
dungeon_feature_type altar_type;
int temp_rand; // probability determination {dlb}
- if (player_in_branch( BRANCH_ECUMENICAL_TEMPLE )
+ if (player_in_branch(BRANCH_ECUMENICAL_TEMPLE)
|| you.level_type == LEVEL_LABYRINTH)
{
// No extra altars in Temple, none at all in Labyrinth.
@@ -5391,7 +5395,7 @@ static dungeon_feature_type _pick_an_altar()
break;
case BRANCH_SLIME_PITS:
- altar_type = DNGN_ALTAR_JIYVA;
+ altar_type = jiyva_is_dead() ? DNGN_FLOOR : DNGN_ALTAR_JIYVA;
break;
case BRANCH_TOMB:
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 79d9929901..07d8d699c1 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -837,6 +837,7 @@ public:
char spell_no;
game_direction_type char_direction;
bool opened_zot;
+ bool royal_jelly_dead;
unsigned short pet_target;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 64fe325825..d55807f0ea 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1157,21 +1157,6 @@ static void _spatter_neighbours(const coord_def& where, int chance)
}
}
-bool slime_vault_to_floor()
-{
- bool success = false;
-
- for (rectangle_iterator ri(1); ri; ++ri)
- {
- if (grd(*ri) == DNGN_STONE_WALL)
- {
- grd(*ri) = DNGN_FLOOR;
- success = true;
- }
- }
- return (success);
-}
-
void generate_random_blood_spatter_on_level()
{
int startprob;
@@ -2458,27 +2443,12 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
static int times_entered = 0;
- if (level_id::current() == level_id(BRANCH_SLIME_PITS, 6)
- && you.religion == GOD_JIYVA)
+ if (level_id::current() == level_id(BRANCH_SLIME_PITS, 6))
{
- const level_id target(BRANCH_SLIME_PITS, 6);
if (times_entered == 0)
- {
- if (apply_to_level(target, true, slime_vault_to_floor))
- {
- if (!silenced(you.pos()))
- {
- mpr("You hear the sound of toppling stones.",
- MSGCH_MONSTER_ENCHANT);
- }
- else
- {
- mpr("An unexplained breeze blows through the dungeon.",
- MSGCH_MONSTER_ENCHANT);
- }
- }
- times_entered++;
- }
+ slime_vault_change(jiyva_is_dead());
+
+ times_entered++;
}
// Clear list of beholding monsters.
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 7d28f45a22..e15bce8eb1 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -34,7 +34,6 @@ bool maybe_coagulate_blood_potions_inv( item_def &blood );
long remove_oldest_blood_potion( item_def &stack );
void remove_newest_blood_potion( item_def &stack, int quant = -1 );
void merge_blood_potion_stacks(item_def &source, item_def &dest, int quant);
-bool slime_vault_to_floor();
bool can_bottle_blood_from_corpse( int mons_type );
int num_blood_potions_from_corpse( int mons_class, int chunk_type = -1 );
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);
}
}
diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h
index 6f8e3bab95..24e3e40494 100644
--- a/crawl-ref/source/monstuff.h
+++ b/crawl-ref/source/monstuff.h
@@ -96,6 +96,8 @@ int fill_out_corpse(const monsters* monster, item_def& corpse,
int place_monster_corpse(const monsters *monster, bool silent,
bool force = false);
+void slime_vault_change(bool glass);
+
void mons_check_pool(monsters *monster, const coord_def &oldpos,
killer_type killer = KILL_NONE, int killnum = -1);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 088d71361d..e4922298df 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6009,13 +6009,14 @@ void player::init()
spell_no = 0;
- your_level = 0;
- level_type = LEVEL_DUNGEON;
- entry_cause = EC_SELF_EXPLICIT;
- entry_cause_god = GOD_NO_GOD;
- where_are_you = BRANCH_MAIN_DUNGEON;
- char_direction = GDT_DESCENDING;
- opened_zot = false;
+ your_level = 0;
+ level_type = LEVEL_DUNGEON;
+ entry_cause = EC_SELF_EXPLICIT;
+ entry_cause_god = GOD_NO_GOD;
+ where_are_you = BRANCH_MAIN_DUNGEON;
+ char_direction = GDT_DESCENDING;
+ opened_zot = false;
+ royal_jelly_dead = false;
prev_targ = MHITNOT;
pet_target = MHITNOT;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 644a8f02d8..44bc9ecdae 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -852,10 +852,16 @@ void dec_penance(god_type god, int val)
#endif
if (you.penance[god] <= val)
{
- simple_god_message(" seems mollified.", god);
- take_note(Note(NOTE_MOLLIFY_GOD, god));
you.penance[god] = 0;
+ simple_god_message(
+ make_stringf("seems mollified%s.",
+ god == GOD_JIYVA && jiyva_is_dead() ?
+ ", and vanishes" : "").c_str(),
+ god);
+
+ take_note(Note(NOTE_MOLLIFY_GOD, god));
+
// TSO's halo is once more available.
if (god == GOD_SHINING_ONE && you.religion == god
&& you.piety >= piety_breakpoint(0))
@@ -924,6 +930,12 @@ static bool _need_water_walking()
&& grd(you.pos()) == DNGN_DEEP_WATER);
}
+bool jiyva_is_dead()
+{
+ return (you.royal_jelly_dead
+ && you.religion != GOD_JIYVA && !you.penance[GOD_JIYVA]);
+}
+
bool jiyva_grant_jelly(bool actual)
{
return (you.religion == GOD_JIYVA && !player_under_penance()
@@ -5194,6 +5206,9 @@ bool divine_retribution(god_type god)
{
ASSERT(god != GOD_NO_GOD);
+ if (god == GOD_JIYVA && jiyva_is_dead())
+ return (false);
+
// Good gods don't use divine retribution on their followers, and
// gods don't use divine retribution on followers of gods they don't
// hate.
@@ -7113,30 +7128,19 @@ void god_pitch(god_type which_god)
if (you.religion == GOD_LUGONU && you.worshipped[GOD_LUGONU] == 1)
gain_piety(20); // allow instant access to first power
- // Complimentary jelly upon joining.
- if (you.religion == GOD_JIYVA && !_has_jelly())
+ // Complimentary jelly upon joining for the first time.
+ if (you.religion == GOD_JIYVA && you.worshipped[GOD_JIYVA] == 1)
{
- monster_type mon = MONS_JELLY;
- mgen_data mg(mon, BEH_STRICT_NEUTRAL, 0, 0, you.pos(), MHITNOT, 0,
- GOD_JIYVA);
-
- _delayed_monster(mg);
- simple_god_message(" grants you a jelly!");
+ slime_vault_change(false);
- if (level_id::current() == level_id(BRANCH_SLIME_PITS, 6))
+ if (!_has_jelly())
{
- const level_id target(BRANCH_SLIME_PITS, 6);
- bool done = apply_to_level(target, true, slime_vault_to_floor);
- if (done)
- {
- 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);
- }
+ monster_type mon = MONS_JELLY;
+ mgen_data mg(mon, BEH_STRICT_NEUTRAL, 0, 0, you.pos(), MHITNOT, 0,
+ GOD_JIYVA);
+
+ _delayed_monster(mg);
+ simple_god_message(" grants you a jelly!");
}
}
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 9ba3379a5f..0527703c35 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -103,6 +103,7 @@ bool divine_retribution(god_type god);
bool zin_sustenance(bool actual = true);
bool zin_remove_all_mutations();
bool yred_injury_mirror(bool actual = true);
+bool jiyva_is_dead();
bool jiyva_grant_jelly(bool actual = true);
bool jiyva_remove_bad_mutation();
bool beogh_water_walk();
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index cb460903fb..520e02fc02 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -837,6 +837,7 @@ static void tag_construct_you(writer &th)
marshallByte(th, you.where_are_you);
marshallByte(th, you.char_direction);
marshallByte(th, you.opened_zot);
+ marshallByte(th, you.royal_jelly_dead);
marshallByte(th, you.your_level);
marshallByte(th, you.is_undead);
marshallShort(th, you.unrand_reacts);
@@ -1252,9 +1253,13 @@ static void tag_read_you(reader &th, char minorVersion)
you.max_level = unmarshallByte(th);
you.where_are_you = static_cast<branch_type>( unmarshallByte(th) );
you.char_direction = static_cast<game_direction_type>(unmarshallByte(th));
+
if (minorVersion >= TAG_MINOR_ZOT_OPEN)
you.opened_zot = (bool) unmarshallByte(th);
+ if (minorVersion >= TAG_MINOR_JELLY)
+ you.royal_jelly_dead = (bool) unmarshallByte(th);
+
you.your_level = unmarshallByte(th);
you.is_undead = static_cast<undead_state_type>(unmarshallByte(th));
you.unrand_reacts = unmarshallShort(th);
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index f07b3616b0..d6bcebc293 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -68,7 +68,8 @@ enum tag_minor_version
TAG_MINOR_ARTEFACT = 16, // Turned fixed arts into unrandarts.
TAG_MINOR_JIYVA = 17, // Added some player bits for Jiyva.
TAG_MINOR_ZOT_OPEN = 18, // Remember whether Zot was opened.
- TAG_MINOR_VERSION = 18 // Current version. (Keep equal to max.)
+ TAG_MINOR_JELLY = 19, // Remember whether the royal jelly is dead.
+ TAG_MINOR_VERSION = 19 // Current version. (Keep equal to max.)
};