new prayer trouble

3.4.1 included a change which requires you to be able to use hands
in order to manipulate containers; that makes sense but has introduced
an unintended side-effect.  It has become much harder to uncurse a
two-handed weapon or combination of a one-handed weapon and a shield
because you can't get scrolls or potions out of your bag.  This adds a
new major trouble for prayer to address that, escalating it above the
normal minor cursed item trouble.  It also removes a nonsensical check
for combination of two-handed weapon and shield that I added long ago.

     Not related, but same file:  add the missing artifact touch checks
for putting on accessories (quest amulets and lenses).  I can't remember
if this was From a bug report.
This commit is contained in:
nethack.rankin
2003-03-10 23:49:04 +00:00
parent 9327d35592
commit 6b1811007c
4 changed files with 77 additions and 33 deletions
+2
View File
@@ -13,6 +13,8 @@ include a hint about expected input when prompting for musical notes
don't report "program initialization failed" if a panic occurs after the don't report "program initialization failed" if a panic occurs after the
game is over game is over
include statue contents in end of game inventory disclosure include statue contents in end of game inventory disclosure
treat handlessness as a major problem when deciding prayer outcome
perform artifact touch checks when putting on accessories
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+2 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)extern.h 3.4 2003/01/02 */ /* SCCS Id: @(#)extern.h 3.4 2003/03/10 */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -385,6 +385,7 @@ E void NDECL(glibr);
E struct obj *FDECL(some_armor,(struct monst *)); E struct obj *FDECL(some_armor,(struct monst *));
E void FDECL(erode_armor, (struct monst *,BOOLEAN_P)); E void FDECL(erode_armor, (struct monst *,BOOLEAN_P));
E struct obj *FDECL(stuck_ring, (struct obj *,int)); E struct obj *FDECL(stuck_ring, (struct obj *,int));
E struct obj *NDECL(unchanger);
E void NDECL(reset_remarm); E void NDECL(reset_remarm);
E int NDECL(doddoremarm); E int NDECL(doddoremarm);
E int FDECL(destroy_arm, (struct obj *)); E int FDECL(destroy_arm, (struct obj *));
+15 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)do_wear.c 3.4 2003/01/08 */ /* SCCS Id: @(#)do_wear.c 3.4 2003/03/10 */
/* 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. */
@@ -1447,6 +1447,8 @@ doputon()
You("cannot free your weapon hand to put on the ring."); You("cannot free your weapon hand to put on the ring.");
return(0); return(0);
} }
if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
return 1; /* costs a turn even though it didn't get worn */
setworn(otmp, mask); setworn(otmp, mask);
Ring_on(otmp); Ring_on(otmp);
} else if (otmp->oclass == AMULET_CLASS) { } else if (otmp->oclass == AMULET_CLASS) {
@@ -1454,6 +1456,8 @@ doputon()
already_wearing("an amulet"); already_wearing("an amulet");
return(0); return(0);
} }
if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
return 1;
setworn(otmp, W_AMUL); setworn(otmp, W_AMUL);
if (otmp->otyp == AMULET_OF_CHANGE) { if (otmp->otyp == AMULET_OF_CHANGE) {
Amulet_on(); Amulet_on();
@@ -1484,6 +1488,8 @@ doputon()
You_cant("wear that!"); You_cant("wear that!");
return(0); return(0);
} }
if (otmp->oartifact && !touch_artifact(otmp, &youmonst))
return 1;
Blindf_on(otmp); Blindf_on(otmp);
return(1); return(1);
} }
@@ -1651,6 +1657,14 @@ int otyp;
return (struct obj *)0; return (struct obj *)0;
} }
/* also for praying; find worn item that confers "Unchanging" attribute */
struct obj *
unchanger()
{
if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) return uamul;
return 0;
}
STATIC_PTR STATIC_PTR
int int
select_off(otmp) select_off(otmp)
+58 -31
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pray.c 3.4 2002/10/06 */ /* SCCS Id: @(#)pray.c 3.4 2003/03/10 */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -70,33 +70,37 @@ static int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */
* order to have the values be meaningful. * order to have the values be meaningful.
*/ */
#define TROUBLE_STONED 12 #define TROUBLE_STONED 13
#define TROUBLE_SLIMED 11 #define TROUBLE_SLIMED 12
#define TROUBLE_STRANGLED 10 #define TROUBLE_STRANGLED 11
#define TROUBLE_LAVA 9 #define TROUBLE_LAVA 10
#define TROUBLE_SICK 8 #define TROUBLE_SICK 9
#define TROUBLE_STARVING 7 #define TROUBLE_STARVING 8
#define TROUBLE_HIT 6 #define TROUBLE_HIT 7
#define TROUBLE_LYCANTHROPE 5 #define TROUBLE_LYCANTHROPE 6
#define TROUBLE_COLLAPSING 4 #define TROUBLE_COLLAPSING 5
#define TROUBLE_STUCK_IN_WALL 3 #define TROUBLE_STUCK_IN_WALL 4
#define TROUBLE_CURSED_LEVITATION 2 #define TROUBLE_CURSED_LEVITATION 3
#define TROUBLE_CURSED_BLINDFOLD 1 #define TROUBLE_UNUSEABLE_HANDS 2
#define TROUBLE_CURSED_BLINDFOLD 1
#define TROUBLE_PUNISHED (-1) #define TROUBLE_PUNISHED (-1)
#define TROUBLE_FUMBLING (-2) #define TROUBLE_FUMBLING (-2)
#define TROUBLE_CURSED_ITEMS (-3) #define TROUBLE_CURSED_ITEMS (-3)
#define TROUBLE_SADDLE (-4) #define TROUBLE_SADDLE (-4)
#define TROUBLE_BLIND (-5) #define TROUBLE_BLIND (-5)
#define TROUBLE_POISONED (-6) #define TROUBLE_POISONED (-6)
#define TROUBLE_WOUNDED_LEGS (-7) #define TROUBLE_WOUNDED_LEGS (-7)
#define TROUBLE_HUNGRY (-8) #define TROUBLE_HUNGRY (-8)
#define TROUBLE_STUNNED (-9) #define TROUBLE_STUNNED (-9)
#define TROUBLE_CONFUSED (-10) #define TROUBLE_CONFUSED (-10)
#define TROUBLE_HALLUCINATION (-11) #define TROUBLE_HALLUCINATION (-11)
/* We could force rehumanize of polyselfed people, but we can't tell /* We could force rehumanize of polyselfed people, but we can't tell
unintentional shape changes from the other kind. Oh well. */ unintentional shape changes from the other kind. Oh well.
3.4.2: make an exception if polymorphed into a form which lacks
hands; that's a case where the ramifications override this doubt.
*/
/* Return 0 if nothing particular seems wrong, positive numbers for /* Return 0 if nothing particular seems wrong, positive numbers for
serious trouble, and negative numbers for comparative annoyances. This serious trouble, and negative numbers for comparative annoyances. This
@@ -115,9 +119,7 @@ but that's really hard.
STATIC_OVL int STATIC_OVL int
in_trouble() in_trouble()
{ {
#ifdef STEED struct obj *otmp;
register struct obj *otmp;
#endif
int i, j, count=0; int i, j, count=0;
/* Borrowed from eat.c */ /* Borrowed from eat.c */
@@ -158,6 +160,15 @@ in_trouble()
stuck_ring(uleft, RIN_LEVITATION) || stuck_ring(uleft, RIN_LEVITATION) ||
stuck_ring(uright, RIN_LEVITATION)) stuck_ring(uright, RIN_LEVITATION))
return(TROUBLE_CURSED_LEVITATION); return(TROUBLE_CURSED_LEVITATION);
if (nohands(youmonst.data) || !freehand()) {
/* for bag/box access [cf use_container()]...
make sure it's a case that we know how to handle;
otherwise "fix all troubles" would get stuck in a loop */
if (welded(uwep)) return TROUBLE_UNUSEABLE_HANDS;
if (Upolyd && nohands(youmonst.data) && (!Unchanging ||
((otmp = unchanger()) != 0 && otmp->cursed)))
return TROUBLE_UNUSEABLE_HANDS;
}
if(Blindfolded && ublindf->cursed) return(TROUBLE_CURSED_BLINDFOLD); if(Blindfolded && ublindf->cursed) return(TROUBLE_CURSED_BLINDFOLD);
/* /*
@@ -202,9 +213,8 @@ worst_cursed_item()
if (Cursed_obj(otmp, LOADSTONE)) return otmp; if (Cursed_obj(otmp, LOADSTONE)) return otmp;
} }
/* weapon takes precedence if it is interfering /* weapon takes precedence if it is interfering
with taking off a ring or shield */ with taking off a ring or putting on a shield */
if (welded(uwep) && /* weapon */ if (welded(uwep) && (uright || bimanual(uwep))) { /* weapon */
(uright || (bimanual(uwep) && (uleft || uarms)))) {
otmp = uwep; otmp = uwep;
/* gloves come next, due to rings */ /* gloves come next, due to rings */
} else if (uarmg && uarmg->cursed) { /* gloves */ } else if (uarmg && uarmg->cursed) { /* gloves */
@@ -335,6 +345,23 @@ register int trouble;
if (otmp == uright) what = rightglow; if (otmp == uright) what = rightglow;
} }
goto decurse; goto decurse;
case TROUBLE_UNUSEABLE_HANDS:
if (welded(uwep)) {
otmp = uwep;
goto decurse;
}
if (Upolyd && nohands(youmonst.data)) {
if (!Unchanging) {
Your("shape becomes uncertain.");
rehumanize(); /* "You return to {normal} form." */
} else if ((otmp = unchanger()) != 0 && otmp->cursed) {
/* otmp is an amulet of unchanging */
goto decurse;
}
}
if (nohands(youmonst.data) || !freehand())
impossible("fix_worst_trouble: couldn't cure hands.");
break;
case TROUBLE_CURSED_BLINDFOLD: case TROUBLE_CURSED_BLINDFOLD:
otmp = ublindf; otmp = ublindf;
goto decurse; goto decurse;