From: nethack.allison Date: Sat, 27 Jul 2002 20:48:45 +0000 (+0000) Subject: From the newsgroup, there was a discussion about how you X-Git-Tag: MOVE2GIT~2587 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02ed5c37c93c5ac9bff1d91da74dabaee83e0f3a;p=nethack From the newsgroup, there was a discussion about how you can't just blind yourself with a cream pie in your inventory directly by applying it or by throwing it. On 27 Jul 2002 14:11:06 GMT, wrote: > wrote: >> () hypothesised: >> >> [cream pie] >>> So I a)pply the pie. What I want to do is to hit MYSELF in the >>> face with the pie, thereby blinding me and giving me T-P for >>> just a few turns. >> >> Not a bad TTDTDTO ("Thing The DevTeam Didn't Think Of," which is >> subtly different to a YANI, and not a bug; sorry, I seem to be >> on a neologismathon today.) > I tried throwing a cream pie upwards, hoping it would blind me, > but no luck: > > "A cream pie hits the ceiling. What a mess!" > --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 0272c0b0e..46cdfb247 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -213,3 +213,4 @@ debug mode: #panic routine to test panic() and panic save file generation a new PANICLOG optional file to log the reason for panic and impossible messages 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 diff --git a/src/apply.c b/src/apply.c index d70b7a2c2..a4654345a 100644 --- a/src/apply.c +++ b/src/apply.c @@ -34,11 +34,13 @@ STATIC_DCL void FDECL(use_stone, (struct obj *)); STATIC_PTR int NDECL(set_trap); /* occupation callback */ STATIC_DCL int FDECL(use_whip, (struct obj *)); STATIC_DCL int FDECL(use_pole, (struct obj *)); +STATIC_DCL int FDECL(use_cream_pie, (struct obj *)); STATIC_DCL int FDECL(use_grapple, (struct obj *)); STATIC_DCL int FDECL(do_break_wand, (struct obj *)); STATIC_DCL boolean FDECL(figurine_location_checks, (struct obj *, coord *, BOOLEAN_P)); STATIC_DCL boolean NDECL(uhave_graystone); +STATIC_DCL void FDECL(add_class, (char *, CHAR_P)); #ifdef AMIGA void FDECL( amii_speaker, ( struct obj *, char *, int ) ); @@ -2382,6 +2384,44 @@ use_pole (obj) return (1); } +STATIC_OVL int +use_cream_pie(obj) +struct obj *obj; +{ + boolean wasblind = Blind; + boolean wascreamed = u.ucreamed; + boolean several = FALSE; + + if (obj->quan > 1L) { + several = TRUE; + obj = splitobj(obj, 1L); + } + if (Hallucination) + You("give yourself a facial."); + else + pline("You immerse your %s in %s%s.", body_part(FACE), + several ? "one of " : "", + several ? makeplural(the(xname(obj))) : the(xname(obj))); + if(can_blnd((struct monst*)0, &youmonst, AT_WEAP, obj)) { + int blindinc = rnd(25); + u.ucreamed += blindinc; + make_blinded(Blinded + (long)blindinc, FALSE); + if (!Blind || (Blind && wasblind)) + pline("There's %ssticky goop all over your %s.", + wascreamed ? "more " : "", + body_part(FACE)); + else /* Blind && !wasblind */ + You_cant("see through all the sticky goop on your %s.", + body_part(FACE)); + } + if (obj->unpaid) { + verbalize("You used it, you bought it!"); + bill_dummy_object(obj); + } + obj_extract_self(obj); + delobj(obj); + return(0); +} STATIC_OVL int use_grapple (obj) @@ -2662,15 +2702,33 @@ uhave_graystone() return FALSE; } +STATIC_OVL void +add_class(cl, class) +char *cl; +char class; +{ + char tmp[2]; + tmp[0] = class; + tmp[1] = '\0'; + Strcat(cl, tmp); +} + int doapply() { register struct obj *obj; register int res = 1; + char class_list[MAXOCLASSES]; if(check_capacity((char *)0)) return (0); - obj = getobj(carrying(POT_OIL) || uhave_graystone() - ? tools_too : tools, "use or apply"); + + if (carrying(POT_OIL) || uhave_graystone()) + Strcpy(class_list, tools_too); + else + Strcpy(class_list, tools); + if (carrying(CREAM_PIE)) add_class(class_list, FOOD_CLASS); + + obj = getobj(class_list, "use or apply"); if(!obj) return 0; if (obj->oclass == WAND_CLASS) @@ -2688,6 +2746,9 @@ doapply() ublindf->otyp == BLINDFOLD ? "wearing a blindfold" : "wearing lenses"); break; + case CREAM_PIE: + res = use_cream_pie(obj); + break; case BULLWHIP: res = use_whip(obj); break; diff --git a/src/invent.c b/src/invent.c index 9880e4646..2dd0d5713 100644 --- a/src/invent.c +++ b/src/invent.c @@ -871,6 +871,7 @@ register const char *let,*word; 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)))) || (!strcmp(word, "invoke") && (!otmp->oartifact && !objects[otyp].oc_unique &&