]> granicus.if.org Git - nethack/commitdiff
remove curse vs saddle
authorPatR <rankin@nethack.org>
Wed, 14 Apr 2021 19:51:20 +0000 (12:51 -0700)
committerPatR <rankin@nethack.org>
Wed, 14 Apr 2021 19:51:20 +0000 (12:51 -0700)
Prayer reward can already uncurse a cursed saddle because hero is
stuck on it.  Allow scroll/spell of remove curse to do so too.

The original riding implementation in slash'em operated with the
saddle in hero's inventory rather than in the steed's, so it would
have handled this without any extra effort.  Presumeably that was
overlooked when incorporating riding into nethack changed it to
have saddle be part of the steed's inventory instead of hero's.

doc/fixes37.0
src/potion.c
src/read.c
src/sit.c
src/steed.c

index 59452ef65098df23cb37b8857e04d3d03aa98631..a9b39b92834b90b172704bb17dc16806f0770ca8 100644 (file)
@@ -454,6 +454,7 @@ if a branch has only one level (Fort Ludios), prevent creation of any level
        wishing could attempt to place one)
 opening/unlocking magic zapped at monster holding the hero will release hold
        (zap at engulfer already expels hero); zapping at self has same effect
+when riding, allow scroll of remove curse to affect to affect steed's saddle
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index e8cb131bd7e76f8d7c3c92beedb91fe36ddc479a..22c21c06044deb5b048717274d52acc624584992 100644 (file)
@@ -1214,12 +1214,13 @@ bottlename(void)
 
 /* handle item dipped into water potion or steed saddle splashed by same */
 static boolean
-H2Opotion_dip(struct obj *potion, struct obj *targobj,
-              boolean useeit,
-              const char *objphrase) /* "Your widget glows" or "Steed's saddle
-                                        glows" */
+H2Opotion_dip(struct obj *potion,    /* water */
+              struct obj *targobj,   /* item being dipped into the water */
+              boolean useeit,        /* will hero see the glow/aura? */
+              const char *objphrase) /* "Your widget glows" or
+                                      * "Steed's saddle glows" */
 {
-    void (*func)(OBJ_P) = 0;
+    void (*func)(struct obj *) = 0;
     const char *glowcolor = 0;
 #define COST_alter (-2)
 #define COST_none (-1)
index 5489258cb1283b725a18fafec5d1ef116cd69904..4e9e70971c59a96df710cad2e8a75ba79676bcd8 100644 (file)
@@ -935,7 +935,7 @@ display_stinking_cloud_positions(int state)
 /* scroll effects; return 1 if we use up the scroll and possibly make it
    become discovered, 0 if caller should take care of those side-effects */
 int
-seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll-like spell */
+seffects(struct obj *sobj) /* sobj - scroll or fake spellbook for spell */
 {
     int cval, otyp = sobj->otyp;
     boolean confused = (Confusion != 0), sblessed = sobj->blessed,
@@ -1300,9 +1300,26 @@ seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll
                            known not to be, make the scroll known; it's
                            trivial to identify anyway by comparing inventory
                            before and after */
-                        if (obj->bknown && otyp == SCR_REMOVE_CURSE) {
+                        if (obj->bknown && otyp == SCR_REMOVE_CURSE)
                             learnscrolltyp(SCR_REMOVE_CURSE);
-                        }
+                    }
+                }
+            }
+            /* if riding, treat steed's saddle as if part of hero's invent */
+            if (u.usteed && (obj = which_armor(u.usteed, W_SADDLE)) != 0) {
+                if (confused) {
+                    blessorcurse(obj, 2);
+                    obj->bknown = 0; /* skip set_bknown() */
+                } else if (obj->cursed) {
+                    uncurse(obj);
+                    /* like rndcurse(sit.c), effect on regular inventory
+                       doesn't show things glowing but saddle does */
+                    if (!Blind) {
+                        pline("%s %s.", Yobjnam2(obj, "glow"),
+                              hcolor("amber"));
+                        obj->bknown = Hallucination ? 0 : 1;
+                    } else {
+                        obj->bknown = 0; /* skip set_bknown() */
                     }
                 }
             }
index abaf704b2c05384c169f1e6b9fc36649a0765d80..ac22bbbe4e345f502093fd316292d4dc25f5ecec 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -394,7 +394,9 @@ rndcurse(void)
         if (!Blind) {
             pline("%s %s.", Yobjnam2(otmp, "glow"),
                   hcolor(otmp->cursed ? NH_BLACK : (const char *) "brown"));
-            otmp->bknown = 1; /* ok to bypass set_bknown() here */
+            otmp->bknown = Hallucination ? 0 : 1; /* bypass set_bknown() */
+        } else {
+            otmp->bknown = 0; /* bypass set_bknown() */
         }
     }
 }
index 93b12d58e002eb185fc921930491e886c56343c4..f3b3f2904eb6924600b349c2b9a4e84c6fdef7d3 100644 (file)
@@ -58,7 +58,8 @@ use_saddle(struct obj* otmp)
     }
 
     /* Is this a valid monster? */
-    if (mtmp->misc_worn_check & W_SADDLE || which_armor(mtmp, W_SADDLE)) {
+    if ((mtmp->misc_worn_check & W_SADDLE) != 0L
+        || which_armor(mtmp, W_SADDLE)) {
         pline("%s doesn't need another one.", Monnam(mtmp));
         return 1;
     }