Crossfire Server, Branch 1.12  R12190
attack.h
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_attack_h =
00003  *   "$Id: attack.h 11578 2009-02-23 22:02:27Z lalo $";
00004  */
00005 
00006 /*
00007     CrossFire, A Multiplayer game for X-windows
00008 
00009     Copyright (C) 2002 Mark Wedel & Crossfire Development Team
00010     Copyright (C) 1992 Frank Tore Johansen
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025 
00026     The authors can be reached via e-mail at crossfire-devel@real-time.com
00027 */
00028 
00034 #ifndef ATTACK_H
00035 #define ATTACK_H
00036 
00045 #define NROFATTACKS             26
00046 #define NROFATTACKMESS          21
00047 #define MAXATTACKMESS           21
00048 
00049 /* attack message numbers must be less than NROFATTACKMESS */
00050 
00051 #define ATM_ARROW       0
00052 #define ATM_DRAIN       1
00053 #define ATM_ELEC        2
00054 #define ATM_COLD        3
00055 #define ATM_FIRE        4
00056 #define ATM_BASIC       5
00057 #define ATM_KARATE      6
00058 #define ATM_CLAW        7
00059 #define ATM_PUNCH       8
00060 #define ATM_SLASH       9
00061 #define ATM_PIERCE      10
00062 #define ATM_CLEAVE      11
00063 #define ATM_SLICE       12
00064 #define ATM_STAB        13
00065 #define ATM_WHIP        14
00066 #define ATM_CRUSH       15
00067 #define ATM_BLUD        16
00068 #define ATM_DOOR        17
00069 #define ATM_SUFFER      18
00070 #define ATM_WRAITH_FEED 19
00071 
00072 /* Note that the last ATNR_ should be one less than NROFATTACKS above
00073  * since the ATNR starts counting at zero.
00074  * For compatible loading, these MUST correspond to the same value
00075  * as the bitmasks below.
00076  */
00077 #define ATNR_PHYSICAL           0
00078 #define ATNR_MAGIC              1
00079 #define ATNR_FIRE               2
00080 #define ATNR_ELECTRICITY        3
00081 #define ATNR_COLD               4
00082 #define ATNR_CONFUSION          5
00083 #define ATNR_ACID               6
00084 #define ATNR_DRAIN              7
00085 #define ATNR_WEAPONMAGIC        8
00086 #define ATNR_GHOSTHIT           9
00087 #define ATNR_POISON             10
00088 #define ATNR_SLOW               11
00089 #define ATNR_PARALYZE           12
00090 #define ATNR_TURN_UNDEAD        13
00091 #define ATNR_FEAR               14
00092 #define ATNR_CANCELLATION       15
00093 #define ATNR_DEPLETE            16
00094 #define ATNR_DEATH              17
00095 #define ATNR_CHAOS              18
00096 #define ATNR_COUNTERSPELL       19
00097 #define ATNR_GODPOWER           20
00098 #define ATNR_HOLYWORD           21
00099 #define ATNR_BLIND              22
00100 #define ATNR_INTERNAL           23
00101 #define ATNR_LIFE_STEALING      24
00102 #define ATNR_DISEASE            25
00103 
00104 #define AT_PHYSICAL     0x00000001 /*       1 */
00105 #define AT_MAGIC        0x00000002 /*       2 */
00106 #define AT_FIRE         0x00000004 /*       4 */
00107 #define AT_ELECTRICITY  0x00000008 /*       8 */
00108 #define AT_COLD         0x00000010 /*      16 */
00109 #define AT_CONFUSION    0x00000020 /*      32 The spell will use this one */
00110 #define AT_ACID         0x00000040 /*      64 Things might corrode when hit */
00111 #define AT_DRAIN        0x00000080 /*     128 */
00112 #define AT_WEAPONMAGIC  0x00000100 /*     256 Very special, use with care */
00113 #define AT_GHOSTHIT     0x00000200 /*     512 Attacker dissolves */
00114 #define AT_POISON       0x00000400 /*    1024 */
00115 #define AT_SLOW         0x00000800 /*    2048 */
00116 #define AT_PARALYZE     0x00001000 /*    4096 */
00117 #define AT_TURN_UNDEAD  0x00002000 /*    8192 */
00118 #define AT_FEAR         0x00004000 /*   16384 */
00119 #define AT_CANCELLATION 0x00008000 /*   32768 ylitalo@student.docs.uu.se */
00120 #define AT_DEPLETE      0x00010000 /*   65536 vick@bern.docs.uu.se */
00121 #define AT_DEATH        0x00020000 /*  131072 peterm@soda.berkeley.edu */
00122 #define AT_CHAOS        0x00040000 /*  262144 peterm@soda.berkeley.edu*/
00123 #define AT_COUNTERSPELL 0x00080000 /*  524288 peterm@soda.berkeley.edu*/
00124 #define AT_GODPOWER     0x00100000 /* 1048576  peterm@soda.berkeley.edu */
00125 #define AT_HOLYWORD     0x00200000 /* 2097152 race selective attack thomas@astro.psu.edu */
00126 #define AT_BLIND        0x00400000 /* 4194304 thomas@astro.psu.edu */
00127 #define AT_INTERNAL     0x00800000 /* Only used for internal calculations */
00128 #define AT_LIFE_STEALING \
00129                         0x01000000 /* 16777216 for hp drain */
00130 #define AT_DISEASE      0x02000000 /* 33554432 disease attacktypes */
00131 
00133 /* attacktypes_load is suffixed to resist_ when saving objects.
00134  * (so the line may be 'resist_fire' 20 for example).  These are never
00135  * seen by the player.  loader.l uses the same names, but it doesn't look
00136  * like you can use these values, so in that function they are hard coded.
00137  */
00138 
00139 /* Note that internal should not ever be referanced in the last two
00140  * tables.  however, other resisttypes may be added, and if through some
00141  * bug these do get used somehow, might as well make it more easier to notice
00142  * and not have mystery values appear.
00143  */
00144 
00146 typedef struct attackmess {
00147     int level;
00148     char *buf1;
00149     char *buf2;
00150     char *buf3;
00151 } attackmess_t;
00152 
00153 typedef struct {
00154     int attacktype;
00155     int face;
00156 } Chaos_Attacks;
00157 
00158 EXTERN attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS];
00159 
00160 #ifndef INIT_C
00161 EXTERN Chaos_Attacks ATTACKS[22];
00162 EXTERN int resist_table[];
00163 EXTERN const char *const change_resist_msg[NROFATTACKS];
00164 EXTERN const char *const resist_plus[NROFATTACKS];
00165 EXTERN const char *const attacktype_desc[NROFATTACKS];
00166 EXTERN const char *const resist_save[NROFATTACKS];
00167 
00168 /* Beware, names require an _ if there is a space, else they will be read
00169  * as for example: resist_life stealing 50!
00170  */
00171 #else
00172 
00173 EXTERN const char *const resist_save[NROFATTACKS] = {
00174     "physical ", "magic ", "fire ", "electricity ", "cold ", "confusion ", "acid ",
00175     "drain ", "weaponmagic ", "ghosthit ", "poison ", "slow ", "paralyze ",
00176     "turn_undead ", "fear ", "cancellation ", "deplete ", "death ", "chaos ",
00177     "counterspell ", "godpower ", "holyword ", "blind ", "internal ", "life_stealing ",
00178     "disease "
00179 };
00180 
00182 EXTERN const char *const attacktype_desc[NROFATTACKS] = {
00183     "physical", "magic", "fire", "electricity", "cold", "confusion", "acid",
00184     "drain", "weapon magic", "ghost hit", "poison", "slow", "paralyze",
00185     "turn undead", "fear", "cancellation", "deplete", "death", "chaos",
00186     "counterspell", "god power", "holy word", "blind", "internal", "life stealing",
00187     "disease"
00188 };
00189 
00191 EXTERN const char *const resist_plus[NROFATTACKS] = {
00192     "armour", "resist magic", "resist fire", "resist electricity", "resist cold",
00193     "resist confusion", "resist acid", "resist drain",
00194     "resist weaponmagic", "resist ghosthit", "resist poison", "resist slow",
00195     "resist paralyzation", "resist turn undead", "resist fear",
00196     "resist cancellation", "resist depletion", "resist death", "resist chaos",
00197     "resist counterspell", "resist god power", "resist holy word",
00198     "resist blindness", "resist internal", "resist life stealing",
00199     "resist diseases"
00200 };
00201 
00206 EXTERN const char *const change_resist_msg[NROFATTACKS] = {
00207     "physical", "magic", "fire", "electricity", "cold", "confusion", "acid",
00208     "draining", "weapon magic", "ghosts", "poison", "slow", "paralyze",
00209     "turn undead", "fear", "cancellation", "depletion", "death attacks", "chaos",
00210     "counterspell", "god power", "holy word", "blinding attacks", "internal",
00211     "life stealing", "disease"
00212 };
00213 
00214 
00220 EXTERN int resist_table[] = {
00221     ATNR_PHYSICAL, ATNR_MAGIC, ATNR_FIRE,
00222     ATNR_ELECTRICITY, ATNR_COLD, ATNR_CONFUSION, ATNR_ACID, ATNR_DRAIN,
00223     ATNR_GHOSTHIT, ATNR_POISON, ATNR_SLOW, ATNR_PARALYZE, ATNR_TURN_UNDEAD,
00224     ATNR_FEAR, ATNR_DEPLETE, ATNR_DEATH, ATNR_HOLYWORD, ATNR_BLIND,
00225     ATNR_LIFE_STEALING, ATNR_DISEASE
00226 };
00227 
00228 
00230 EXTERN Chaos_Attacks ATTACKS[22] = {
00231     { AT_PHYSICAL, 0 },
00232     { AT_PHYSICAL, 0 },  /*face = explosion*/
00233     { AT_PHYSICAL, 0 },
00234     { AT_MAGIC, 1 },
00235     { AT_MAGIC, 1 },   /* face = last-burnout */
00236     { AT_MAGIC, 1 },
00237     { AT_FIRE, 2 },
00238     { AT_FIRE, 2 },    /* face = fire....  */
00239     { AT_FIRE, 2 },
00240     { AT_ELECTRICITY, 3 },
00241     { AT_ELECTRICITY, 3 },  /* ball_lightning */
00242     { AT_ELECTRICITY, 3 },
00243     { AT_COLD, 4 },
00244     { AT_COLD, 4 },    /* face=icestorm*/
00245     { AT_COLD, 4 },
00246     { AT_CONFUSION, 5 },
00247     { AT_POISON, 7 },
00248     { AT_POISON, 7 },  /* face = acid sphere.  generator */
00249     { AT_POISON, 7 },  /* poisoncloud face */
00250     { AT_SLOW, 8 },
00251     { AT_PARALYZE, 9 },
00252     { AT_FEAR, 10 }
00253 };
00254 
00255 #endif /* ifdef init_c */
00256 
00257 #define num_resist_table 19
00258 
00259 #endif /* ATTACK_H */