OpenXcom  1.0
Open-source clone of the original X-Com
Armor.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom 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  * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <vector>
22 #include <yaml-cpp/yaml.h>
23 #include "MapData.h"
24 #include "Unit.h"
25 
26 namespace OpenXcom
27 {
28 
29 enum ForcedTorso { TORSO_USE_GENDER, TORSO_ALWAYS_MALE, TORSO_ALWAYS_FEMALE };
35 class Armor
36 {
37 public:
38  static const int DAMAGE_TYPES = 10;
39  static const std::string NONE;
40 private:
41  std::string _type, _spriteSheet, _spriteInv, _corpseGeo, _storeItem, _specWeapon;
42  std::vector<std::string> _corpseBattle;
43  int _frontArmor, _sideArmor, _rearArmor, _underArmor, _drawingRoutine;
44  bool _drawBubbles;
45  MovementType _movementType;
46  int _size, _weight;
47  float _damageModifier[DAMAGE_TYPES];
48  std::vector<int> _loftempsSet;
49  UnitStats _stats;
50  int _deathFrames;
51  bool _constantAnimation, _canHoldWeapon, _hasInventory;
52  ForcedTorso _forcedTorso;
53  int _faceColorGroup, _hairColorGroup, _utileColorGroup, _rankColorGroup;
54  std::vector<int> _faceColor, _hairColor, _utileColor, _rankColor;
55  std::vector<std::string> _units;
56 public:
58  Armor(const std::string &type);
60  ~Armor();
62  void load(const YAML::Node& node);
64  std::string getType() const;
66  std::string getSpriteSheet() const;
68  std::string getSpriteInventory() const;
70  int getFrontArmor() const;
72  int getSideArmor() const;
74  int getRearArmor() const;
76  int getUnderArmor() const;
78  std::string getCorpseGeoscape() const;
80  const std::vector<std::string> &getCorpseBattlescape() const;
82  std::string getStoreItem() const;
84  std::string getSpecialWeapon() const;
86  int getDrawingRoutine() const;
88  bool drawBubbles() const;
90  MovementType getMovementType() const;
92  int getSize() const;
94  float getDamageModifier(ItemDamageType dt) const;
96  const std::vector<int>& getLoftempsSet() const;
98  const UnitStats *getStats() const;
100  int getWeight() const;
102  int getDeathFrames() const;
104  bool getConstantAnimation() const;
106  bool getCanHoldWeapon() const;
108  ForcedTorso getForcedTorso() const;
110  int getFaceColorGroup() const;
112  int getHairColorGroup() const;
114  int getUtileColorGroup() const;
116  int getRankColorGroup() const;
118  int getFaceColor(int i) const;
120  int getHairColor(int i) const;
122  int getUtileColor(int i) const;
124  int getRankColor(int i) const;
126  bool hasInventory() const;
128  const std::vector<std::string> &getUnits() const;
129 };
130 
131 }
bool hasInventory() const
Can we access this unit&#39;s inventory?
Definition: Armor.cpp:439
std::string getType() const
Gets the armor&#39;s type.
Definition: Armor.cpp:125
bool drawBubbles() const
Gets whether or not to draw bubbles (breathing animation).
Definition: Armor.cpp:236
int getFaceColor(int i) const
Get face base color.
Definition: Armor.cpp:375
int getHairColorGroup() const
Get hair base color.
Definition: Armor.cpp:348
const std::vector< int > & getLoftempsSet() const
Gets loftempSet.
Definition: Armor.cpp:276
std::string getSpecialWeapon() const
Gets the special weapon type.
Definition: Armor.cpp:218
MovementType getMovementType() const
DO NOT USE THIS FUNCTION OUTSIDE THE BATTLEUNIT CONSTRUCTOR OR I WILL HUNT YOU DOWN.
Definition: Armor.cpp:249
ForcedTorso getForcedTorso() const
Checks if this armor ignores gender (power suit/flying suit).
Definition: Armor.cpp:330
int getUnderArmor() const
Gets the under armor level.
Definition: Armor.cpp:179
std::string getSpriteSheet() const
Gets the unit&#39;s sprite sheet.
Definition: Armor.cpp:134
int getDrawingRoutine() const
Gets the battlescape drawing routine ID.
Definition: Armor.cpp:227
int getRearArmor() const
Gets the rear armor level.
Definition: Armor.cpp:170
int getSideArmor() const
Gets the side armor level.
Definition: Armor.cpp:161
const std::vector< std::string > & getCorpseBattlescape() const
Gets the Battlescape corpse item.
Definition: Armor.cpp:199
int getDeathFrames() const
Gets number of death frames.
Definition: Armor.cpp:303
bool getConstantAnimation() const
Gets if armor uses constant animation.
Definition: Armor.cpp:312
std::string getCorpseGeoscape() const
Gets the Geoscape corpse item.
Definition: Armor.cpp:189
const UnitStats * getStats() const
Gets the armor&#39;s stats.
Definition: Armor.cpp:285
int getFrontArmor() const
Gets the front armor level.
Definition: Armor.cpp:152
float getDamageModifier(ItemDamageType dt) const
Gets damage modifier.
Definition: Armor.cpp:268
const std::vector< std::string > & getUnits() const
Gets the armor&#39;s units.
Definition: Armor.cpp:448
Represents a specific type of armor.
Definition: Armor.h:35
~Armor()
Cleans up the armor ruleset.
Definition: Armor.cpp:45
int getSize() const
Gets whether this is a normal or big unit.
Definition: Armor.cpp:258
This struct holds some plain unit attribute data together.
Definition: Unit.h:30
Armor(const std::string &type)
Creates a blank armor ruleset.
Definition: Armor.cpp:31
bool getCanHoldWeapon() const
Gets if armor can hold weapon.
Definition: Armor.cpp:321
int getRankColorGroup() const
Get rank base color.
Definition: Armor.cpp:366
int getWeight() const
Gets the armor&#39;s weight.
Definition: Armor.cpp:294
int getFaceColorGroup() const
Get face base color.
Definition: Armor.cpp:339
std::string getStoreItem() const
Gets the stores item.
Definition: Armor.cpp:209
int getHairColor(int i) const
Get hair base color.
Definition: Armor.cpp:391
int getRankColor(int i) const
Get rank base color.
Definition: Armor.cpp:423
void load(const YAML::Node &node)
Loads the armor data from YAML.
Definition: Armor.cpp:54
int getUtileColorGroup() const
Get utile base color.
Definition: Armor.cpp:357
int getUtileColor(int i) const
Get utile base color.
Definition: Armor.cpp:407
std::string getSpriteInventory() const
Gets the unit&#39;s inventory sprite.
Definition: Armor.cpp:143
Definition: BaseInfoState.cpp:40