1 #include "spelllist.h"
2 
3 #define PrintMsg(msg)   (log_text(self, msg),\
4 			self->callbacks.proc_PrintMsg)((msg), self,\
5 			(self->rock))
6 #define PrintMsg2(person, msg1, msgelse)   (log_text(self, msgelse),\
7 			self->callbacks.proc_PrintMsg2)((person), (msg1),\
8 			(msgelse), self, (self->rock))
9 #define PrintMsg3(person1, person2, msg1, msg2, msgelse)   (log_text(self, msgelse),\
10 			self->callbacks.proc_PrintMsg3)((person1), (person2),\
11 			(msg1), (msg2), (msgelse), self, (self->rock))
12 #define Queries(numqueries, querylist)   (setup_targetlist(self),\
13 			(self->callbacks.proc_Queries)((numqueries),\
14 			(querylist), self, (self->rock)))
15 
16 #define MAXSPELLCHOICES (16)	/* max number of spells that could possibly be
17 				invoked with one gesture */
18 
19 struct target {
20     char *name;
21     int index;
22     long stuff;
23 };
24 
25 struct realgame {
26     struct interface callbacks;
27     char *rock;
28     int numplayers;
29     int turn;
30     int turntype;
31     int turnactive[MAXPLAYERS];
32 
33     char *gamelog;
34     int gamelog_pos;
35     int gamelog_size;
36 
37     struct wizard *wiz[MAXPLAYERS];
38     struct creature *cre;
39     int numcres, cre_size;
40 
41     struct query *querylist;
42     int querylist_size;
43     int numqueries;
44 
45     int numtargets[3];
46     struct target *targetlist[3];
47     int targetlist_size[3];
48 
49     struct castspell *castlist, *hastelist;
50 
51     /* per-round data */
52     int fl_icestorm, fl_firestorm, fl_dispelmagic;
53     int blind_array;
54 };
55 
56 struct wizgesture {
57     int did[2];
58     int invisible; /* was invisible for this move? */
59     int blind; /* bit-array -- who was blind this move? */
60     int turnnum, log_hp;
61 };
62 
63 struct permstats {
64     int mind_spell, mind_detail;
65     int fl_haste;
66     int fl_prot_evil;
67     int fl_resist_heat;
68     int fl_resist_cold;
69     int fl_blindness;
70     int fl_invisibility;
71 };
72 
73 struct wizard {
74     int alive;
75     int hitpoints, max_hitpoints;
76     int resistant_heat, resistant_cold, prot_from_evil, haste, timestop;
77     int invisibility, blindness;
78     int poison_time, disease_time;
79     int mind_spell, mind_caster;
80     struct permstats perm;
81     char *name;
82     int gender;
83     /* per-round */
84     int zaplist[NUMSPELLS];
85     int enchant_caster, raisedead_caster, enchant_ppend;
86     int fl_resist_heat, fl_resist_cold;
87     int fl_resist_icestorm; /* due to fireball hits */
88 
89     int numgests;
90     int gests_size;
91     struct wizgesture *gests;
92     int surrendered;
93     int fl_cast_lightning;
94     int hand_paralyzed;
95     int perm_time, delay_time;
96     int delay_bank;
97 
98     int foundlist[NUMSPELLS];
99     int llist[MAXSPELLCHOICES], rlist[MAXSPELLCHOICES];
100 };
101 
102 struct creature {
103     int alive;
104     int hitpoints, max_hitpoints;
105     int resistant_heat, resistant_cold, prot_from_evil, haste, timestop;
106     int invisibility, blindness;
107     int poison_time, disease_time;
108     int mind_spell, mind_caster;
109     struct permstats perm;
110     char *name;
111     int gender;
112     /* per-round */
113     int zaplist[NUMSPELLS];
114     int enchant_caster, raisedead_caster, enchant_ppend;
115     int fl_resist_heat, fl_resist_cold;
116     int fl_resist_icestorm; /* due to fireball hits */
117 
118     int type;
119     int nocorpse;
120     int owner;
121     int last_target, last_targettype;
122     int nowm_spell, nowm_caster;
123 };
124 
125 union being {
126     struct {
127 	int alive;
128 	int hitpoints, max_hitpoints;
129 	int resistant_heat, resistant_cold, prot_from_evil, haste, timestop;
130 	int invisibility, blindness;
131 	int poison_time, disease_time;
132 	int mind_spell, mind_caster;
133 	struct permstats perm;
134 	char *name;
135 	int gender;
136 	/* per-round */
137 	int zaplist[NUMSPELLS];
138 	int enchant_caster, raisedead_caster, enchant_ppend;
139 	int fl_resist_heat, fl_resist_cold;
140 	int fl_resist_icestorm; /* due to fireball hits */
141     } both;
142 
143     struct wizard wiz;
144     struct creature cre;
145 };
146 
147 
148 #define MASK_LEFT (1)
149 #define MASK_RIGHT (2)
150 #define MASK_TWOHAND (4)
151 
152 struct castspell {
153     int caster;
154     int handage;
155     int spellnum;
156     int target;
157     int targettype; /* QuVal_Target_*, or 0 for nobody, or (-1) for no target required */
158     int permanent;
159     int rock;
160 
161     struct castspell *next;
162 };
163 
164 #define Creature_GOBLIN (1)
165 #define Creature_OGRE   (2)
166 #define Creature_TROLL  (3)
167 #define Creature_GIANT  (4)
168 #define Creature_ICEL   (5)
169 #define Creature_FIREL  (6)
170 
171 extern void setup_targetlist(); /* needed if Queries() is to be used */
172