From 102e427ca740a4db97b6fc68e4cd2b4edee5e574 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 5 Nov 2015 18:39:02 -0800 Subject: [PATCH] fix scroll of charging The intended change was that you'd get an increase to max energy if current was sufficiently close to max rather than only when it was already at max. It wasn't intended that you'd fail to have current boosted all the way to max in the case where it wasn't sufficiently close. That's fixed here. --- src/read.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/read.c b/src/read.c index 89c460736..6f4fc1de9 100644 --- a/src/read.c +++ b/src/read.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 read.c $NHDT-Date: 1446713638 2015/11/05 08:53:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.119 $ */ +/* NetHack 3.6 read.c $NHDT-Date: 1446777536 2015/11/06 02:38:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.120 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1428,8 +1428,10 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */ } else { You_feel("charged up!"); u.uen += d(sblessed ? 6 : 4, 4); - if (u.uen > u.uenmax) - u.uenmax = u.uen; + if (u.uen > u.uenmax) /* if current energy is already at */ + u.uenmax = u.uen; /* or near maximum, increase maximum */ + else + u.uen = u.uenmax; /* otherwise restore current to max */ } context.botl = 1; break;