]> granicus.if.org Git - nethack/commitdiff
new prayer trouble
authornethack.rankin <nethack.rankin>
Mon, 10 Mar 2003 23:49:04 +0000 (23:49 +0000)
committernethack.rankin <nethack.rankin>
Mon, 10 Mar 2003 23:49:04 +0000 (23:49 +0000)
     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.

doc/fixes34.2
include/extern.h
src/do_wear.c
src/pray.c

index dca8823c1bef7f9ed78afa5ed05e5368f4db5854..ad96b7dee785530edd76ca6567206755406b10b2 100644 (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
        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
index b2e5b302e78feeccb1b9c15709a6811ab8c16f82..e8623fe2b681b06126303e5f5126df0ddb63c61f 100644 (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.                              */
 /* 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 *));
index d4889e97aee2a7f5549f0bbe0f1505036dac65e7..5d25d621c04bc8cee2552f1f394549bc5b74159a 100644 (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. */
 /* 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)
index 75468cfb23d07848c7f2668f1b290e7a8834d005..1c26474cb5cda6545586907548b92d581198f3a3 100644 (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. */
 /* 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;