summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player-stats.cc
diff options
context:
space:
mode:
authorgammafunk <gammafunk@gmail.com>2014-05-11 23:39:28 -0500
committergammafunk <gammafunk@gmail.com>2014-05-26 22:44:46 -0500
commit3f3b3254086107b7b464f65559d0f920c52c8827 (patch)
treeabf48ce50faea42ab414f1ccf6db64df7bc6e148 /crawl-ref/source/player-stats.cc
parent0224c773d088b34ad27576ffca4c009955c1067a (diff)
downloadcrawl-ref-3f3b3254086107b7b464f65559d0f920c52c8827.tar.gz
crawl-ref-3f3b3254086107b7b464f65559d0f920c52c8827.zip
Don't have Jiyva tend to reduce strength based on burden
Previously Jiyva stat shuffling would tend to shuffle points away from or to strength based on whether the player was under or over burden capacity. We are removing player burden, so this weighting is unnecessary.
Diffstat (limited to 'crawl-ref/source/player-stats.cc')
-rw-r--r--crawl-ref/source/player-stats.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc
index c6bde77935..434a613a97 100644
--- a/crawl-ref/source/player-stats.cc
+++ b/crawl-ref/source/player-stats.cc
@@ -159,7 +159,15 @@ bool attribute_increase()
}
}
-// Rearrange stats, biased based on your armour and skills.
+/*
+ * Have Jiyva increase a player stat by one and decrease a different stat by
+ * one.
+ *
+ * This considers armour evp and skills to determine which stats to change. A
+ * target stat vector is created based on these factors, which is then fuzzed,
+ * and then a shuffle of the player's stat points that doesn't increase the l^2
+ * distance to the target vector is chosen.
+*/
void jiyva_stat_action()
{
int cur_stat[3];
@@ -170,14 +178,13 @@ void jiyva_stat_action()
cur_stat[x] = you.stat(static_cast<stat_type>(x), false);
stat_total += cur_stat[x];
}
- // Try to avoid burdening people or making their armour difficult to use.
- int current_capacity = carrying_capacity(BS_UNENCUMBERED);
- int carrying_strength = cur_stat[0] + (you.burden - current_capacity + 207)/208;
+
int evp = you.unadjusted_body_armour_penalty();
- target_stat[0] = max(max(9, evp), 2 + carrying_strength);
+ target_stat[0] = max(9, evp);
target_stat[1] = 9;
target_stat[2] = 9;
int remaining = stat_total - 18 - target_stat[0];
+
// Divide up the remaining stat points between Int and either Str or Dex,
// based on skills.
if (remaining > 0)
@@ -197,17 +204,19 @@ void jiyva_stat_action()
}
// Heavy armour weights towards strength, Dodging skill towards
- // dexterity. EVP 15 (chain) is enough to weight towards pure
- // Str in the absence of dodging skill, but 15 dodging will
- // will push that back to pure Dex.
- int str_weight = (10*evp - you.skill(SK_DODGING, 10))/15;
+ // dexterity. EVP 15 (chain) is enough to weight towards pure Str in
+ // the absence of dodging skill, but 15 dodging will will push that
+ // back to pure Dex.
+ int str_weight = (10 * evp - you.skill(SK_DODGING, 10)) / 15;
// Clip weight between 0 (pure dex) and 10 (pure strength).
str_weight = min(10, max(0, str_weight));
// If you are in really heavy armour, then you already are getting a
// lot of Str and more won't help much, so weight magic more.
- other_weights = max(other_weights - (evp >= 15 ? 4 : 1) * magic_weights/2, 0);
- magic_weights = div_rand_round(remaining * magic_weights, magic_weights + other_weights);
+ other_weights = max(other_weights - (evp >= 15 ? 4 : 1)
+ * magic_weights / 2, 0);
+ magic_weights = div_rand_round(remaining * magic_weights,
+ magic_weights + other_weights);
other_weights = remaining - magic_weights;
target_stat[1] += magic_weights;
@@ -242,8 +251,10 @@ void jiyva_stat_action()
{
simple_god_message("'s power touches on your attributes.");
const string cause = "the 'helpfulness' of " + god_name(you.religion);
- modify_stat(static_cast<stat_type>(stat_up_choice), 1, true, cause.c_str());
- modify_stat(static_cast<stat_type>(stat_down_choice), -1, true, cause.c_str());
+ modify_stat(static_cast<stat_type>(stat_up_choice), 1, true,
+ cause.c_str());
+ modify_stat(static_cast<stat_type>(stat_down_choice), -1, true,
+ cause.c_str());
}
}