1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declares Spell, class for magic incantations, cleric prayers,
24 * bardic songs and innate abilities
25 * @author The GemRB Project
34 #include "EffectQueue.h"
38 //values for Spell usability Flags
40 #define SF_HOSTILE 0x400
41 #define SF_NO_LOS 0x800
42 #define SF_NOT_INDOORS 0x2000
43 #define SF_HLA 0x4000 // probably this means a nonmagical ability
44 #define SF_TRIGGER 0x8000
45 #define SF_NOT_IN_COMBAT 0x10000
46 //this is a relocated bit (used in iwd2 as 0x4000)
47 #define SF_SIMPLIFIED_DURATION 0x40
49 //spelltypes in spells
51 #define IE_SPL_WIZARD 1
52 #define IE_SPL_PRIEST 2
53 #define IE_SPL_PSION 3
54 #define IE_SPL_INNATE 4
57 //this is not the same as the book types which is 3 or 11)
58 #define NUM_SPELL_TYPES 6
62 * Header for Spell special effects
65 class GEM_EXPORT SPLExtHeader
{
74 ieResRef MemorisedIcon
;
87 ieWord ChargeDepletion
;
88 ieWord ProjectileAnimation
;
94 * Class for magic incantations, cleric prayers,
95 * bardic songs and innate abilities.
98 class GEM_EXPORT Spell
{
103 SPLExtHeader
*ext_headers
;
104 Effect
* casting_features
;
106 /** Resref of the spell itself */
109 ieStrRef SpellNameIdentified
;
110 ieResRef CompletionSound
;
113 ieWord ExclusionSchool
;
115 ieWord CastingGraphics
;
118 ieByte SecondaryType
;
124 ieResRef SpellbookIcon
;
130 ieStrRef SpellDescIdentified
;
134 ieDword ExtHeaderOffset
;
135 ieWord ExtHeaderCount
;
136 ieDword FeatureBlockOffset
;
137 ieWord CastingFeatureOffset
;
138 ieWord CastingFeatureCount
;
141 ieDword TimePerLevel
;
142 ieDword TimeConstant
;
148 //returns the requested extended header
149 inline SPLExtHeader
*GetExtHeader(unsigned int which
) const
151 if (Flags
& SF_SIMPLIFIED_DURATION
) {
155 if(ExtHeaderCount
<=which
) {
158 return ext_headers
+which
;
160 //converts a wanted level to block index count
161 int GetHeaderIndexFromLevel(int level
) const;
162 //-1 will return the cfb
163 EffectQueue
*GetEffectBlock(Scriptable
*self
, const Point
&pos
, int block_index
, ieDword pro
=0) const;
164 // add appropriate casting glow effect
165 void AddCastingGlow(EffectQueue
*fxqueue
, ieDword duration
, int gender
);
166 //returns a projectile created from an extended header
167 Projectile
*GetProjectile(Scriptable
*self
, int headerindex
, const Point
&pos
) const;
168 unsigned int GetCastingDistance(Scriptable
*Sender
) const;