Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make Tartarus drain experience over time, restore lost experience whe…

…n returning from the branch.
  • Loading branch information...
commit 0b0dabbd95bccc252be074f232d34955377c2fff 1 parent c349644
dtsund authored
7 crawl-ref/source/effects.cc
View
@@ -2212,6 +2212,13 @@ void handle_time()
// Nasty things happen to people who spend too long in Hell.
if (player_in_hell() && coinflip())
_hell_effects();
+
+ // In particular, Tartarus slowly drains your experience...
+ if(you.where_are_you == BRANCH_TARTARUS)
+ {
+ you.experience = you.experience * 49 / 50;
+ level_change();
+ }
// Adjust the player's stats if s/he's diseased. Stats used to slowly
// recover over time, but now they don't.
2  crawl-ref/source/player.h
View
@@ -66,6 +66,8 @@ class player : public actor
uint8_t hit_points_regeneration;
uint8_t magic_points_regeneration;
unsigned int experience;
+ unsigned int undrained_experience; //Experience immediately before entering Tartarus.
+ //Will be restored on exit.
int experience_level;
int gold;
int zigs_completed, zig_max;
25 crawl-ref/source/stairs.cc
View
@@ -692,6 +692,17 @@ void up_stairs(dungeon_feature_type force_stair,
{
mprf("Welcome back to %s!",
branches[you.where_are_you].longname);
+
+ //When leaving Tartarus, restore lost experience.
+ if(old_level.branch == BRANCH_TARTARUS)
+ {
+ if(you.experience < you.undrained_experience)
+ {
+ mpr("You sigh with relief as your memories come flooding back.");
+ you.experience = you.undrained_experience;
+ level_change();
+ }
+ }
}
const coord_def stair_pos = you.pos();
@@ -1166,6 +1177,20 @@ void down_stairs(dungeon_feature_type force_stair,
mpr(branches[you.where_are_you].entry_message);
else
mprf("Welcome to %s!", branches[you.where_are_you].longname);
+
+ //Handle the just-entered-Tartarus stuff here.
+ if(you.where_are_you == BRANCH_TARTARUS)
+ {
+ mpr("You shudder as the unholy atmosphere begins claiming your memories...");
+ you.undrained_experience = you.experience;
+
+ //This will almost never happen in practice.
+ if(you.experience_level == 1)
+ you.experience = 0;
+ else
+ you.experience = exp_needed(you.experience_level) - 1;
+ level_change();
+ }
}
if (stair_find == DNGN_ENTER_HELL)
3  crawl-ref/source/tag-version.h
View
@@ -13,7 +13,8 @@ enum tag_minor_version
TAG_MINOR_LUA_COLOUR_ENUM, // Require enums for Lua colours.
TAG_MINOR_GOLDIFIED_RUNES, // Runes are undroppable and don't take space.
TAG_MINOR_MONS_THREAT_LEVEL, // Save threat level in monster_info.
- TAG_MINOR_STAIR_FOLLOW, // Monsters follow you more dynamically, Brogue-style
+ TAG_MINOR_STAIR_FOLLOW, // Monsters follow you more dynamically, Brogue-style.
+ TAG_MINOR_TAR_DRAINING, // Tartarus drains your experience.
NUM_TAG_MINORS,
TAG_MINOR_VERSION = NUM_TAG_MINORS - 1
7 crawl-ref/source/tags.cc
View
@@ -1076,6 +1076,7 @@ static void tag_construct_you(writer &th)
marshallShort(th, you.hit_points_regeneration * 100);
marshallInt(th, you.experience);
+ marshallInt(th, you.undrained_experience);
marshallInt(th, you.gold);
marshallInt(th, you.exp_available);
@@ -1721,6 +1722,12 @@ static void tag_read_you(reader &th)
you.hit_points_regeneration = unmarshallShort(th) / 100;
you.experience = unmarshallInt(th);
+
+ if(th.getMinorVersion() >= TAG_MINOR_TAR_DRAINING)
+ you.undrained_experience = unmarshallInt(th);
+ else
+ you.undrained_experience = you.experience;
+
you.gold = unmarshallInt(th);
you.exp_available = unmarshallInt(th);
Please sign in to comment.
Something went wrong with that request. Please try again.