22#ifndef MM1_DATA_CHAR_H
23#define MM1_DATA_CHAR_H
25#include "common/array.h"
26#include "common/serializer.h"
27#include "mm/mm1/data/items.h"
28#include "mm/shared/xeen/sprites.h"
33#define INVENTORY_COUNT 6
35#define NUM_PORTRAITS 12
38 KNIGHT = 1, PALADIN = 2, ARCHER = 3, CLERIC = 4,
39 SORCERER = 5, ROBBER = 6, NONE = 0
43 HUMAN = 1, ELF = 2, DWARF = 3, GNOME = 4, HALF_ORC = 5
47 GOOD = 1, NEUTRAL = 2, EVIL = 3
51 MALE = 1, FEMALE = 2, YES_PLEASE = 3
55 FINE = 0, BAD_CONDITION = 0x80, ERADICATED = 0xff,
56 DEAD = 0x40, STONE = 0x20,
57 UNCONSCIOUS = 0x40, PARALYZED = 0x20, POISONED = 0x10,
58 DISEASED = 8, SILENCED = 4, BLINDED = 2, ASLEEP = 1
78 RESISTANCE_MAGIC = 0, RESISTANCE_FIRE = 1, RESISTANCE_COLD = 2,
79 RESISTANCE_ELECTRICITY = 3, RESISTANCE_ACID = 4,
80 RESISTANCE_FEAR = 5, RESISTANCE_POISON = 6,
81 RESISTANCE_PSYCHIC = 7, RESISTANCE_15 = 15
85 CHARFLAG0_COURIER1 = 1,
86 CHARFLAG0_COURIER2 = 2,
87 CHARFLAG0_COURIER3 = 4,
88 CHARFLAG0_ZOM_CLUE = 8,
89 CHARFLAG0_ZAM_CLUE = 0x10,
90 CHARFLAG0_FOUND_CHEST = 0x20,
92 CHARFLAG0_DOG_STATUE = 0x80
103 CHARFLAG1_WORTHY = 0x80
118 CHARFLAG4_ASSIGNED = 8,
120 CHARFLAG4_COLOR = 0xf,
184 CHARFLAG10_10 = 0x10,
185 CHARFLAG10_20 = 0x20,
186 CHARFLAG10_40 = 0x40,
191 CHARFLAG11_GOT_ENDURANCE = 1,
192 CHARFLAG11_PERSONALITY = 2,
193 CHARFLAG11_GOT_INTELLIGENCE = 4,
194 CHARFLAG11_GOT_MIGHT = 8,
195 CHARFLAG11_GOT_ACCURACY = 0x10,
196 CHARFLAG11_GOT_SPEED = 0x20,
197 CHARFLAG11_GOT_LUCK = 0x40,
198 CHARFLAG11_CLERICS = 0x80
206 CHARFLAG12_10 = 0x10,
207 CHARFLAG12_20 = 0x20,
208 CHARFLAG12_40 = 0x40,
217 CHARFLAG13_10 = 0x10,
218 CHARFLAG13_20 = 0x20,
219 CHARFLAG13_ALAMAR = 0x40,
228 operator bool()
const {
return _id != 0; }
238 typedef bool (*CategoryFn)(
byte id);
239 bool hasCategory(CategoryFn fn)
const;
244 int getFreeSlot()
const;
250 Entry &operator[](uint idx) {
251 assert(idx < INVENTORY_COUNT);
254 const Entry &operator[](uint idx)
const {
255 assert(idx < INVENTORY_COUNT);
287 uint
add(
byte id,
byte charges);
319 bool hasWeapon()
const {
return hasCategory(isWeapon); }
320 bool hasMissile()
const {
return hasCategory(isMissile); }
321 bool hasTwoHanded()
const {
return hasCategory(isTwoHanded); }
322 bool hasArmor()
const {
return hasCategory(isArmor); }
323 bool hasShield()
const {
return hasCategory(isShield); }
325 size_t getPerformanceTotal()
const;
336 operator uint8()
const {
return _current; }
338 _base = _current = v;
351 void clear() { _current = _base = 0; }
352 void reset() { _current = _base; }
355 s.syncAsByte(_current);
358 size_t getPerformanceTotal()
const {
359 return (
size_t)_base + (size_t)_current;
367 void clear() { _current = _base = 0; }
369 _base = _current = v;
372 operator uint16()
const {
376 s.syncAsUint16LE(_base);
377 s.syncAsUint16LE(_current);
380 size_t getPerformanceTotal()
const {
381 return (_base & 0xff) + (_base >> 8) +
382 (_current & 0xff) + (_current >> 8);
408 size_t getPerformanceTotal()
const;
423 return *_attributes[i];
427 &_intelligence, &_might, &_personality, &_endurance,
428 &_speed, &_accuracy, &_luck, &_level
433 char _name[16] = { 0 };
435 Alignment _alignmentInitial = GOOD;
436 Alignment _alignment = GOOD;
438 CharacterClass _class = NONE;
448 uint16 _hpCurrent = 0, _hp = 0, _hpMax = 0;
451 uint8 _condition = 0;
459 byte _worthiness = 0;
460 byte _alignmentCtr = 0;
469 bool _checked =
false;
470 bool _canAttack =
false;
471 int _nonCombatSpell = -1;
472 int _combatSpell = -1;
497 return !strcmp(_name, rhs._name);
534 enum BuyResult { BUY_SUCCESS, BUY_NOT_ENOUGH_GOLD, BUY_BACKPACK_FULL };
553 void updateResistances();
619 return (_condition & BAD_CONDITION) != 0;
624 CharacterClass _class;
Definition: serializer.h:80
Definition: character.h:223
int indexOf(byte itemId) const
void synchronize(Common::Serializer &s, bool ids)
bool hasWeapon() const
Definition: character.h:319
int indexOf(Entry *e) const
void removeCharge(Entry *e)
uint add(byte id, byte charges)
Definition: detection.h:27
Definition: character.h:363
Definition: character.h:332
Definition: character.h:525
Definition: character.h:432
static Common::String getConditionString(ConditionEnum cond)
uint32 experienceForNextLevel() const
BuyResult
Definition: character.h:534
bool operator==(const Character &rhs) const
Definition: character.h:496
ConditionEnum worstCondition() const
TradeResult
Definition: character.h:519
bool hasItem(byte itemId) const
byte conditionColor() const
Common::String getConditionString() const
void setSpellNumber(int spellNum)
byte statColor(int amount, int threshold) const
bool hasBadCondition() const
Definition: character.h:618
size_t getPerformanceTotal() const
void synchronize(Common::Serializer &s, int portraitNum=-1)
Definition: character.h:225
Definition: character.h:411
Definition: character.h:386
Definition: character.h:623
Definition: character.h:397
void synchronize(Common::Serializer &s)