From 640ab4ffa99e7b5eac2cf864f459c761f477efb7 Mon Sep 17 00:00:00 2001
From: Daniel Santos
Date: Mon, 15 Oct 2012 01:39:09 -0500
Subject: [PATCH v2 01/11] Anomalous races: Use points to keep stats above 3
Currently, no matter how badly a stat is adjusted downwards, it the
"best" value will always result in three. In fact, it can never go
below that point. Such an assumption makes sense in the face of
existing race/class combinations, but future races (e.g., Trolls) and/or
classes could bring the baseline lower. As is, the code will give them
a free upgrade to 3 and we don't want that.
This patch will force the usage of spendable stat points to bring all
stats up to three.
---
src/birth.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/birth.c b/src/birth.c
index 8618bcd..3f34bce 100644
--- a/src/birth.c
+++ b/src/birth.c
@@ -642,9 +642,22 @@ static void reset_stats(int stats[A_MAX], int points_spent[A_MAX], int *points_l
for (i = 0; i < A_MAX; i++)
{
- /* Initial stats are all 10 and costs are zero */
- stats[i] = 10;
- points_spent[i] = 0;
+ /* Initial stats are all 10 and costs are zero, unless race and class
+ * adjustments bring it below 3, in which case we force them to spend
+ * points to bring it up to 3, considering that the minimum acceptable.
+ * to be an adventurer.
+ */
+ int adj = p_ptr->race->r_adj[i] + p_ptr->class->c_adj[i];
+ int penalty;
+
+ if (adj >= -7)
+ penalty = 0;
+ else
+ penalty = -(adj + 7);
+
+ stats[i] = 10 + penalty;
+ points_spent[i] = penalty;
+ *points_left -= penalty;
}
/* Use the new "birth stat" values to work out the "other"
@@ -694,11 +707,17 @@ static bool buy_stat(int choice, int stats[A_MAX], int points_spent[A_MAX], int
static bool sell_stat(int choice, int stats[A_MAX], int points_spent[A_MAX],
int *points_left, bool update_display)
{
- /* Must be a valid stat, and we can't "sell" stats below the base of 10. */
+ /* Must be a valid stat, and we can't "sell" stats below the base of 10
+ * or best of 3.
+ */
if (!(choice >= A_MAX || choice < 0) && (stats[choice] > 10))
{
+ int adj = p_ptr->race->r_adj[choice] + p_ptr->class->c_adj[choice];
int stat_cost = birth_stat_costs[stats[choice]];
+ if ((stats[choice] + adj) <= 3)
+ return FALSE;
+
stats[choice]--;
points_spent[choice] -= stat_cost;
*points_left += stat_cost;
--
1.7.3.4