]> granicus.if.org Git - nethack/commitdiff
eucalyptus leaf whistles
authornethack.rankin <nethack.rankin>
Thu, 26 Sep 2002 07:26:03 +0000 (07:26 +0000)
committernethack.rankin <nethack.rankin>
Thu, 26 Sep 2002 07:26:03 +0000 (07:26 +0000)
     Add <Someone>'s patch that enables using the apply command
on eucalyptus leaves to produce a whistle effect.  Blessed leaves
behave like magic whistles; I added a chance for the blessing to be
used up in the process.

     The invent.c diff is almost all reformatting.

doc/fixes34.1
src/apply.c
src/invent.c

index 523ac2329722d1b6ece0dd19616ae96907d10032..e26d6ce531d1131c59c4bf7ef6a509bf977e280a 100644 (file)
@@ -320,4 +320,5 @@ added validate_prefix_locations() for early directory prefix validation
 fire traps are particularly bad for paper and straw golems
 cream pies can be 'a'pplied to cause direct temporary blindness
 eating newt corpse or tin of same can boost magical energy (Malcolm Ryan)
+applying a eucalyptus leaf produces a whistle effect (Malcolm Ryan)
 
index 75f52d604bbc023948a1a66e003689df71088efd..0a277339a861f7a75ec68d10003e10a89d1b4d26 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)apply.c    3.4     2002/08/01      */
+/*     SCCS Id: @(#)apply.c    3.4     2002/09/25      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -327,7 +327,7 @@ struct obj *obj;
                        if (mintrap(mtmp) == 2) change_luck(-1);
                    }
                }
-               if (pet_cnt > 0) makeknown(MAGIC_WHISTLE);
+               if (pet_cnt > 0) makeknown(obj->otyp);
        }
 }
 
@@ -2740,7 +2740,7 @@ doapply()
 {
        register struct obj *obj;
        register int res = 1;
-       char class_list[MAXOCLASSES];
+       char class_list[MAXOCLASSES+2];
 
        if(check_capacity((char *)0)) return (0);
 
@@ -2748,7 +2748,8 @@ doapply()
                Strcpy(class_list, tools_too);
        else
                Strcpy(class_list, tools);
-       if (carrying(CREAM_PIE)) add_class(class_list, FOOD_CLASS);
+       if (carrying(CREAM_PIE) || carrying(EUCALYPTUS_LEAF))
+               add_class(class_list, FOOD_CLASS);
 
        obj = getobj(class_list, "use or apply");
        if(!obj) return 0;
@@ -2834,6 +2835,27 @@ doapply()
        case TIN_WHISTLE:
                use_whistle(obj);
                break;
+       case EUCALYPTUS_LEAF:
+               /* MRKR: Every Australian knows that a gum leaf makes an */
+               /*       excellent whistle, especially if your pet is a  */
+               /*       tame kangaroo named Skippy.                     */
+               if (obj->blessed) {
+                   use_magic_whistle(obj);
+                   /* sometimes the blessing will be worn off */
+                   if (!rn2(49)) {
+                       if (!Blind) {
+                           char buf[BUFSZ];
+
+                           pline("%s %s %s.", Shk_Your(buf, obj),
+                                 aobjnam(obj, "glow"), hcolor("brown"));
+                           obj->bknown = 1;
+                       }
+                       unbless(obj);
+                   }
+               } else {
+                   use_whistle(obj);
+               }
+               break;
        case STETHOSCOPE:
                res = use_stethoscope(obj);
                break;
index ed9d1208413f72d5cd71265d1717c0938a506407..4ef66089bdd8e0c80dbbe593e0edc8cd4c5ea15f 100644 (file)
@@ -865,14 +865,15 @@ register const char *let,*word;
                        !strcmp(word, "untrap with")) &&
                     /* Picks, axes, pole-weapons, bullwhips */
                    ((otmp->oclass == WEAPON_CLASS && !is_pick(otmp) &&
-                     !is_axe(otmp) && !is_pole(otmp) && otyp != BULLWHIP)
-               || (otmp->oclass == POTION_CLASS &&
+                     !is_axe(otmp) && !is_pole(otmp) && otyp != BULLWHIP) ||
+                    (otmp->oclass == POTION_CLASS &&
                     /* only applicable potion is oil, and it will only
                        be offered as a choice when already discovered */
                     (otyp != POT_OIL || !otmp->dknown ||
-                     !objects[POT_OIL].oc_name_known))
-               || (otmp->oclass == FOOD_CLASS && otyp != CREAM_PIE)
-               || (otmp->oclass == GEM_CLASS && !is_graystone(otmp))))
+                     !objects[POT_OIL].oc_name_known)) ||
+                    (otmp->oclass == FOOD_CLASS &&
+                     otyp != CREAM_PIE && otyp != EUCALYPTUS_LEAF) ||
+                    (otmp->oclass == GEM_CLASS && !is_graystone(otmp))))
                || (!strcmp(word, "invoke") &&
                    (!otmp->oartifact && !objects[otyp].oc_unique &&
                     (otyp != FAKE_AMULET_OF_YENDOR || otmp->known) &&