cursed levitation prayers

Noticed while testing something recently:  if you're wearing
a non-cursed ring of levitation but can't remove it because of
some other cursed item, you'll never get the high priority result
of TROUBLE_LEVITATION when praying.  This remedies that.
This commit is contained in:
nethack.rankin
2002-09-10 08:01:18 +00:00
parent cbb5c9309d
commit ce71bfb593
4 changed files with 38 additions and 13 deletions

View File

@@ -240,6 +240,8 @@ effects of purple worms consuming special monsters is now more consistent
avoid "you finish disrobing" when disarming via the 'A' command
make sure corpses and statues which remember monster attributes don't keep
ones that were conferred by no longer worn items (mainly speed boots)
elevate the trouble priority of any cursed item which is preventing removal
of a ring of levitation
Platform- and/or Interface-Specific Fixes

View File

@@ -382,6 +382,7 @@ E void NDECL(find_ac);
E void NDECL(glibr);
E struct obj *FDECL(some_armor,(struct monst *));
E void FDECL(erode_armor, (struct monst *,BOOLEAN_P));
E struct obj *FDECL(stuck_ring, (struct obj *,int));
E void NDECL(reset_remarm);
E int NDECL(doddoremarm);
E int FDECL(destroy_arm, (struct obj *));

View File

@@ -1620,6 +1620,31 @@ boolean acid_dmg;
}
}
/* used for praying to check and fix levitation trouble */
struct obj *
stuck_ring(ring, otyp)
struct obj *ring;
int otyp;
{
if (ring != uleft && ring != uright) {
impossible("stuck_ring: neither left nor right?");
return (struct obj *)0;
}
if (ring && ring->otyp == otyp) {
/* reasons ring can't be removed match those checked by select_off();
limbless case has extra checks because ordinarily it's temporary */
if (nolimbs(youmonst.data) &&
uamul && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed)
return uamul;
if (welded(uwep) && (ring == uright || bimanual(uwep))) return uwep;
if (uarmg && uarmg->cursed) return uarmg;
if (ring->cursed) return ring;
}
/* either no ring or not right type or nothing prevents its removal */
return (struct obj *)0;
}
STATIC_PTR
int
select_off(otmp)

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pray.c 3.4 2002/03/02 */
/* SCCS Id: @(#)pray.c 3.4 2002/09/09 */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -137,8 +137,8 @@ in_trouble()
return(TROUBLE_STUCK_IN_WALL);
if((uarmf && uarmf->otyp==LEVITATION_BOOTS && uarmf->cursed) ||
(uleft && uleft->otyp==RIN_LEVITATION && uleft->cursed) ||
(uright && uright->otyp==RIN_LEVITATION && uright->cursed))
stuck_ring(uleft, RIN_LEVITATION) ||
stuck_ring(uright, RIN_LEVITATION))
return(TROUBLE_CURSED_LEVITATION);
if(Blindfolded && ublindf->cursed) return(TROUBLE_CURSED_BLINDFOLD);
@@ -189,7 +189,7 @@ fix_worst_trouble(trouble)
register int trouble;
{
int i;
struct obj *otmp;
struct obj *otmp = 0;
const char *what = (const char *)0;
switch (trouble) {
@@ -259,16 +259,13 @@ register int trouble;
(void) safe_teleds(FALSE);
break;
case TROUBLE_CURSED_LEVITATION:
if (uarmf && uarmf->otyp==LEVITATION_BOOTS
&& uarmf->cursed)
if (uarmf && uarmf->otyp == LEVITATION_BOOTS &&
uarmf->cursed) {
otmp = uarmf;
else if (uleft && uleft->otyp==RIN_LEVITATION
&& uleft->cursed) {
otmp = uleft;
what = leftglow;
} else {
otmp = uright;
what = rightglow;
} else if ((otmp = stuck_ring(uleft,RIN_LEVITATION)) !=0) {
if (otmp == uleft) what = leftglow;
} else if ((otmp = stuck_ring(uright,RIN_LEVITATION))!=0) {
if (otmp == uright) what = rightglow;
}
goto decurse;
case TROUBLE_CURSED_BLINDFOLD: