#levelchange fix
Using #levelchange to reduce experience level would put nethack into an infinite loop if the character had life-drain resistance.
This commit is contained in:
@@ -120,6 +120,8 @@ prevent "remove_object: obj not on floor" panic for iron ball placement if
|
|||||||
specifying -D (or -X) to enter explore mode while restarting from a save
|
specifying -D (or -X) to enter explore mode while restarting from a save
|
||||||
file was lost in the restore process
|
file was lost in the restore process
|
||||||
fix crash when using lookat on an known invisible monster with monster syms set
|
fix crash when using lookat on an known invisible monster with monster syms set
|
||||||
|
prevent getting stuck in infinite loop when using wizard mode #levelchange
|
||||||
|
command to reduce level while having level-drain resistance
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)cmd.c 3.4 2002/01/17 */
|
/* SCCS Id: @(#)cmd.c 3.4 2002/06/23 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -566,6 +566,7 @@ wiz_mon_polycontrol()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #levelchange command */
|
||||||
STATIC_PTR int
|
STATIC_PTR int
|
||||||
wiz_level_change()
|
wiz_level_change()
|
||||||
{
|
{
|
||||||
@@ -591,7 +592,7 @@ wiz_level_change()
|
|||||||
}
|
}
|
||||||
if (newlevel < 1) newlevel = 1;
|
if (newlevel < 1) newlevel = 1;
|
||||||
while (u.ulevel > newlevel)
|
while (u.ulevel > newlevel)
|
||||||
losexp((const char *)0);
|
losexp("#levelchange");
|
||||||
} else {
|
} else {
|
||||||
if (u.ulevel >= MAXULEV) {
|
if (u.ulevel >= MAXULEV) {
|
||||||
You("are already as experienced as you can get.");
|
You("are already as experienced as you can get.");
|
||||||
|
|||||||
+11
-4
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)exper.c 3.4 2002/01/15 */
|
/* SCCS Id: @(#)exper.c 3.4 2002/06/23 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -115,7 +115,14 @@ const char *drainer; /* cause of death, if drain should be fatal */
|
|||||||
{
|
{
|
||||||
register int num;
|
register int num;
|
||||||
|
|
||||||
if (resists_drli(&youmonst)) return;
|
#ifdef WIZARD
|
||||||
|
/* override life-drain resistance when handling an explicit
|
||||||
|
wizard mode request to reduce level; never fatal though */
|
||||||
|
if (drainer && !strcmp(drainer, "#levelchange"))
|
||||||
|
drainer = 0;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (resists_drli(&youmonst)) return;
|
||||||
|
|
||||||
if (u.ulevel > 1) {
|
if (u.ulevel > 1) {
|
||||||
pline("%s level %d.", Goodbye(), u.ulevel--);
|
pline("%s level %d.", Goodbye(), u.ulevel--);
|
||||||
@@ -140,10 +147,10 @@ const char *drainer; /* cause of death, if drain should be fatal */
|
|||||||
|
|
||||||
if (u.ulevel < urole.xlev)
|
if (u.ulevel < urole.xlev)
|
||||||
num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.lornd + urace.enadv.lornd,
|
num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.lornd + urace.enadv.lornd,
|
||||||
urole.enadv.lofix + urace.enadv.lofix);
|
urole.enadv.lofix + urace.enadv.lofix);
|
||||||
else
|
else
|
||||||
num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.hirnd + urace.enadv.hirnd,
|
num = rn1((int)ACURR(A_WIS)/2 + urole.enadv.hirnd + urace.enadv.hirnd,
|
||||||
urole.enadv.hifix + urace.enadv.hifix);
|
urole.enadv.hifix + urace.enadv.hifix);
|
||||||
num = enermod(num); /* M. Stephenson */
|
num = enermod(num); /* M. Stephenson */
|
||||||
u.uenmax -= num;
|
u.uenmax -= num;
|
||||||
if (u.uenmax < 0) u.uenmax = 0;
|
if (u.uenmax < 0) u.uenmax = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user