ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/attack.h
(Generate patch)

Comparing deliantra/server/include/attack.h (file contents):
Revision 1.3 by root, Tue Aug 29 08:01:36 2006 UTC vs.
Revision 1.8 by root, Sat Sep 16 22:06:17 2006 UTC

1/*
2 * static char *rcsid_attack_h =
3 * "$Id: attack.h,v 1.3 2006/08/29 08:01:36 root Exp $";
4 */
5
6/* 1/*
7 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
8 3
9 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 20
26 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at crossfire-devel@real-time.com
27*/ 22*/
28 23
29
30#ifndef ATTACK_H 24#ifndef ATTACK_H
31#define ATTACK_H 25#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 26
40/* 27/*
41 * Attacktypes: 28 * Attacktypes:
42 * ATNR_... is the attack number that is indexed into the 29 * ATNR_... is the attack number that is indexed into the
43 * the resist array in the object structure. 30 * the resist array in the object structure.
44 */ 31 */
45 32
46#define NROFATTACKS 26
47#define NROFATTACKMESS 20 33#define NROFATTACKMESS 20
48#define MAXATTACKMESS 20 34#define MAXATTACKMESS 20
49 35
50/* attack message numbers must be less than NROFATTACKMESS */ 36/* attack message numbers must be less than NROFATTACKMESS */
51 37
67#define ATM_CRUSH 15 53#define ATM_CRUSH 15
68#define ATM_BLUD 16 54#define ATM_BLUD 16
69#define ATM_DOOR 17 55#define ATM_DOOR 17
70#define ATM_SUFFER 18 56#define ATM_SUFFER 18
71 57
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 */ 58/* attack messages structure */
145typedef struct attackmess { 59typedef struct attackmess {
146 int level; 60 int level;
147 char *buf1; 61 char *buf1;
148 char *buf2; 62 char *buf2;
149 char *buf3; 63 char *buf3;
150} attackmess_t; 64} attackmess_t;
151 65
152EXTERN attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]; 66EXTERN attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS];
153 67
154#ifndef INIT_C 68enum {
155EXTERN int resist_table[]; 69# define def(uc, lc, name, plus, change) ATNR_ ## uc,
156EXTERN char *change_resist_msg[NROFATTACKS]; 70# include "attackinc.h"
157EXTERN char *resist_plus[NROFATTACKS]; 71# undef def
158EXTERN char *attacktype_desc[NROFATTACKS]; 72 NROFATTACKS
159EXTERN char *resist_save[NROFATTACKS]; 73};
160 74
161/* Beware, names require an _ if there is a space, else they will be read 75enum {
162 * as for example: resist_life stealing 50! 76# define def(uc, lc, name, plus, change) AT_ ## uc = 1UL << ATNR_ ## uc,
163 */ 77# include "attackinc.h"
164#else 78# undef def
165EXTERN 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}; 79};
172 80
173/* Short description of names of the attacktypes */ 81/* Short description of names of the attacktypes */
174EXTERN const char* attacktype_desc[NROFATTACKS] = { 82extern const char* const attacktype_desc[NROFATTACKS];
175"physical", "magic", "fire", "electricity", "cold", "confusion", "acid", 83
176"drain", "weapon magic", "ghost hit", "poison", "slow", "paralyze", 84extern const keyword resist_save[NROFATTACKS];
177"turn undead", "fear", "cancellation", "deplete", "death", "chaos", 85
178"counterspell", "god power", "holy word", "blind" , "internal", "life stealing", 86/* Note that internal should not ever be referenced in the last two
179"disease" 87 * tables. however, other resisttypes may be added, and if through some
180}; 88 * bug these do get used somehow, might as well make it more easier to notice
89 * and not have mystery values appear.
90 */
181 91
182/* This is the array that is what the player sees. */ 92/* This is the array that is what the player sees. */
183
184EXTERN const char* resist_plus[NROFATTACKS] = { 93extern const char* const 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 94
195/* These are the descriptions of the resistances displayed when a 95/* These are the descriptions of the resistances displayed when a
196 * player puts on/takes off an item. See change_abil() in living.c. 96 * player puts on/takes off an item. See change_abil() in living.c.
197 */ 97 */
198EXTERN const char* change_resist_msg[NROFATTACKS] = { 98extern const char* const 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 99
207/* If you want to weight things so certain resistances show up more often than 100/* 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 101 * others, just add more entries in the table for the protections you want to
209 * show up. 102 * show up.
210 */ 103 */
211EXTERN int resist_table[] = {ATNR_PHYSICAL, ATNR_MAGIC, ATNR_FIRE, 104extern int resist_table[NROFATTACKS];
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 105
219#define num_resist_table 19 106#define num_resist_table 19
220 107
221#endif 108#endif
109

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines