ScummVM API documentation
character.h
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 modify
8 * it 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 * 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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef XEEN_CHARACTER_H
23#define XEEN_CHARACTER_H
24
25#include "common/scummsys.h"
26#include "common/array.h"
27#include "common/rect.h"
28#include "common/serializer.h"
29#include "mm/xeen/combat.h"
30#include "mm/xeen/item.h"
31#include "mm/xeen/sprites.h"
32
33namespace MM {
34namespace Xeen {
35
36#define INV_ITEMS_TOTAL 9
37#define SPELLS_PER_CLASS 39
38#define AWARDS_TOTAL 88
39#define WARZONE_AWARD 9
40
41enum Award {
42 SHANGRILA_GUILD_MEMBER = 5, GOOBER = 76, SUPER_GOOBER = 77,
43 CASTLEVIEW_GUILD_MEMBER = 83, SANDCASTER_GUILD_MEMBER = 84,
44 LAKESIDE_GUILD_MEMBER = 85, NECROPOLIS_GUILD_MEMBER = 86, OLYMPUS_GUILD_MEMBER = 87
45};
46
47enum Sex {
48 MALE = 0, FEMALE = 1, YES_PLEASE = 2
49};
50
51enum Race {
52 HUMAN = 0, ELF = 1, DWARF = 2, GNOME = 3, HALF_ORC = 4
53};
54
55enum CharacterClass {
56 CLASS_KNIGHT = 0, CLASS_PALADIN = 1, CLASS_ARCHER = 2, CLASS_CLERIC = 3,
57 CLASS_SORCERER = 4, CLASS_ROBBER = 5, CLASS_NINJA = 6, CLASS_BARBARIAN = 7,
58 CLASS_DRUID = 8, CLASS_RANGER = 9, TOTAL_CLASSES = 10
59};
60
61enum HatesClass {
62 HATES_DWARF = 12, HATES_PARTY = 15, HATES_NOBODY = 16
63};
64
65enum Attribute {
66 MIGHT = 0, INTELLECT = 1, PERSONALITY = 2, ENDURANCE = 3, SPEED = 4,
67 ACCURACY = 5, LUCK = 6, TOTAL_ATTRIBUTES = 7
68};
69
70enum Skill {
71 THIEVERY = 0, ARMS_MASTER = 1, ASTROLOGER = 2, BODYBUILDER = 3,
72 CARTOGRAPHER = 4, CRUSADER = 5, DIRECTION_SENSE = 6, LINGUIST = 7,
73 MERCHANT = 8, MOUNTAINEER = 9, NAVIGATOR = 10, PATHFINDER = 11,
74 PRAYER_MASTER = 12, PRESTIDIGITATION = 13, SWIMMING = 14, TRACKING = 15,
75 SPOT_DOORS = 16, DANGER_SENSE = 17
76};
77
78enum Condition {
79 CURSED = 0, HEART_BROKEN = 1, WEAK = 2, POISONED = 3,
80 DISEASED = 4, INSANE = 5, IN_LOVE = 6, DRUNK = 7, ASLEEP = 8,
81 DEPRESSED = 9, CONFUSED = 10, PARALYZED = 11, UNCONSCIOUS = 12,
82 DEAD = 13, STONED = 14, ERADICATED = 15,
83 NO_CONDITION = 16
84};
85
86enum QuickAction {
87 QUICK_ATTACK = 0, QUICK_SPELL = 1, QUICK_BLOCK = 2, QUICK_RUN = 3
88};
89
90enum SpellsCategory {
91 SPELLCAT_INVALID = -1, SPELLCAT_CLERICAL = 0, SPELLCAT_WIZARDRY = 1, SPELLCAT_DRUIDIC = 2
92};
93
94
95class XeenEngine;
96
98public:
99 int _permanent;
100 int _temporary;
101public:
103 void synchronize(Common::Serializer &s);
104};
105
107private:
111 int conditionMod(Attribute attrib) const;
112public:
113 Common::String _name;
114 Sex _sex;
115 Race _race;
116 int _xeenSide;
117 CharacterClass _class;
118 AttributePair _might;
119 AttributePair _intellect;
120 AttributePair _personality;
121 AttributePair _endurance;
122 AttributePair _speed;
123 AttributePair _accuracy;
124 AttributePair _luck;
125 int _ACTemp;
126 AttributePair _level;
127 uint _birthDay;
128 int _tempAge;
129 int _skills[18];
130 int _awards[128];
131 bool _spells[SPELLS_PER_CLASS];
132 int _lloydMap;
133 Common::Point _lloydPosition;
134 bool _hasSpells;
135 int8 _currentSpell;
136 QuickAction _quickOption;
137 WeaponItems _weapons;
138 ArmorItems _armor;
139 AccessoryItems _accessories;
140 MiscItems _misc;
141 InventoryItemsGroup _items;
142 int _lloydSide;
143 AttributePair _fireResistance;
144 AttributePair _coldResistance;
145 AttributePair _electricityResistance;
146 AttributePair _poisonResistance;
147 AttributePair _energyResistance;
148 AttributePair _magicResistance;
149 int _conditions[16];
150 int _townUnknown;
151 int _savedMazeId;
152 int _currentHp;
153 int _currentSp;
154 uint _birthYear;
155 uint32 _experience;
156 int _currentAdventuringSpell;
157 int _currentCombatSpell;
158
159 SpriteResource *_faceSprites;
160 int _rosterId;
161public:
162 static int _itemType;
163public:
168
172 Character(const Character &src);
173
177 bool operator==(const Character &src) const {
178 return src._rosterId == _rosterId;
179 }
180
184 bool operator!=(const Character &src) const {
185 return src._rosterId != _rosterId;
186 }
187
191 void clear();
192
197
202
206 Condition worstCondition() const;
207
211 bool isDisabled() const;
212
216 bool isDisabledOrDead() const;
217
221 bool isDead() const;
222
226 int getAge(bool ignoreTemp = false) const;
227
231 int getMaxHP() const;
232
236 int getMaxSP() const;
237
241 uint getStat(Attribute attrib, bool baseOnly = false) const;
242
247 static int statColor(int amount, int threshold);
248
252 int statBonus(uint statValue) const;
253
257 bool charSavingThrow(DamageType attackType) const;
258
262 bool noActions();
263
267 void setAward(int awardId, bool value);
268
272 bool hasAward(int awardId) const;
273
277 int getAwardCount(int awardId) const;
278
282 int getArmorClass(bool baseOnly = false) const;
283
287 int getThievery() const;
288
289 uint getCurrentLevel() const;
290
294 int itemScan(int itemId) const;
295
299 void setValue(int id, uint value);
300
304 bool guildMember() const;
305
310
315
320
324 int getNumSkills() const;
325
329 int getNumAwards() const;
330
334 ItemCategory makeItem(int p1, int itemIndex, int p3);
335
339 void addHitPoints(int amount);
340
344 void subtractHitPoints(int amount);
345
349 bool hasSlayerSword() const;
350
354 bool hasMissileWeapon() const;
355
359 SpellsCategory getSpellsCategory() const;
360
365 return (_class == CLASS_PALADIN || _class == CLASS_ARCHER || _class == CLASS_RANGER) ? 1 : 0;
366 }
367
372};
373
374class CharacterArray : public Common::Array<Character> {
375public:
379 int indexOf(const Character &c);
380};
381
382} // End of namespace Xeen
383} // End of namespace MM
384
385#endif
Definition: array.h:52
Definition: serializer.h:80
Definition: str.h:59
Definition: sprites.h:52
Definition: item.h:329
Definition: item.h:300
Definition: character.h:97
Definition: character.h:374
int indexOf(const Character &c)
Definition: character.h:106
int getAwardCount(int awardId) const
bool operator!=(const Character &src) const
Definition: character.h:184
uint getStat(Attribute attrib, bool baseOnly=false) const
int getSpellsExpenseFactor() const
Definition: character.h:364
bool operator==(const Character &src) const
Definition: character.h:177
ItemCategory makeItem(int p1, int itemIndex, int p3)
Character(const Character &src)
int getNumAwards() const
int itemScan(int itemId) const
Condition worstCondition() const
uint getCurrentExperience() const
int getArmorClass(bool baseOnly=false) const
int getAge(bool ignoreTemp=false) const
uint experienceToNextLevel() const
bool hasSlayerSword() const
bool charSavingThrow(DamageType attackType) const
bool hasMissileWeapon() const
Character & operator=(const Character &src)
void subtractHitPoints(int amount)
int getMaxHP() const
bool isDead() const
void addHitPoints(int amount)
int getNumSkills() const
uint nextExperienceLevel() const
bool hasAward(int awardId) const
int statBonus(uint statValue) const
int getMaxSP() const
void setValue(int id, uint value)
void synchronize(Common::Serializer &s)
static int statColor(int amount, int threshold)
void setAward(int awardId, bool value)
bool isDisabled() const
int getThievery() const
bool guildMember() const
bool isDisabledOrDead() const
SpellsCategory getSpellsCategory() const
Definition: item.h:370
Definition: item.h:351
Definition: item.h:266
Definition: detection.h:27
Definition: rect.h:144