eucalyptus leaf whistles

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.
This commit is contained in:
nethack.rankin
2002-09-26 07:26:03 +00:00
parent bd6f5b87bf
commit ef14456b3d
3 changed files with 33 additions and 9 deletions

View 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)

View 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;

View 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) &&