1 #pragma once
2 
3 //********************************************************************************************
4 //*
5 //*    This file is part of Egoboo.
6 //*
7 //*    Egoboo is free software: you can redistribute it and/or modify it
8 //*    under the terms of the GNU General Public License as published by
9 //*    the Free Software Foundation, either version 3 of the License, or
10 //*    (at your option) any later version.
11 //*
12 //*    Egoboo is distributed in the hope that it will be useful, but
13 //*    WITHOUT ANY WARRANTY; without even the implied warranty of
14 //*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //*    General Public License for more details.
16 //*
17 //*    You should have received a copy of the GNU General Public License
18 //*    along with Egoboo.  If not, see <http://www.gnu.org/licenses/>.
19 //*
20 //********************************************************************************************
21 
22 /// @file file_formats/eve_file.h
23 /// @details data and functions for reading and writing enchant.txt files
24 
25 #include "egoboo_typedef.h"
26 
27 #if defined(__cplusplus)
28 extern "C"
29 {
30 #endif
31 
32 //--------------------------------------------------------------------------------------------
33 //--------------------------------------------------------------------------------------------
34 
35 /// Special modes for particle reflections from characters
36     enum e_missle_treatment
37     {
38         MISSILE_NORMAL   = 0,                           ///< Treat missiles normally
39         MISSILE_DEFLECT,                                ///< Deflect incoming missiles
40         MISSILE_REFLECT                                 ///< Reflect them back!
41     };
42 
43 //--------------------------------------------------------------------------------------------
44 
45 /// All the values that an enchant can override
46     enum e_enchant_set
47     {
48         SETMORPH = 0,           ///< Morph character?
49         ///< @details this must be first since the
50         ///< character must be morphed before adding any of the other enchants
51 
52         SETDAMAGETYPE,          ///< Type of damage dealt
53         SETNUMBEROFJUMPS,       ///< Max number of jumps
54         SETLIFEBARCOLOR,        ///< Color of life bar
55         SETMANABARCOLOR,        ///< Color of mana bar
56         SETSLASHMODIFIER,       ///< Damage modifiers
57         SETCRUSHMODIFIER,
58         SETPOKEMODIFIER,
59         SETHOLYMODIFIER,
60         SETEVILMODIFIER,
61         SETFIREMODIFIER,
62         SETICEMODIFIER,
63         SETZAPMODIFIER,
64         SETFLASHINGAND,             ///< Flash rate
65         SETLIGHTBLEND,              ///< Transparency
66         SETALPHABLEND,              ///< Alpha
67         SETSHEEN,                   ///< Shinyness
68         SETFLYTOHEIGHT,             ///< Fly to this height
69         SETWALKONWATER,             ///< Walk on water?
70         SETCANSEEINVISIBLE,         ///< Can it see invisible?
71         SETMISSILETREATMENT,        ///< How to treat missiles
72         SETCOSTFOREACHMISSILE,      ///< Cost for each missile treat
73         SETCHANNEL,                 ///< Can channel life as mana?
74         MAX_ENCHANT_SET,
75 
76         ENC_SET_FIRST = SETMORPH,
77         ENC_SET_LAST  = SETCHANNEL
78 
79     };
80 
81     typedef enum e_enchant_set enum_enchant_set;
82 
83 //--------------------------------------------------------------------------------------------
84 
85 /// A list of all the variables that can be affested by rnchant add
86     enum e_enchant_add
87     {
88         ADDJUMPPOWER = 0,
89         ADDBUMPDAMPEN,
90         ADDBOUNCINESS,
91         ADDDAMAGE,
92         ADDSIZE,
93         ADDACCEL,
94         ADDRED,                        ///< Red shift
95         ADDGRN,                        ///< Green shift
96         ADDBLU,                        ///< Blue shift
97         ADDDEFENSE,                    ///< Defence adjustments
98         ADDMANA,
99         ADDLIFE,
100         ADDSTRENGTH,
101         ADDWISDOM,
102         ADDINTELLIGENCE,
103         ADDDEXTERITY,
104         MAX_ENCHANT_ADD,
105 
106         ENC_ADD_FIRST = ADDJUMPPOWER,
107         ENC_ADD_LAST  = ADDDEXTERITY
108 
109     };
110 
111     typedef enum e_enchant_add enum_enchant_add;
112 
113 //--------------------------------------------------------------------------------------------
114 //--------------------------------------------------------------------------------------------
115 
116 /// An enchantment profile, or "eve"
117 /// @details An internal representation of the "enchant.txt" file
118     struct s_eve
119     {
120         EGO_PROFILE_STUFF
121 
122         // enchant spawning info
123         bool_t  override;                         ///< Override other enchants?
124         bool_t  remove_overridden;                ///< Remove other enchants?
125         bool_t  retarget;                         ///< Pick a weapon?
126         Uint8   required_damagetype;              ///< Don't enchant if the target is immune to required_damagetype
127         Uint8   require_damagetarget_damagetype;  ///< Only enchant the target if the target damagetarget_damagetype matches this value
128         bool_t  spawn_overlay;                    ///< Spawn an overlay?
129 
130         // ending conditions
131         int     lifetime;                         ///< Time in seconds
132         bool_t  endifcantpay;                     ///< End on out of mana
133         IDSZ    removedbyidsz;                    ///< By particle or [NONE]
134 
135         // despawning info
136         bool_t  stayiftargetdead;                 ///< Stay if target has died?
137         bool_t  stayifnoowner;                    ///< Stay if owner has died?
138 
139         // skill modifications
140         Sint16  owner_mana;
141         Sint16  owner_life;
142         Sint16  target_mana;
143         Sint16  target_life;
144 
145         // generic modifications
146         bool_t  setyesno[MAX_ENCHANT_SET];    ///< Set this value?
147         float   setvalue[MAX_ENCHANT_SET];    ///< Value to use
148 
149         bool_t  addyesno[MAX_ENCHANT_ADD];    ///< Add this value?
150         float   addvalue[MAX_ENCHANT_ADD];    ///< The values to add
151 
152         // special modifications
153         int  seekurse;                        ///< Allow target to see kurses
154         int  darkvision;                      ///< Allow target to see in darkness
155 
156         // continuous spawning
157         Uint16  contspawn_delay;              ///< Spawn timer
158         Uint8   contspawn_amount;             ///< Spawn amount
159         Uint16  contspawn_facingadd;          ///< Spawn in circle
160         int     contspawn_lpip;               ///< Spawn type ( local )
161 
162         // what to so when the enchant ends
163         Sint16  endsound_index;              ///< Sound on end (-1 for none)
164         bool_t  killtargetonend;             ///< Kill the target on end?
165         bool_t  poofonend;                   ///< Spawn a poof on end?
166         int     endmessage;                  ///< Message for end -1 for none
167 
168     };
169 
170     typedef struct s_eve eve_t;
171 
172 //--------------------------------------------------------------------------------------------
173 //--------------------------------------------------------------------------------------------
174 
175     eve_t *  load_one_enchant_file_vfs( const char* szLoadName, eve_t * peve );
176     bool_t   save_one_enchant_file_vfs( const char* szLoadName, const char * szTemplateName, eve_t * peve );
177 
178     eve_t * eve_init( eve_t * peve );
179 
180 //--------------------------------------------------------------------------------------------
181 //--------------------------------------------------------------------------------------------
182 
183 #if defined(__cplusplus)
184 }
185 #endif
186 
187 //--------------------------------------------------------------------------------------------
188 //--------------------------------------------------------------------------------------------
189 
190 #define _eve_file_h