From 8d880dd143a5bce173e885ea5af6929786b015a1 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 29 May 2007 03:52:02 +0000 Subject: [PATCH] unicorn horn vs sustain ability (trunk only) Forwarded from newsgroup by in February, 2005: non-cursed unicorn horn fixes lost Str/Con/&c stats even when ring of sustain ability is supposedly locking those at current value. This makes unicorn horn honor the Fixed_abil intrinsic. The potion and spell of restore ability still override that, so they now have potential for use even after player has acquired a unihorn. Prayer also continues to override Fixed_abil. Major prayer result to heal crippled strength now attempts to uncurse a ring of sustain ability (or gloves or weapon covering it up--similar situation as with cursed levitation). Minor prayer result to fix lost stats resets those without attempting to do anything about Fixed_abil. --- doc/fixes35.0 | 1 + src/apply.c | 7 +++++++ src/potion.c | 3 ++- src/pray.c | 18 ++++++++++++++++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 1a16289ed..57ce2f6be 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -238,6 +238,7 @@ digging/chopping a closed drawbridge message mentioned digging a "wall" attacking via applied polearm now honors the "confirm" option engulfer under influence of conflict or confusion could swallow monster at water/lava/trap spot and not be affected by destination til next move +unicorn horn restoration no longer overrides sustain ability characteristic Platform- and/or Interface-Specific Fixes diff --git a/src/apply.c b/src/apply.c index 1d3073181..22907e49c 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1671,9 +1671,16 @@ struct obj *obj; /* collect attribute troubles */ for (idx = 0; idx < A_MAX; idx++) { + if (ABASE(idx) >= AMAX(idx)) continue; val_limit = AMAX(idx); /* don't recover strength lost from hunger */ if (idx == A_STR && u.uhs >= WEAK) val_limit--; + if (Fixed_abil) { + /* potion/spell of restore ability override sustain ability + intrinsic but unicorn horn usage doesn't */ + unfixable_trbl += val_limit - ABASE(idx); + continue; + } /* don't recover more than 3 points worth of any attribute */ if (val_limit > ABASE(idx) + 3) val_limit = ABASE(idx) + 3; diff --git a/src/potion.c b/src/potion.c index f68a5f781..932046cfb 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)potion.c 3.5 2007/02/05 */ +/* SCCS Id: @(#)potion.c 3.5 2007/05/29 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -478,6 +478,7 @@ peffects(otmp) pline("Ulch! This makes you feel mediocre!"); break; } else { + /* unlike unicorn horn, overrides Fixed_abil */ pline("Wow! This makes you feel %s!", (otmp->blessed) ? (unfixable_trouble_count(FALSE) ? "better" : "great") diff --git a/src/pray.c b/src/pray.c index 15323e70d..ebb77fbf2 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pray.c 3.5 2007/03/19 */ +/* SCCS Id: @(#)pray.c 3.5 2007/05/29 */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -352,8 +352,21 @@ register int trouble; context.botl = 1; break; case TROUBLE_COLLAPSING: + /* override Fixed_abil; uncurse that if feasible */ + You_feel("%sstronger.", + (AMAX(A_STR) - ABASE(A_STR) > 6) ? "much " : ""); ABASE(A_STR) = AMAX(A_STR); context.botl = 1; + if (Fixed_abil) { + if ((otmp = stuck_ring(uleft, + RIN_SUSTAIN_ABILITY)) != 0) { + if (otmp == uleft) what = leftglow; + } else if ((otmp = stuck_ring(uright, + RIN_SUSTAIN_ABILITY)) != 0) { + if (otmp == uright) what = rightglow; + } + if (otmp) goto decurse; + } break; case TROUBLE_STUCK_IN_WALL: Your("surroundings change."); @@ -428,11 +441,12 @@ decurse: update_inventory(); break; case TROUBLE_POISONED: + /* override Fixed_abil; ignore items which confer that */ if (Hallucination) pline("There's a tiger in your tank."); else You_feel("in good health again."); - for(i=0; i