1 |
/* |
2 |
* static char *rcsid_attack_h = |
3 |
* "$Id$"; |
4 |
*/ |
5 |
|
6 |
/* |
7 |
CrossFire, A Multiplayer game for X-windows |
8 |
|
9 |
Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
10 |
Copyright (C) 1992 Frank Tore Johansen |
11 |
|
12 |
This program is free software; you can redistribute it and/or modify |
13 |
it under the terms of the GNU General Public License as published by |
14 |
the Free Software Foundation; either version 2 of the License, or |
15 |
(at your option) any later version. |
16 |
|
17 |
This program is distributed in the hope that it will be useful, |
18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 |
GNU General Public License for more details. |
21 |
|
22 |
You should have received a copy of the GNU General Public License |
23 |
along with this program; if not, write to the Free Software |
24 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 |
|
26 |
The authors can be reached via e-mail at crossfire-devel@real-time.com |
27 |
*/ |
28 |
|
29 |
|
30 |
#ifndef ATTACK_H |
31 |
#define ATTACK_H |
32 |
|
33 |
/* These are default values for converting from simple protected/immune/vuln |
34 |
* to thre partial resistances |
35 |
*/ |
36 |
#define RESIST_IMMUNE 100 |
37 |
#define RESIST_PROT 30 |
38 |
#define RESIST_VULN -100 |
39 |
|
40 |
/* |
41 |
* Attacktypes: |
42 |
* ATNR_... is the attack number that is indexed into the |
43 |
* the resist array in the object structure. |
44 |
*/ |
45 |
|
46 |
#define NROFATTACKS 26 |
47 |
#define NROFATTACKMESS 20 |
48 |
#define MAXATTACKMESS 20 |
49 |
|
50 |
/* attack message numbers must be less than NROFATTACKMESS */ |
51 |
|
52 |
#define ATM_ARROW 0 |
53 |
#define ATM_DRAIN 1 |
54 |
#define ATM_ELEC 2 |
55 |
#define ATM_COLD 3 |
56 |
#define ATM_FIRE 4 |
57 |
#define ATM_BASIC 5 |
58 |
#define ATM_KARATE 6 |
59 |
#define ATM_CLAW 7 |
60 |
#define ATM_PUNCH 8 |
61 |
#define ATM_SLASH 9 |
62 |
#define ATM_PIERCE 10 |
63 |
#define ATM_CLEAVE 11 |
64 |
#define ATM_SLICE 12 |
65 |
#define ATM_STAB 13 |
66 |
#define ATM_WHIP 14 |
67 |
#define ATM_CRUSH 15 |
68 |
#define ATM_BLUD 16 |
69 |
#define ATM_DOOR 17 |
70 |
#define ATM_SUFFER 18 |
71 |
|
72 |
/* Note that the last ATNR_ should be one less than NROFATTACKS above |
73 |
* since the ATNR starts counting at zero. |
74 |
* For compatible loading, these MUST correspond to the same value |
75 |
* as the bitmasks below. |
76 |
*/ |
77 |
#define ATNR_PHYSICAL 0 |
78 |
#define ATNR_MAGIC 1 |
79 |
#define ATNR_FIRE 2 |
80 |
#define ATNR_ELECTRICITY 3 |
81 |
#define ATNR_COLD 4 |
82 |
#define ATNR_CONFUSION 5 |
83 |
#define ATNR_ACID 6 |
84 |
#define ATNR_DRAIN 7 |
85 |
#define ATNR_WEAPONMAGIC 8 |
86 |
#define ATNR_GHOSTHIT 9 |
87 |
#define ATNR_POISON 10 |
88 |
#define ATNR_SLOW 11 |
89 |
#define ATNR_PARALYZE 12 |
90 |
#define ATNR_TURN_UNDEAD 13 |
91 |
#define ATNR_FEAR 14 |
92 |
#define ATNR_CANCELLATION 15 |
93 |
#define ATNR_DEPLETE 16 |
94 |
#define ATNR_DEATH 17 |
95 |
#define ATNR_CHAOS 18 |
96 |
#define ATNR_COUNTERSPELL 19 |
97 |
#define ATNR_GODPOWER 20 |
98 |
#define ATNR_HOLYWORD 21 |
99 |
#define ATNR_BLIND 22 |
100 |
#define ATNR_INTERNAL 23 |
101 |
#define ATNR_LIFE_STEALING 24 |
102 |
#define ATNR_DISEASE 25 |
103 |
|
104 |
#define AT_PHYSICAL 0x00000001 /* 1 */ |
105 |
#define AT_MAGIC 0x00000002 /* 2 */ |
106 |
#define AT_FIRE 0x00000004 /* 4 */ |
107 |
#define AT_ELECTRICITY 0x00000008 /* 8 */ |
108 |
#define AT_COLD 0x00000010 /* 16 */ |
109 |
#define AT_CONFUSION 0x00000020 /* 32 The spell will use this one */ |
110 |
#define AT_ACID 0x00000040 /* 64 Things might corrode when hit */ |
111 |
#define AT_DRAIN 0x00000080 /* 128 */ |
112 |
#define AT_WEAPONMAGIC 0x00000100 /* 256 Very special, use with care */ |
113 |
#define AT_GHOSTHIT 0x00000200 /* 512 Attacker dissolves */ |
114 |
#define AT_POISON 0x00000400 /* 1024 */ |
115 |
#define AT_SLOW 0x00000800 /* 2048 */ |
116 |
#define AT_PARALYZE 0x00001000 /* 4096 */ |
117 |
#define AT_TURN_UNDEAD 0x00002000 /* 8192 */ |
118 |
#define AT_FEAR 0x00004000 /* 16384 */ |
119 |
#define AT_CANCELLATION 0x00008000 /* 32768 ylitalo@student.docs.uu.se */ |
120 |
#define AT_DEPLETE 0x00010000 /* 65536 vick@bern.docs.uu.se */ |
121 |
#define AT_DEATH 0x00020000 /* 131072 peterm@soda.berkeley.edu */ |
122 |
#define AT_CHAOS 0x00040000 /* 262144 peterm@soda.berkeley.edu*/ |
123 |
#define AT_COUNTERSPELL 0x00080000 /* 524288 peterm@soda.berkeley.edu*/ |
124 |
#define AT_GODPOWER 0x00100000 /* 1048576 peterm@soda.berkeley.edu */ |
125 |
#define AT_HOLYWORD 0x00200000 /* 2097152 race selective attack thomas@astro.psu.edu */ |
126 |
#define AT_BLIND 0x00400000 /* 4194304 thomas@astro.psu.edu */ |
127 |
#define AT_INTERNAL 0x00800000 /* Only used for internal calculations */ |
128 |
#define AT_LIFE_STEALING \ |
129 |
0x01000000 /* 16777216 for hp drain */ |
130 |
#define AT_DISEASE 0x02000000 /* 33554432 disease attacktypes */ |
131 |
|
132 |
/* attacktypes_load is suffixed to resist_ when saving objects. |
133 |
* (so the line may be 'resist_fire' 20 for example). These are never |
134 |
* seen by the player. loader.l uses the same names, but it doesn't look |
135 |
* like you can use these values, so in that function they are hard coded. |
136 |
*/ |
137 |
|
138 |
/* Note that internal should not ever be referanced in the last two |
139 |
* tables. however, other resisttypes may be added, and if through some |
140 |
* bug these do get used somehow, might as well make it more easier to notice |
141 |
* and not have mystery values appear. |
142 |
*/ |
143 |
|
144 |
/* attack messages structure */ |
145 |
typedef struct attackmess { |
146 |
int level; |
147 |
char *buf1; |
148 |
char *buf2; |
149 |
char *buf3; |
150 |
} attackmess_t; |
151 |
|
152 |
EXTERN attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]; |
153 |
|
154 |
#ifndef INIT_C |
155 |
EXTERN int resist_table[]; |
156 |
EXTERN char *change_resist_msg[NROFATTACKS]; |
157 |
EXTERN char *resist_plus[NROFATTACKS]; |
158 |
EXTERN char *attacktype_desc[NROFATTACKS]; |
159 |
EXTERN char *resist_save[NROFATTACKS]; |
160 |
|
161 |
/* Beware, names require an _ if there is a space, else they will be read |
162 |
* as for example: resist_life stealing 50! |
163 |
*/ |
164 |
#else |
165 |
EXTERN const char* resist_save[NROFATTACKS] = { |
166 |
"physical ", "magic ", "fire ", "electricity ", "cold ", "confusion ", "acid ", |
167 |
"drain ", "weaponmagic ", "ghosthit ", "poison ", "slow ", "paralyze ", |
168 |
"turn_undead ", "fear ", "cancellation ", "deplete ", "death ", "chaos ", |
169 |
"counterspell ", "godpower ", "holyword ", "blind " , "internal ", "life_stealing ", |
170 |
"disease " |
171 |
}; |
172 |
|
173 |
/* Short description of names of the attacktypes */ |
174 |
EXTERN const char* attacktype_desc[NROFATTACKS] = { |
175 |
"physical", "magic", "fire", "electricity", "cold", "confusion", "acid", |
176 |
"drain", "weapon magic", "ghost hit", "poison", "slow", "paralyze", |
177 |
"turn undead", "fear", "cancellation", "deplete", "death", "chaos", |
178 |
"counterspell", "god power", "holy word", "blind" , "internal", "life stealing", |
179 |
"disease" |
180 |
}; |
181 |
|
182 |
/* This is the array that is what the player sees. */ |
183 |
|
184 |
EXTERN const char* resist_plus[NROFATTACKS] = { |
185 |
"armour", "resist magic", "resist fire", "resist electricity", "resist cold", |
186 |
"resist confusion", "resist acid", "resist drain", |
187 |
"resist weaponmagic", "resist ghosthit", "resist poison", "resist slow", |
188 |
"resist paralyzation", "resist turn undead", "resist fear", |
189 |
"resist cancellation", "resist depletion", "resist death", "resist chaos", |
190 |
"resist counterspell", "resist god power", "resist holy word", |
191 |
"resist blindness" , "resist internal", "resist life stealing", |
192 |
"resist diseases" |
193 |
}; |
194 |
|
195 |
/* These are the descriptions of the resistances displayed when a |
196 |
* player puts on/takes off an item. See change_abil() in living.c. |
197 |
*/ |
198 |
EXTERN const char* change_resist_msg[NROFATTACKS] = { |
199 |
"physical", "magic", "fire", "electricity", "cold", "confusion", "acid", |
200 |
"draining", "weapon magic", "ghosts", "poison", "slow", "paralyze", |
201 |
"turn undead", "fear", "cancellation", "depletion", "death attacks", "chaos", |
202 |
"counterspell", "god power", "holy word", "blinding attacks", "internal", |
203 |
"life stealing", "disease" |
204 |
}; |
205 |
|
206 |
|
207 |
/* If you want to weight things so certain resistances show up more often than |
208 |
* others, just add more entries in the table for the protections you want to |
209 |
* show up. |
210 |
*/ |
211 |
EXTERN int resist_table[] = {ATNR_PHYSICAL, ATNR_MAGIC, ATNR_FIRE, |
212 |
ATNR_ELECTRICITY,ATNR_COLD, ATNR_CONFUSION, ATNR_ACID, ATNR_DRAIN, |
213 |
ATNR_GHOSTHIT, ATNR_POISON, ATNR_SLOW, ATNR_PARALYZE, ATNR_TURN_UNDEAD, |
214 |
ATNR_FEAR, ATNR_DEPLETE, ATNR_DEATH, ATNR_HOLYWORD, ATNR_BLIND, |
215 |
ATNR_LIFE_STEALING, ATNR_DISEASE}; |
216 |
|
217 |
#endif |
218 |
|
219 |
#define num_resist_table 19 |
220 |
|
221 |
#endif |