]> granicus.if.org Git - nethack/commitdiff
From the newsgroup, there was a discussion about how you
authornethack.allison <nethack.allison>
Sat, 27 Jul 2002 20:48:45 +0000 (20:48 +0000)
committernethack.allison <nethack.allison>
Sat, 27 Jul 2002 20:48:45 +0000 (20:48 +0000)
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, <Someone> wrote:
> <email deleted> wrote:
>> <email deleted> (<Someone>) 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!"
>

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

index 0272c0b0e880f2478dee555a34df315d7dbe9268..46cdfb2478d57cb640fa6362cf2c81ae15711d65 100644 (file)
@@ -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
index d70b7a2c2cbcba21436ff1a4a272c64ba0bab8c3..a4654345aeda7a411a2397b118a21d8887d8bc60 100644 (file)
@@ -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;
index 9880e46465e03acf8038ebc2b4636576b96525f2..2dd0d571354c7fe895e11dd86112a26716728c0c 100644 (file)
@@ -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 &&