Home | History | Annotate | Line # | Download | only in hack
hack.timeout.c revision 1.4
      1  1.4  christos /*	$NetBSD: hack.timeout.c,v 1.4 1997/10/19 16:59:08 christos Exp $	*/
      2  1.4  christos 
      3  1.2   mycroft /*
      4  1.2   mycroft  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
      5  1.2   mycroft  */
      6  1.2   mycroft 
      7  1.4  christos #include <sys/cdefs.h>
      8  1.2   mycroft #ifndef lint
      9  1.4  christos __RCSID("$NetBSD: hack.timeout.c,v 1.4 1997/10/19 16:59:08 christos Exp $");
     10  1.4  christos #endif				/* not lint */
     11  1.1       cgd 
     12  1.4  christos #include "hack.h"
     13  1.4  christos #include "extern.h"
     14  1.1       cgd 
     15  1.4  christos void
     16  1.4  christos timeout()
     17  1.4  christos {
     18  1.4  christos 	struct prop    *upp;
     19  1.4  christos 	if (Stoned)
     20  1.4  christos 		stoned_dialogue();
     21  1.4  christos 	for (upp = u.uprops; upp < u.uprops + SIZE(u.uprops); upp++)
     22  1.4  christos 		if ((upp->p_flgs & TIMEOUT) && !--upp->p_flgs) {
     23  1.4  christos 			if (upp->p_tofn)
     24  1.4  christos 				(*upp->p_tofn) ();
     25  1.4  christos 			else
     26  1.4  christos 				switch (upp - u.uprops) {
     27  1.4  christos 				case STONED:
     28  1.4  christos 					killer = "cockatrice";
     29  1.4  christos 					done("died");
     30  1.4  christos 					break;
     31  1.4  christos 				case SICK:
     32  1.4  christos 					pline("You die because of food poisoning.");
     33  1.4  christos 					killer = u.usick_cause;
     34  1.4  christos 					done("died");
     35  1.4  christos 					break;
     36  1.4  christos 				case FAST:
     37  1.4  christos 					pline("You feel yourself slowing down.");
     38  1.4  christos 					break;
     39  1.4  christos 				case CONFUSION:
     40  1.4  christos 					pline("You feel less confused now.");
     41  1.4  christos 					break;
     42  1.4  christos 				case BLIND:
     43  1.4  christos 					pline("You can see again.");
     44  1.4  christos 					setsee();
     45  1.4  christos 					break;
     46  1.4  christos 				case INVIS:
     47  1.4  christos 					on_scr(u.ux, u.uy);
     48  1.4  christos 					pline("You are no longer invisible.");
     49  1.4  christos 					break;
     50  1.4  christos 				case WOUNDED_LEGS:
     51  1.4  christos 					heal_legs();
     52  1.4  christos 					break;
     53  1.4  christos 				}
     54  1.1       cgd 		}
     55  1.1       cgd }
     56  1.1       cgd 
     57  1.1       cgd /* He is being petrified - dialogue by inmet!tower */
     58  1.4  christos char           *stoned_texts[] = {
     59  1.4  christos 	"You are slowing down.",/* 5 */
     60  1.4  christos 	"Your limbs are stiffening.",	/* 4 */
     61  1.1       cgd 	"Your limbs have turned to stone.",	/* 3 */
     62  1.4  christos 	"You have turned to stone.",	/* 2 */
     63  1.4  christos 	"You are a statue."	/* 1 */
     64  1.1       cgd };
     65  1.1       cgd 
     66  1.4  christos void
     67  1.1       cgd stoned_dialogue()
     68  1.1       cgd {
     69  1.4  christos 	long            i = (Stoned & TIMEOUT);
     70  1.1       cgd 
     71  1.4  christos 	if (i > 0 && i <= SIZE(stoned_texts))
     72  1.1       cgd 		pline(stoned_texts[SIZE(stoned_texts) - i]);
     73  1.4  christos 	if (i == 5)
     74  1.1       cgd 		Fast = 0;
     75  1.4  christos 	if (i == 3)
     76  1.1       cgd 		nomul(-3);
     77  1.1       cgd }
     78