1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef XEEN_SPELLS_H
24 #define XEEN_SPELLS_H
25 
26 #include "common/scummsys.h"
27 #include "common/str-array.h"
28 
29 namespace Xeen {
30 
31 class XeenEngine;
32 class Character;
33 
34 enum MagicSpell {
35 	MS_AcidSpray = 0, MS_Awaken = 1, MS_BeastMaster = 2, MS_Bless = 3,
36 	MS_Clairvoyance = 4,  MS_ColdRay = 5, MS_CreateFood = 6,
37 	MS_CureDisease = 7, MS_CureParalysis = 8, MS_CurePoison = 9,
38 	MS_CureWounds = 10, MS_DancingSword = 11, MS_DayOfProtection = 12,
39 	MS_DayOfSorcery = 13, MS_DeadlySwarm = 14, MS_DetectMonster = 15,
40 	MS_DivineIntervention = 16, MS_DragonSleep = 17, MS_ElementalStorm = 18,
41 	MS_EnchantItem = 19, MS_EnergyBlast = 20, MS_Etheralize = 21,
42 	MS_FantasticFreeze = 22, MS_FieryFlail = 23, MS_FingerOfDeath = 24,
43 	MS_Fireball = 25, MS_FirstAid = 26, MS_FlyingFist = 27,
44 	MS_FrostBite = 28, MS_GolemStopper = 29, MS_Heroism = 30,
45 	MS_HolyBonus = 31, MS_HolyWord = 32, MS_Hynotize = 33,
46 	MS_IdentifyMonster = 34, MS_Implosion = 35, MS_Incinerate = 36,
47 	MS_Inferno = 37, MS_InsectSpray = 38, MS_ItemToGold = 39,
48 	MS_Jump = 40, MS_Levitate = 41, MS_Light = 42, MS_LightningBolt = 43,
49 	MS_LloydsBeacon = 44, MS_MagicArrow = 45, MS_MassDistortion = 46,
50 	MS_MegaVolts = 47, MS_MoonRay = 48, MS_NaturesCure = 49, MS_Pain = 50,
51 	MS_PoisonVolley = 51, MS_PowerCure = 52, MS_PowerShield = 53,
52 	MS_PrismaticLight = 54, MS_ProtFromElements = 55, MS_RaiseDead = 56,
53 	MS_RechargeItem = 57, MS_Resurrection = 58, MS_Revitalize = 59,
54 	MS_Shrapmetal = 60, MS_Sleep = 61, MS_Sparks = 62, MS_StarBurst = 63,
55 	MS_StoneToFlesh = 64, MS_SunRay = 65, MS_SuperShelter = 66,
56 	MS_SuppressDisease = 67, MS_SuppressPoison = 68, MS_Teleport = 69,
57 	MS_TimeDistortion = 70, MS_TownPortal = 71, MS_ToxicCloud = 72,
58 	MS_TurnUndead = 73, MS_WalkOnWater = 74, MS_WizardEye = 75,
59 	NO_SPELL = 76, TOTAL_SPELLS = 76
60 };
61 
62 class Spells {
63 private:
64 	XeenEngine *_vm;
65 
66 	void load();
67 
68 	void executeSpell(MagicSpell spellId);
69 
70 	/**
71 	 * Spell being cast failed
72 	 */
73 	void spellFailed();
74 
75 	// Spell list
76 	void acidSpray();
77 	void awaken();
78 	void beastMaster();
79 	void bless();
80 	void clairvoyance();
81 	void coldRay();
82 	void createFood();
83 	void cureDisease();
84 	void cureParalysis();
85 	void curePoison();
86 	void cureWounds();
87 	void dancingSword();
88 	void dayOfProtection();
89 	void dayOfSorcery();
90 	void deadlySwarm();
91 	void detectMonster();
92 	void divineIntervention();
93 	void dragonSleep();
94 	void elementalStorm();
95 	void enchantItem();
96 	void energyBlast();
97 	void etherialize();
98 	void fantasticFreeze();
99 	void fieryFlail();
100 	void fingerOfDeath();
101 	void fireball();
102 	void firstAid();
103 	void flyingFist();
104 	void frostbite();
105 	void golemStopper();
106 	void heroism();
107 	void holyBonus();
108 	void holyWord();
109 	void hypnotize();
110 	void identifyMonster();
111 	void implosion();
112 	void incinerate();
113 	void inferno();
114 	void insectSpray();
115 	void itemToGold();
116 	void jump();
117 	void levitate();
118 	void light();
119 	void lightningBolt();
120 	void lloydsBeacon();
121 	void magicArrow();
122 	void massDistortion();
123 	void megaVolts();
124 	void moonRay();
125 	void naturesCure();
126 	void pain();
127 	void poisonVolley();
128 	void powerCure();
129 	void powerShield();
130 	void prismaticLight();
131 	void protectionFromElements();
132 	void raiseDead();
133 	void rechargeItem();
134 	void resurrection();
135 	void revitalize();
136 	void shrapMetal();
137 	void sleep();
138 	void sparks();
139 	void starBurst();
140 	void stoneToFlesh();
141 	void sunRay();
142 	void superShelter();
143 	void suppressDisease();
144 	void suppressPoison();
145 	void teleport();
146 	void timeDistortion();
147 	void townPortal();
148 	void toxicCloud();
149 	void turnUndead();
150 	void walkOnWater();
151 	void wizardEye();
152 
153 	void frostbite2();
154 public:
155 	Common::StringArray _spellNames;
156 	int _lastCaster;
157 public:
158 	Spells(XeenEngine *vm);
159 
160 	int calcSpellCost(int spellId, int expenseFactor) const;
161 
162 	int calcSpellPoints(int spellId, int expenseFactor) const;
163 
164 	/**
165 	 * Cast a spell associated with an item
166 	 */
167 	void castItemSpell(int itemSpellId);
168 
169 	/**
170 	 * Cast a given spell
171 	 */
172 	int castSpell(Character *c, MagicSpell spellId);
173 
174 	/**
175 	 * Subtract the requirements for a given spell if available, returning
176 	 * true if there was sufficient
177 	 */
178 	int subSpellCost(Character &c, int spellId);
179 
180 	/**
181 	 * Add the SP and gem requirements for a given spell to the given
182 	 * character and party
183 	 */
184 	void addSpellCost(Character &c, int spellId);
185 };
186 
187 } // End of namespace Xeen
188 
189 #endif /* XEEN_SPELLS_H */
190