forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
creature_attributes.h
150 lines (132 loc) · 4.51 KB
/
creature_attributes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* Copyright (C) 2013-2014 Michal Brzozowski ([email protected])
This file is part of KeeperRL.
KeeperRL is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.gnu.org/licenses/ . */
#ifndef _CREATURE_ATTRIBUTES_H
#define _CREATURE_ATTRIBUTES_H
#include <string>
#include <functional>
#include "util.h"
#include "skill.h"
#include "gender.h"
#include "effect.h"
#include "minion_task.h"
#include "entity_name.h"
#include "view_object.h"
#include "spell_map.h"
#include "minion_task_map.h"
#include "skill.h"
#include "modifier_type.h"
// WTF is this defined
#undef HUGE
enum class CreatureSize {
SMALL,
MEDIUM,
LARGE,
HUGE
};
inline bool isLarger(CreatureSize s1, CreatureSize s2) {
return int(s1) > int(s2);
}
RICH_ENUM(BodyPart,
HEAD,
TORSO,
ARM,
WING,
LEG,
BACK
);
enum class SpawnType;
#define CATTR(X) CreatureAttributes([&](CreatureAttributes& c) { X })
struct SpellInfo;
class MinionTaskMap;
class SpellMap;
class CreatureAttributes {
public:
CreatureAttributes(function<void(CreatureAttributes&)>);
CreatureAttributes(const CreatureAttributes& other) = default;
~CreatureAttributes();
SERIALIZATION_DECL(CreatureAttributes);
BodyPart getBodyPart(AttackLevel attack, bool flying, bool collapsed) const;
CreatureSize getSize() const;
BodyPart armOrWing() const;
double getRawAttr(AttrType) const;
int numBodyParts(BodyPart) const;
int numLost(BodyPart) const;
int lostOrInjuredBodyParts() const;
int numInjured(BodyPart) const;
int numGood(BodyPart) const;
double getCourage() const;
void setCourage(double);
const Gender& getGender() const;
bool hasBrain() const;
double getExpLevel() const;
void increaseExpLevel(double increase);
void exerciseAttr(AttrType, double value);
string getNameAndTitle() const;
string getSpeciesName() const;
bool isHumanoid() const;
vector<AttackLevel> getAttackLevels() const;
AttackLevel getRandomAttackLevel() const;
string bodyDescription() const;
string getBodyPartName(BodyPart) const;
SpellMap& getSpellMap();
const SpellMap& getSpellMap() const;
MustInitialize<ViewId> SERIAL(viewId);
optional<ViewObject> SERIAL(illusionViewObject);
MustInitialize<EntityName> SERIAL(name);
EnumMap<AttrType, int> SERIAL(attr);
MustInitialize<CreatureSize> SERIAL(size);
MustInitialize<double> SERIAL(weight);
optional<string> SERIAL(chatReactionFriendly);
optional<string> SERIAL(chatReactionHostile);
optional<string> SERIAL(firstName);
optional<string> SERIAL(speciesName);
int SERIAL(barehandedDamage) = 0;
optional<AttackType> SERIAL(barehandedAttack);
optional<EffectType> SERIAL(attackEffect);
bool SERIAL(harmlessApply) = false; // apply the attack effect even if attack was harmless
optional<EffectType> SERIAL(passiveAttack);
Gender SERIAL(gender) = Gender::male;
EnumMap<BodyPart, int> SERIAL(bodyParts) {
{ BodyPart::ARM, 2},
{ BodyPart::LEG, 2},
{ BodyPart::HEAD, 1}};
EnumMap<BodyPart, int> SERIAL(injuredBodyParts);
EnumMap<BodyPart, int> SERIAL(lostBodyParts);
optional<SpawnType> SERIAL(spawnType);
bool SERIAL(innocent) = false;
bool SERIAL(uncorporal) = false;
bool SERIAL(fireCreature) = false;
bool SERIAL(breathing) = true;
MustInitialize<bool> SERIAL(humanoid);
bool SERIAL(animal) = false;
bool SERIAL(undead) = false;
bool SERIAL(notLiving) = false;
bool SERIAL(brain) = true;
bool SERIAL(isFood) = false;
bool SERIAL(stationary) = false;
bool SERIAL(noSleep) = false;
bool SERIAL(cantEquip) = false;
double SERIAL(courage) = 1;
bool SERIAL(carryAnything) = false;
bool SERIAL(invincible) = false;
bool SERIAL(worshipped) = false;
bool SERIAL(dontChase) = false;
double SERIAL(attributeGain) = 0.5;
int SERIAL(recruitmentCost) = 0;
Skillset SERIAL(skills);
SpellMap SERIAL(spells);
EnumMap<LastingEffect, int> SERIAL(permanentEffects);
EnumMap<LastingEffect, double> SERIAL(lastingEffects);
MinionTaskMap SERIAL(minionTasks);
string SERIAL(groupName) = "group";
EnumMap<AttrType, double> SERIAL(attrIncrease);
};
#endif