From: nethack.rankin Date: Mon, 10 Mar 2003 23:49:04 +0000 (+0000) Subject: new prayer trouble X-Git-Tag: MOVE2GIT~2091 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b1811007cc30447149a96e3ac9d76397bfde5c6;p=nethack 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. --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index dca8823c1..ad96b7dee 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 game is over 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 diff --git a/include/extern.h b/include/extern.h index b2e5b302e..e8623fe2b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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. */ /* 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 void FDECL(erode_armor, (struct monst *,BOOLEAN_P)); E struct obj *FDECL(stuck_ring, (struct obj *,int)); +E struct obj *NDECL(unchanger); E void NDECL(reset_remarm); E int NDECL(doddoremarm); E int FDECL(destroy_arm, (struct obj *)); diff --git a/src/do_wear.c b/src/do_wear.c index d4889e97a..5d25d621c 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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. */ /* 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."); return(0); } + if (otmp->oartifact && !touch_artifact(otmp, &youmonst)) + return 1; /* costs a turn even though it didn't get worn */ setworn(otmp, mask); Ring_on(otmp); } else if (otmp->oclass == AMULET_CLASS) { @@ -1454,6 +1456,8 @@ doputon() already_wearing("an amulet"); return(0); } + if (otmp->oartifact && !touch_artifact(otmp, &youmonst)) + return 1; setworn(otmp, W_AMUL); if (otmp->otyp == AMULET_OF_CHANGE) { Amulet_on(); @@ -1484,6 +1488,8 @@ doputon() You_cant("wear that!"); return(0); } + if (otmp->oartifact && !touch_artifact(otmp, &youmonst)) + return 1; Blindf_on(otmp); return(1); } @@ -1651,6 +1657,14 @@ int otyp; 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 int select_off(otmp) diff --git a/src/pray.c b/src/pray.c index 75468cfb2..1c26474cb 100644 --- a/src/pray.c +++ b/src/pray.c @@ -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. */ /* 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. */ -#define TROUBLE_STONED 12 -#define TROUBLE_SLIMED 11 -#define TROUBLE_STRANGLED 10 -#define TROUBLE_LAVA 9 -#define TROUBLE_SICK 8 -#define TROUBLE_STARVING 7 -#define TROUBLE_HIT 6 -#define TROUBLE_LYCANTHROPE 5 -#define TROUBLE_COLLAPSING 4 -#define TROUBLE_STUCK_IN_WALL 3 -#define TROUBLE_CURSED_LEVITATION 2 -#define TROUBLE_CURSED_BLINDFOLD 1 - -#define TROUBLE_PUNISHED (-1) -#define TROUBLE_FUMBLING (-2) -#define TROUBLE_CURSED_ITEMS (-3) -#define TROUBLE_SADDLE (-4) -#define TROUBLE_BLIND (-5) -#define TROUBLE_POISONED (-6) -#define TROUBLE_WOUNDED_LEGS (-7) -#define TROUBLE_HUNGRY (-8) -#define TROUBLE_STUNNED (-9) -#define TROUBLE_CONFUSED (-10) -#define TROUBLE_HALLUCINATION (-11) +#define TROUBLE_STONED 13 +#define TROUBLE_SLIMED 12 +#define TROUBLE_STRANGLED 11 +#define TROUBLE_LAVA 10 +#define TROUBLE_SICK 9 +#define TROUBLE_STARVING 8 +#define TROUBLE_HIT 7 +#define TROUBLE_LYCANTHROPE 6 +#define TROUBLE_COLLAPSING 5 +#define TROUBLE_STUCK_IN_WALL 4 +#define TROUBLE_CURSED_LEVITATION 3 +#define TROUBLE_UNUSEABLE_HANDS 2 +#define TROUBLE_CURSED_BLINDFOLD 1 + +#define TROUBLE_PUNISHED (-1) +#define TROUBLE_FUMBLING (-2) +#define TROUBLE_CURSED_ITEMS (-3) +#define TROUBLE_SADDLE (-4) +#define TROUBLE_BLIND (-5) +#define TROUBLE_POISONED (-6) +#define TROUBLE_WOUNDED_LEGS (-7) +#define TROUBLE_HUNGRY (-8) +#define TROUBLE_STUNNED (-9) +#define TROUBLE_CONFUSED (-10) +#define TROUBLE_HALLUCINATION (-11) /* 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 serious trouble, and negative numbers for comparative annoyances. This @@ -115,9 +119,7 @@ but that's really hard. STATIC_OVL int in_trouble() { -#ifdef STEED - register struct obj *otmp; -#endif + struct obj *otmp; int i, j, count=0; /* Borrowed from eat.c */ @@ -158,6 +160,15 @@ in_trouble() stuck_ring(uleft, RIN_LEVITATION) || stuck_ring(uright, RIN_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); /* @@ -202,9 +213,8 @@ worst_cursed_item() if (Cursed_obj(otmp, LOADSTONE)) return otmp; } /* weapon takes precedence if it is interfering - with taking off a ring or shield */ - if (welded(uwep) && /* weapon */ - (uright || (bimanual(uwep) && (uleft || uarms)))) { + with taking off a ring or putting on a shield */ + if (welded(uwep) && (uright || bimanual(uwep))) { /* weapon */ otmp = uwep; /* gloves come next, due to rings */ } else if (uarmg && uarmg->cursed) { /* gloves */ @@ -335,6 +345,23 @@ register int trouble; if (otmp == uright) what = rightglow; } 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: otmp = ublindf; goto decurse;