From: nethack.rankin Date: Thu, 26 Sep 2002 07:26:03 +0000 (+0000) Subject: eucalyptus leaf whistles X-Git-Tag: MOVE2GIT~2406 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef14456b3dfce922190308364fb336228f8c1898;p=nethack eucalyptus leaf whistles Add '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. --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 523ac2329..e26d6ce53 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -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) diff --git a/src/apply.c b/src/apply.c index 75f52d604..0a277339a 100644 --- a/src/apply.c +++ b/src/apply.c @@ -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; diff --git a/src/invent.c b/src/invent.c index ed9d12084..4ef66089b 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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) &&