summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/ability.cc13
-rw-r--r--crawl-ref/source/areas.cc8
-rw-r--r--crawl-ref/source/dbg-scan.cc12
-rw-r--r--crawl-ref/source/dungeon.cc8
-rw-r--r--crawl-ref/source/items.cc5
-rw-r--r--crawl-ref/source/items.h1
-rw-r--r--crawl-ref/source/mon-place.cc33
-rw-r--r--crawl-ref/source/player.cc11
-rw-r--r--crawl-ref/source/player.h1
9 files changed, 63 insertions, 29 deletions
diff --git a/crawl-ref/source/ability.cc b/crawl-ref/source/ability.cc
index b6bd15fa83..a485ceb22c 100644
--- a/crawl-ref/source/ability.cc
+++ b/crawl-ref/source/ability.cc
@@ -3238,6 +3238,17 @@ static void _add_talent(vector<talent>& vec, const ability_type ability,
vec.push_back(t);
}
+/**
+ * Return all relevant talents that the player has.
+ *
+ * Currently the only abilities that are affected by include_unusable are god
+ * abilities (affect by e.g. penance or silence).
+ * @param check_confused If true, abilities that don't work when confused will
+ * be excluded.
+ * @param include_unusable If true, abilities that are currently unusable will
+ * be excluded.
+ * @returns A vector of talent structs.
+ */
vector<talent> your_talents(bool check_confused, bool include_unusable)
{
vector<talent> talents;
@@ -3279,7 +3290,7 @@ vector<talent> your_talents(bool check_confused, bool include_unusable)
_add_talent(talents, ABIL_MAKE_OCS, check_confused);
if (you.experience_level >= 15)
_add_talent(talents, ABIL_MAKE_NEEDLE_TRAP, check_confused);
- if (you.experience_level >= 16 && you.char_direction != GDT_ASCENDING)
+ if (you.experience_level >= 16 && !player_has_orb())
_add_talent(talents, ABIL_MAKE_TELEPORT, check_confused);
if (you.experience_level >= 17)
_add_talent(talents, ABIL_MAKE_WATER, check_confused);
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index 1056cf2eb9..c640e913e0 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -151,6 +151,12 @@ static void _actor_areas(actor *a)
}
}
+/**
+ * Update the area grid cache.
+ *
+ * Updates the _agrid FixedArray of grid information flags using the
+ * areaprop_flag types.
+ */
static void _update_agrid()
{
if (no_areas)
@@ -168,7 +174,7 @@ static void _update_agrid()
for (monster_iterator mi; mi; ++mi)
_actor_areas(*mi);
- if (you.char_direction == GDT_ASCENDING && !you.pos().origin())
+ if (player_has_orb() && !you.pos().origin())
{
const int r = 5;
_agrid_centres.push_back(area_centre(AREA_ORB, you.pos(), r));
diff --git a/crawl-ref/source/dbg-scan.cc b/crawl-ref/source/dbg-scan.cc
index d075f11aa9..0120decb4d 100644
--- a/crawl-ref/source/dbg-scan.cc
+++ b/crawl-ref/source/dbg-scan.cc
@@ -641,6 +641,13 @@ void debug_mons_scan()
}
#endif
+/**
+ * Check the map for validity, generating a crash if not.
+ *
+ * This checks the loaded map to make sure all dungeon features and shops are
+ * valid, all branch exits are generated, and all portals generated at fixed
+ * levels in the Depths are actually present.
+ */
void check_map_validity()
{
#ifdef ASSERTS
@@ -692,12 +699,9 @@ void check_map_validity()
portal = DNGN_UNSEEN;
if (feat == exit || orig == exit)
exit = DNGN_UNSEEN;
-
-
-
}
- if (portal && you.char_direction != GDT_ASCENDING)
+ if (portal)
{
#ifdef DEBUG_DIAGNOSTICS
dump_map("missing_portal.map", true);
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 3822fa74e3..87c8596cc1 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -1271,13 +1271,14 @@ void dgn_reset_level(bool enable_random_maps)
// Set default random monster generation rate (smaller is more often,
// except that 0 == no random monsters).
if (player_in_branch(BRANCH_TEMPLE)
- && you.char_direction == GDT_DESCENDING // except for the Orb run
+ && !player_has_orb() // except for the Orb run
|| crawl_state.game_is_tutorial())
{
// No random monsters in tutorial or ecu temple
env.spawn_random_rate = 0;
}
- else if (player_in_connected_branch())
+ else if (player_in_connected_branch()
+ || (player_has_orb() && !player_in_branch(BRANCH_ABYSS)))
env.spawn_random_rate = 240;
else if (player_in_branch(BRANCH_ABYSS)
|| player_in_branch(BRANCH_PANDEMONIUM))
@@ -1287,7 +1288,8 @@ void dgn_reset_level(bool enable_random_maps)
env.spawn_random_rate = 50;
}
else
- // No random monsters in Labyrinths and portal vaults.
+ // No random monsters in Labyrinths and portal vaults if we don't have
+ // the orb.
env.spawn_random_rate = 0;
env.density = 0;
env.forest_awoken_until = 0;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 89902755c2..e827d42d86 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -4031,11 +4031,6 @@ int runes_in_pack()
return num_runes;
}
-bool player_has_orb()
-{
- return you.char_direction == GDT_ASCENDING;
-}
-
static const object_class_type _mimic_item_classes[] =
{
OBJ_GOLD,
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index 0dab621f0c..bb1899ab58 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -94,7 +94,6 @@ void drop(void);
int inv_count(void);
int runes_in_pack();
-bool player_has_orb();
bool pickup_single_item(int link, int qty);
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index 027df594d0..8717d1eab5 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -333,10 +333,13 @@ static int _vestibule_spawn_rate()
//#define DEBUG_MON_CREATION
-// This function is now only called about once every 5 turns. (Used to be
-// every turn independent of how much time an action took, which was not ideal.)
-// To arrive at spawning rates close to how they used to be, replace the
-// one_chance_in(value) checks with the new x_chance_in_y(5, value). (jpeg)
+/**
+ * Spawn random monsters.
+
+ * The spawn rate defaults to the current env.spawn_random_rate for the branch,
+ * but is modified by whether the player is in the abyss and on what level, as
+ * well as whether the player has the orb.
+ */
void spawn_random_monsters()
{
if (crawl_state.disables[DIS_SPAWNS])
@@ -365,9 +368,10 @@ void spawn_random_monsters()
if (player_in_branch(BRANCH_VESTIBULE))
rate = _vestibule_spawn_rate();
- rate = (you.char_direction == GDT_DESCENDING) ?
- _scale_spawn_parameter(rate, 6 * rate, 0)
- : (you_worship(GOD_CHEIBRIADOS)) ? 16 : 8;
+ if (player_has_orb())
+ rate = you_worship(GOD_CHEIBRIADOS) ? 16 : 8;
+ else if (you.char_direction != GDT_GAME_START)
+ rate = _scale_spawn_parameter(rate, 6 * rate, 0);
if (rate == 0)
{
@@ -387,8 +391,11 @@ void spawn_random_monsters()
if (!x_chance_in_y(5, rate))
return;
- // Place normal dungeon monsters, but not in player LOS.
- if (player_in_connected_branch())
+ // Place normal dungeon monsters, but not in player LOS. Don't generate orb
+ // spawns in Abyss to show some mercy to players that get banished there on
+ // the orb run.
+ if (player_in_connected_branch()
+ || (player_has_orb() && !player_in_branch(BRANCH_ABYSS)))
{
dprf("Placing monster, rate: %d, turns here: %d",
rate, env.turns_on_level);
@@ -396,12 +403,12 @@ void spawn_random_monsters()
: PROX_AWAY_FROM_PLAYER);
// The rules change once the player has picked up the Orb...
- if (you.char_direction == GDT_ASCENDING)
+ if (player_has_orb())
prox = (one_chance_in(3) ? PROX_CLOSE_TO_PLAYER : PROX_ANYWHERE);
mgen_data mg(WANDERING_MONSTER);
mg.proximity = prox;
- mg.foe = (you.char_direction == GDT_ASCENDING) ? MHITYOU : MHITNOT;
+ mg.foe = (player_has_orb()) ? MHITYOU : MHITNOT;
mons_place(mg);
viewwindow();
return;
@@ -3457,8 +3464,8 @@ monster* mons_place(mgen_data mg)
// This gives a slight challenge to the player as they ascend the
// dungeon with the Orb.
- if (you.char_direction == GDT_ASCENDING && _is_random_monster(mg.cls)
- && player_in_connected_branch() && !mg.summoned())
+ if (_is_random_monster(mg.cls) && player_has_orb()
+ && !player_in_branch(BRANCH_ABYSS) && !mg.summoned())
{
#ifdef DEBUG_MON_CREATION
mprf(MSGCH_DIAGNOSTICS, "Call _pick_zot_exit_defender()");
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e5897b0ef2..b0e316aa55 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2744,7 +2744,7 @@ int burden_change(void)
// XXX: the 600 here is the weight of the Orb.
// TODO: make this use a dummy item or similar?
- you.burden = (you.char_direction == GDT_ASCENDING) ? 600 : 0;
+ you.burden = player_has_orb() ? 600 : 0;
for (int bu = 0; bu < ENDOFPACK; bu++)
{
@@ -8335,3 +8335,12 @@ int player_monster_detect_radius()
radius = max(radius, you.piety / 20);
return min(radius, LOS_RADIUS);
}
+
+/**
+ * Return true if the player has the Orb of Zot.
+ * @returns True if the player has the Orb, false otherwise.
+ */
+bool player_has_orb()
+{
+ return you.char_direction == GDT_ASCENDING;
+}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 68c82f47ac..dcd88b564c 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1032,4 +1032,5 @@ bool need_expiration_warning(duration_type dur, coord_def p = you.pos());
bool need_expiration_warning(coord_def p = you.pos());
void count_action(caction_type type, int subtype = 0);
+bool player_has_orb();
#endif