From 1d7b997f2ab708bb7e8c140fb02c9c7bd6cdd0ca Mon Sep 17 00:00:00 2001 From: Erik Lunna Date: Sun, 29 Oct 2023 21:41:35 +0100 Subject: [PATCH] Revised luck timeouts. With the recent changes to how wishing impacts luck, the luck timeout table needed a bit of adjusting. With the current table, there's really only a spread of -1 to +10 luck covered. But, with the new system, the entire range from -10 luck to +10 luck needs timeouts. If a player gets their base luck down to -10, it's possible to drive it back up to +10 via unicorn gem luck or altar sacrificing. I also thought the UnNetHack system of timeouts was a bit too generous. Under that system, it would take almost 100000 turns to timeout from +3 luck to 0 luck, and almost 200000 turns to go from +10 to 0. I have revised it to be a bit more impactful, but still have fairly generous timeouts at the lower levels. To go from +1 luck to 0 is about 10000 turns, and I used this as the baseline. - To go from +3 to 0 is about 35000 turns. - To go from +6 to 0 is about 51000 turns. If a player has a very low base luck (due to wish luck penalties), the timeouts can get quite short near the upper levels, but this is by design, otherwise the penalty is too easy to waive. --- src/timeout.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index 93d444ef1..99ac2c6a1 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -596,12 +596,14 @@ nh_timeout() if (u.uluck != baseluck) { int timeout = 600; int time_luck = stone_luck(FALSE); + int base_dist = u.uluck - baseluck; /* Cursed luckstones slow bad luck timing out; blessed luckstones * slow good luck timing out; normal luckstones slow both; * neither is affected if you don't have a luckstone. - * Luck is based at 0 usually, +1 if a full moon and -1 on Friday 13th - */ - if (has_luckitem() && (!time_luck + * Luck is based at 0 usually, +1 if a full moon and -1 on Friday 13th + */ + if ((has_luckitem() || base_dist > 15) + && (!time_luck || (time_luck > 0 && u.uluck > baseluck) || (time_luck < 0 && u.uluck < baseluck))) { @@ -610,24 +612,34 @@ nh_timeout() * * distance timeout * -------------------- - * 1 24800 - * 2 24200 - * 3 23200 - * 4 21800 - * 5 20000 - * 6 17800 - * 7 15200 - * 8 12200 - * 9 8800 - * 10 5000 - * 11 800 + * 1 9025 + * 2 8100 + * 3 7225 + * 4 6400 + * 5 5625 + * 6 4900 + * 7 4225 + * 8 3600 + * 9 3025 + * 10 2500 + * 11 2025 + * 12 1600 + * 13 1225 + * 14 900 + * 15 625 + * 16 400 + * 17 225 + * 18 100 + * 19 25 + * 20 0 */ - int base_dist = u.uluck - baseluck; - int slow_timeout = 25000 - 200 * (base_dist * base_dist); - if (slow_timeout > timeout) timeout = slow_timeout; + + int slow_timeout = 25 * ((20 - base_dist) * (20 - base_dist)); + timeout = slow_timeout; } - if (u.uhave.amulet || u.ugangr) timeout = timeout / 2; + if (u.uhave.amulet || u.ugangr) + timeout = timeout / 2; if (moves >= u.luckturn + timeout) { if (u.uluck > baseluck)