summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/command.cc2
-rw-r--r--crawl-ref/source/decks.cc8
-rw-r--r--crawl-ref/source/defines.h2
-rw-r--r--crawl-ref/source/main.cc2
-rw-r--r--crawl-ref/source/output.cc5
-rw-r--r--crawl-ref/source/player.cc30
-rw-r--r--crawl-ref/source/player.h5
7 files changed, 36 insertions, 18 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 1812751197..52ebddce29 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -2418,7 +2418,7 @@ int list_wizard_commands(bool do_redraw_screen)
"<w>A</w> : set all skills to level\n"
"<w>g</w> : exercise a skill\n"
"<w>r</w> : change character's species\n"
- "<w>s</w> : gain 20000 skill points\n"
+ "<w>s</w> : fill experience pool\n"
"<w>S</w> : set skill to level\n"
"<w>x</w> : gain an experience level\n"
"<w>Ctrl-L</w> : change experience level\n"
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 5bb742abcb..7444df5068 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2079,9 +2079,11 @@ static void _experience_card(int power, deck_rarity_type rarity)
mpr("You feel knowledgeable.");
// Put some free XP into pool; power_level 2 means fill pool
- you.exp_available += power * 50;
- if (power_level >= 2 || you.exp_available > FULL_EXP_POOL)
- you.exp_available = FULL_EXP_POOL;
+ if (power_level >= 2)
+ you.exp_available = you.exp_pool_cutoff();
+ else
+ you.exp_available += power * 50;
+ you.step_down_exp_pool();
level_change();
}
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 1e978088e8..a038a9d321 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -142,8 +142,6 @@ const int DEBUG_COOKIE = 32767;
const int MAX_SKILL_LEVEL = 27;
const unsigned int MAX_EXP_TOTAL = 8999999;
-const unsigned int MAX_EXP_POOL = 20000;
-const unsigned int FULL_EXP_POOL = MAX_EXP_POOL;
const int MIN_HIT_MISS_PERCENTAGE = 5;
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 0efc8cb662..1f19fc89e4 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -547,7 +547,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail)
break;
case 's':
- you.exp_available = FULL_EXP_POOL;
+ you.exp_available = you.exp_pool_cutoff();
you.redraw_experience = true;
break;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index c833723649..667820f90e 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -848,9 +848,10 @@ static bool _need_stats_printed()
static short _get_exp_pool_colour(int pool)
{
- if (pool < MAX_EXP_POOL/2)
+ int cutoff = you.exp_pool_cutoff();
+ if (pool < cutoff*3/4)
return (HUD_VALUE_COLOUR);
- else if (pool < MAX_EXP_POOL*3/4)
+ else if (pool < cutoff)
return (YELLOW);
else
return (RED);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index cc00765afe..fcc151096f 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2465,6 +2465,21 @@ void forget_map(unsigned char chance_forgotten, bool force)
#endif
}
+int player::exp_pool_cutoff() const
+{
+ int total = std::max(total_skill_points, skill_cost_needed(2));
+ // total = std::min(total, skill_cost_needed(27));
+ return (total / 3);
+}
+
+void player::step_down_exp_pool()
+{
+ int cutoff = you.exp_pool_cutoff();
+ int step = cutoff/4;
+ you.exp_available = stepdown_value(you.exp_available,
+ cutoff, step, 3*step, 4*step);
+}
+
void gain_exp( unsigned int exp_gained, unsigned int* actual_gain,
unsigned int* actual_avail_gain)
{
@@ -2477,10 +2492,6 @@ void gain_exp( unsigned int exp_gained, unsigned int* actual_gain,
const unsigned long old_exp = you.experience;
const int old_avail = you.exp_available;
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "gain_exp: %d", exp_gained );
-#endif
-
if (you.experience + exp_gained > MAX_EXP_TOTAL)
you.experience = MAX_EXP_TOTAL;
else
@@ -2496,10 +2507,13 @@ void gain_exp( unsigned int exp_gained, unsigned int* actual_gain,
exp_gained /= 2;
}
- if (you.exp_available + exp_gained > MAX_EXP_POOL)
- you.exp_available = MAX_EXP_POOL;
- else
- you.exp_available += exp_gained;
+ you.exp_available += exp_gained;
+ you.step_down_exp_pool();
+
+#if DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS, "gain_exp: %d of %d",
+ you.exp_available - old_avail, exp_gained);
+#endif
level_change();
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index f9779dfa61..c6963afdf0 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -533,7 +533,10 @@ public:
void set_duration(duration_type dur, int turns, int cap = 0,
const char *msg = NULL);
-
+ // How large can the experience pool grow without loss?
+ int exp_pool_cutoff() const;
+ // Step down experience above cutoff.
+ void step_down_exp_pool();
protected:
void _removed_beholder();