ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/attack.h
Revision: 1.5
Committed: Sun Sep 3 00:18:41 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.4: +1 -1 lines
Log Message:
THIS CODE WILL NOT COMPILE
use the STABLE tag instead.

- major changes in object lifetime and memory management
- replaced manual refcounting by shstr class
- removed quest system
- many optimisations
- major changes

File Contents

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