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