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  MovementType _movementType;
45  int _size, _weight;
46  float _damageModifier[DAMAGE_TYPES];
47  std::vector<int> _loftempsSet;
48  UnitStats _stats;
49  int _deathFrames;
50  bool _constantAnimation, _canHoldWeapon, _hasInventory;
51  ForcedTorso _forcedTorso;
52  int _faceColorGroup, _hairColorGroup, _utileColorGroup, _rankColorGroup;
53  std::vector<int> _faceColor, _hairColor, _utileColor, _rankColor;
54  std::vector<std::string> _units;
55 public:
57  Armor(const std::string &type);
59  ~Armor();
61  void load(const YAML::Node& node);
63  std::string getType() const;
65  std::string getSpriteSheet() const;
67  std::string getSpriteInventory() const;
69  int getFrontArmor() const;
71  int getSideArmor() const;
73  int getRearArmor() const;
75  int getUnderArmor() const;
77  std::string getCorpseGeoscape() const;
79  const std::vector<std::string> &getCorpseBattlescape() const;
81  std::string getStoreItem() const;
83  std::string getSpecialWeapon() const;
85  int getDrawingRoutine() const;
87  MovementType getMovementType() const;
89  int getSize() const;
91  float getDamageModifier(ItemDamageType dt) const;
93  const std::vector<int>& getLoftempsSet() const;
95  const UnitStats *getStats() const;
97  int getWeight() const;
99  int getDeathFrames() const;
101  bool getConstantAnimation() const;
103  bool getCanHoldWeapon() const;
105  ForcedTorso getForcedTorso() const;
107  int getFaceColorGroup() const;
109  int getHairColorGroup() const;
111  int getUtileColorGroup() const;
113  int getRankColorGroup() const;
115  int getFaceColor(int i) const;
117  int getHairColor(int i) const;
119  int getUtileColor(int i) const;
121  int getRankColor(int i) const;
123  bool hasInventory() const;
125  const std::vector<std::string> &getUnits() const;
126 };
127 
128 }
bool hasInventory() const
Can we access this unit&#39;s inventory?
Definition: Armor.cpp:435
std::string getType() const
Gets the armor&#39;s type.
Definition: Armor.cpp:130
int getFaceColor(int i) const
Get face base color.
Definition: Armor.cpp:371
int getHairColorGroup() const
Get hair base color.
Definition: Armor.cpp:344
const std::vector< int > & getLoftempsSet() const
Gets loftempSet.
Definition: Armor.cpp:272
std::string getSpecialWeapon() const
Gets the special weapon type.
Definition: Armor.cpp:223
MovementType getMovementType() const
DO NOT USE THIS FUNCTION OUTSIDE THE BATTLEUNIT CONSTRUCTOR OR I WILL HUNT YOU DOWN.
Definition: Armor.cpp:245
ForcedTorso getForcedTorso() const
Checks if this armor ignores gender (power suit/flying suit).
Definition: Armor.cpp:326
int getUnderArmor() const
Gets the under armor level.
Definition: Armor.cpp:184
std::string getSpriteSheet() const
Gets the unit&#39;s sprite sheet.
Definition: Armor.cpp:139
int getDrawingRoutine() const
Gets the battlescape drawing routine ID.
Definition: Armor.cpp:232
int getRearArmor() const
Gets the rear armor level.
Definition: Armor.cpp:175
int getSideArmor() const
Gets the side armor level.
Definition: Armor.cpp:166
const std::vector< std::string > & getCorpseBattlescape() const
Gets the Battlescape corpse item.
Definition: Armor.cpp:204
int getDeathFrames() const
Gets number of death frames.
Definition: Armor.cpp:299
bool getConstantAnimation() const
Gets if armor uses constant animation.
Definition: Armor.cpp:308
std::string getCorpseGeoscape() const
Gets the Geoscape corpse item.
Definition: Armor.cpp:194
const UnitStats * getStats() const
Gets the armor&#39;s stats.
Definition: Armor.cpp:281
int getFrontArmor() const
Gets the front armor level.
Definition: Armor.cpp:157
float getDamageModifier(ItemDamageType dt) const
Gets damage modifier.
Definition: Armor.cpp:264
const std::vector< std::string > & getUnits() const
Gets the armor&#39;s units.
Definition: Armor.cpp:444
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:254
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:317
int getRankColorGroup() const
Get rank base color.
Definition: Armor.cpp:362
int getWeight() const
Gets the armor&#39;s weight.
Definition: Armor.cpp:290
int getFaceColorGroup() const
Get face base color.
Definition: Armor.cpp:335
std::string getStoreItem() const
Gets the stores item.
Definition: Armor.cpp:214
int getHairColor(int i) const
Get hair base color.
Definition: Armor.cpp:387
int getRankColor(int i) const
Get rank base color.
Definition: Armor.cpp:419
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:353
int getUtileColor(int i) const
Get utile base color.
Definition: Armor.cpp:403
std::string getSpriteInventory() const
Gets the unit&#39;s inventory sprite.
Definition: Armor.cpp:148
Definition: BaseInfoState.cpp:40