Emergency 20 Dokumentation  4.2.0
Injury.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
15 
17 #include <qsf/math/BitFlagSet.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26  class Diagnosis;
27 }
28 
29 
30 //[-------------------------------------------------------]
31 //[ Namespace ]
32 //[-------------------------------------------------------]
33 namespace em5
34 {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Classes ]
39  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Friends ]
50  //[-------------------------------------------------------]
51  friend class InjuryManager;
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public definitions ]
56  //[-------------------------------------------------------]
57  public:
60  {
61  INJURY_AFFECTS_HEALTH = 1<<0,
62  INJURY_SPREADS = 1<<1
63  };
65 
68  {
69  CONTAMINATION_NONE = 0,
70  CONTAMINATION_RADIOACTIVE = 1,
72  CONTAMINATION_PLAGUE = 3,
73  CONTAMINATION_BIOLOGICAL = 4
74  };
75 
76  typedef std::vector<uint32> MedicalCareIdArray;
77  typedef std::vector<uint32> InjuryIdArray;
78 
79 
80  //[-------------------------------------------------------]
81  //[ Public methods ]
82  //[-------------------------------------------------------]
83  public:
88  explicit Injury(uint32 key);
89 
94  virtual ~Injury();
95 
96  // Get the injury ID
97  uint32 getInjuryId() const;
98 
99  // Get the name of the injury
100  const std::string& getName() const;
101 
102  // Set the name of the injury
103  void setName(const std::string& name);
104 
105  // Get the localized name of the injury
106  const std::string& getLocalizedName() const;
107 
108  // Set the localized name of the injury
109  void setLocalizedName(const std::string& name);
110 
111  // Get the injury bitmask
112  InjuryBitmask getInjuryBitmask() const;
113 
114  // Get the visual vital signs
115  const VisualVitalSigns& getVisualVitalSigns() const;
116 
117  // Get injury initial reduction factor
118  float getInitialReduction() const;
119 
120  // Set injury initial reduction factor
121  void setInitialReduction(float initialReduction);
122 
123  // Get the injury energy delta
124  float getInjuryDelta() const;
125 
126  // Set the injury energy delta
127  void setInjuryDelta(float injuryDelta);
128 
129  // Get the heal delta
130  float getHealDelta() const;
131 
132  // Set the heal delta
133  void setHealDelta(float healDelta);
134 
135  // Get treatment threshold
136  float getTreatmentThreshold() const;
137 
138  // Set treatment threshold
139  void setTreatmentThreshold(float treatmentThreshold);
140 
141  // Get treatment factor
142  float getTreatmentFactor() const;
143 
144  // Set treatment factor
145  void setTreatmentFactor(float treatmentFactor);
146 
147  // Get the diagnosis ID
148  DiagnosisIdentifier getDiagnosisId() const;
149 
150  // Set the diagnosis ID
151  void setDiagnosisId(DiagnosisIdentifier diagnosisId);
152 
153  // Get the diagnosis
154  const Diagnosis* getDiagnosis() const;
155 
156  // Set the name of the injury animation
157  void setAnimationName(const std::string& animationName);
158 
159  // Get the name of the injury animation
160  const std::string& getAnimationName() const;
161 
162  // Get the name of the audio file without path and person type
163  const std::string& getAudioName() const;
164 
165  // Set the name of the audio file without path and person type
166  void setAudioName(const std::string& audioName);
167 
168  //[-------------------------------------------------------]
169  //[ Contaminations & illnesses ]
170  //[-------------------------------------------------------]
171  // Return whether the injury is affecting health instead of life
172  bool isAffectingHealth() const;
173 
174  // Set whether the injury is affecting health instead of life
175  void setAffectsHealth(bool affectsHealth);
176 
177  // Get contamination type
178  ContaminationType getContaminationType() const;
179 
180  // Return whether this injury is a contamination
181  bool isContamination() const;
182 
183  // Set contamination type
184  void setContaminationType(ContaminationType contaminationType);
185 
186  // Get spread delay
187  float getSpreadDelay() const;
188 
189  // Set spread delay
190  void setSpreadDelay(float spreadDelay);
191 
192  // Get the spread chance
193  float getSpreadChance() const;
194 
195  // Set the spread chance
196  void setSpreadChance(float spreadChance);
197 
198  // Get spread radius
199  float getSpreadRadius() const;
200 
201  // Set spread radius
202  void setSpreadRadius(float spreadRadius);
203 
204  // Get the name of the spreaded injury
205  const std::string& getSpreadedInjuryName() const;
206 
207  // Set the name of the spreaded injury
208  void setSpreadedInjuryName(const std::string& injuryName);
209 
210  // Get the injury to switch to when the person's energy falls to zero
211  const InjuryIdArray& getFollowingInjuries() const;
212 
213  // Get if the injury is drowning
214  bool getIsDrowning() const;
215 
216  // Set if the injury is drowning
217  void setIsDrowing(bool isDrowning);
218 
219  // "true" if the target is not standing, not lying
220  bool getIsKneeing() const;
221  void setIsKneeing(bool isKneeing);
222 
223 
224  //[-------------------------------------------------------]
225  //[ Private data ]
226  //[-------------------------------------------------------]
227  private:
228  // General definitions
229  qsf::NamedIdentifier mName;
230  std::string mLocalizedName;
231  InjuryBitmask mInjuryBitmask;
232  VisualVitalSigns mVisualVitalSigns;
233  float mInitialReduction;
234  float mInjuryDelta;
235  float mHealDelta;
236  float mTreatmentThreshold;
237  float mTreatmentFactor;
238  DiagnosisIdentifier mDiagnosisId;
239  MedicalCareIdArray mMedicalCareIds;
240  std::string mAnimationName;
241  std::string mAudioName;
242  bool mIsKneeing;
243 
244  // For contaminations and illnesses
245  ContaminationType mContaminationType;
246  float mSpreadDelay;
247  float mSpreadRadius;
248  float mSpreadChance;
249  std::string mSpreadedInjuryName;
250  InjuryIdArray mFollowingInjuries;
251  bool mIsDrowning;
252 
253 
254  //[-------------------------------------------------------]
255  //[ CAMP reflection system ]
256  //[-------------------------------------------------------]
257  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
258 
259  public:
260  QSF_CAMP_ARRAY_INTERFACE_CLASS_WITH_VARIABLE(MedicalCareIdArrayInterface, Injury, std::vector<uint32>, std::string);
261  QSF_CAMP_ARRAY_INTERFACE_CLASS_WITH_VARIABLE(InjuryIdArrayInterface, Injury, std::vector<uint32>, std::string);
262 
263  MedicalCareIdArrayInterface MedicalCareArray;
264  InjuryIdArrayInterface FollowingInjuryArray;
265 
266 
267  };
268 
269 
270 //[-------------------------------------------------------]
271 //[ Namespace ]
272 //[-------------------------------------------------------]
273 } // em5
274 
275 
276 //[-------------------------------------------------------]
277 //[ CAMP reflection system ]
278 //[-------------------------------------------------------]
281 QSF_CAMP_ARRAY_MAPPER_DEFINITION(em5::Injury::MedicalCareIdArrayInterface)
282 QSF_CAMP_ARRAY_MAPPER_DEFINITION(em5::Injury::InjuryIdArrayInterface)
Definition: ActionPriority.h:13
Object base class.
Definition: Object.h:68
std::vector< uint32 > InjuryIdArray
Definition: Injury.h:77
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
#define QSF_CAMP_ARRAY_INTERFACE_CLASS_WITH_VARIABLE(interfaceClassName, ownerType, variableType, elementType)
Definition: CampClass.h:241
EMERGENCY 5 visual vital sign class.
Definition: VisualVitalSigns.h:36
QSF_CAMP_ARRAY_MAPPER_DEFINITION(qsf::ai::TrafficLightTimerComponent::ManagedTrafficLightList)
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
InjuryFlags
Definition: Injury.h:59
std::vector< uint32 > MedicalCareIdArray
Definition: Injury.h:76
Definition: CampDiagnosisIdentifier.h:27
Diagnosis definition class.
Definition: Diagnosis.h:30
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
ContaminationType
Definition: Injury.h:67
Injury definition class.
Definition: Injury.h:44
Manager for injury definitions.
Definition: InjuryManager.h:32
qsf::BitFlagSet< uint8, InjuryFlags > InjuryBitmask
Definition: Injury.h:64