fix hero Strength

The recent acurr() changes introduced a bug that caused Str less
than 25 to be limited to 18/07.  25 was treated correctly as a
special case but 18/01 through 18/100 and 19 through 24 were not.
The cap of 25 imposed on the other characteristics is the same as
encoded Str 18/07.
This commit is contained in:
PatR
2024-01-25 13:17:23 -08:00
parent 500cbb0b11
commit 4512e85e58
2 changed files with 6 additions and 0 deletions

View File

@@ -1851,6 +1851,7 @@ debug fuzzer was triggering out of bounds array access in loseexp() if
life-saving at level 1 used blessed restore ability to regain lost
levels and restored those all the way to level 30; introducing an
assert(u.ulevel < MAXULEV) changed bounds issue to assertion failure
strength less than 25 was unintentionally being capped at 18/07
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository

View File

@@ -1167,6 +1167,11 @@ acurr(int chridx)
STR19(y) yields 100 + y (intended for 19 <= y <= 25) */
if (tmp >= STR19(25) || (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER))
result = STR19(25); /* 125 */
else
/* need non-zero here to avoid 'if(result==0)' below because
that doesn't deal with Str encoding; the cap of 25 applied
there would limit Str to 18/07 [18 + 7] */
result = max(tmp, 3);
} else if (chridx == A_CHA) {
if (tmp < 18 && (gy.youmonst.data->mlet == S_NYMPH
|| u.umonnum == PM_AMOROUS_DEMON))