From e9fab48aeba4a89f568ae3953d0b7b9dccad9537 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 7 Dec 2019 19:26:47 -0800 Subject: [PATCH] weakening the mysterious force effect Izchak implemented the mysterious force and as far as I'm concerned, it's here to stay. But it can be fine tuned. This is an experimental attempt to make it happen less. Each time it happens, the chance for it happening again later will usually go down by an amount proportional to how far it sent the hero back. So chaotics will be sent back--or "side to side"--less often than in 3.6.x but the tapering off of such occurrences will be slower for them. Lawfuls will also be sent back less often--still potentially farther down than others--but tapering off of send backs for them will be quicker. I'll let somebody else figure out the before and after values for number of attempts to climb up it takes to finally get out of Gehennom. The numbers might need tuning. --- include/context.h | 3 ++- include/patchlevel.h | 4 ++-- src/do.c | 26 +++++++++++++++++++------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/include/context.h b/include/context.h index 6209a5e82..4e20f3bdc 100644 --- a/include/context.h +++ b/include/context.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 context.h $NHDT-Date: 1455907260 2016/02/19 18:41:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.6 context.h $NHDT-Date: 1575775592 2019/12/08 03:26:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -115,6 +115,7 @@ struct context_info { int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ int warnlevel; int rndencode; /* randomized escape sequence introducer */ + int mysteryforce; long next_attrib_check; /* next attribute check */ long stethoscope_move; short stethoscope_movement; diff --git a/include/patchlevel.h b/include/patchlevel.h index 0c8bd7c7a..94fac6a63 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1574982020 2019/11/28 23:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1575775596 2019/12/08 03:26:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 1 +#define EDITLEVEL 2 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/src/do.c b/src/do.c index 9b5cbd965..4dcc8ca07 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1575245055 2019/12/02 00:04:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.196 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1575775597 2019/12/08 03:26:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.216 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1279,15 +1279,22 @@ boolean at_stairs, falling, portal; * -1 11.46 12.50 12.5 * -2 5.21 4.17 0.0 * -3 2.08 0.0 0.0 + * + * 3.7.0: the chance for the "mysterious force" to kick in goes down + * as it kicks in, starting at 25% per climb attempt and dropping off + * gradually but substantially. The drop off is greater when hero is + * sent down farther so benefits lawfuls more than chaotics this time. */ if (Inhell && up && u.uhave.amulet && !newdungeon && !portal && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) { - if (!rn2(4)) { + if (!rn2(4 + g.context.mysteryforce)) { int odds = 3 + (int) u.ualign.type, /* 2..4 */ - diff = odds <= 1 ? 0 : rn2(odds); /* paranoia */ + diff = (odds <= 1) ? 0 : rn2(odds); /* paranoia */ if (diff != 0) { assign_rnd_level(newlevel, &u.uz, diff); + /* assign_rnd_level() may have used a value less than diff */ + diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ /* if inside the tower, stay inside */ if (was_in_W_tower && !On_W_tower_level(newlevel)) diff = 0; @@ -1295,15 +1302,20 @@ boolean at_stairs, falling, portal; if (diff == 0) assign_level(newlevel, &u.uz); - new_ledger = ledger_no(newlevel); - pline("A mysterious force momentarily surrounds you..."); + /* each time it kicks in, the chance of doing so again may drop; + that drops faster, on average, when being sent down farther so + while the impact is reduced for everybody compared to earlier + versions, it is reduced least for chaotics, most for lawfuls */ + g.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */ + if (on_level(newlevel, &u.uz)) { (void) safe_teleds(FALSE); (void) next_to_u(); return; - } else - at_stairs = g.at_ladder = FALSE; + } + new_ledger = ledger_no(newlevel); + at_stairs = g.at_ladder = FALSE; } }