OpenXcom  1.0
Open-source clone of the original X-Com
RuleSoldier.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 <yaml-cpp/yaml.h>
22 #include "Unit.h"
23 
24 namespace OpenXcom
25 {
26 
27 class Mod;
28 class SoldierNamePool;
29 
36 {
37 private:
38  std::string _type;
39  std::vector<std::string> _requires;
40  UnitStats _minStats, _maxStats, _statCaps;
41  std::string _armor;
42  int _costBuy, _costSalary, _standHeight, _kneelHeight, _floatHeight;
43  int _femaleFrequency, _value, _transferTime;
44  std::vector<int> _deathSoundMale, _deathSoundFemale;
45  std::vector<SoldierNamePool*> _names;
46 
47  void addSoldierNamePool(const std::string &namFile);
48 public:
50  RuleSoldier(const std::string &type);
52  ~RuleSoldier();
54  void load(const YAML::Node& node, Mod *mod);
56  std::string getType() const;
58  const std::vector<std::string> &getRequirements() const;
60  UnitStats getMinStats() const;
62  UnitStats getMaxStats() const;
64  UnitStats getStatCaps() const;
66  int getBuyCost() const;
68  int getSalaryCost() const;
70  int getStandHeight() const;
72  int getKneelHeight() const;
74  int getFloatHeight() const;
76  std::string getArmor() const;
78  int getFemaleFrequency() const;
80  const std::vector<int> &getMaleDeathSounds() const;
82  const std::vector<int> &getFemaleDeathSounds() const;
84  const std::vector<SoldierNamePool*> &getNames() const;
86  int getValue() const;
88  int getTransferTime() const;
89 };
90 
91 }
RuleSoldier(const std::string &type)
Creates a blank soldier ruleset.
Definition: RuleSoldier.cpp:32
int getSalaryCost() const
Gets the monthly salary of the soldier.
Definition: RuleSoldier.cpp:201
int getFloatHeight() const
Gets the elevation of the soldier when it&#39;s flying.
Definition: RuleSoldier.cpp:228
int getValue() const
Gets the value - for score calculation.
Definition: RuleSoldier.cpp:282
~RuleSoldier()
Cleans up the soldier ruleset.
Definition: RuleSoldier.cpp:39
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
void load(const YAML::Node &node, Mod *mod)
Loads the soldier data from YAML.
Definition: RuleSoldier.cpp:52
const std::vector< int > & getFemaleDeathSounds() const
Gets the soldier&#39;s female death sounds.
Definition: RuleSoldier.cpp:264
int getStandHeight() const
Gets the height of the soldier when it&#39;s standing.
Definition: RuleSoldier.cpp:210
UnitStats getMaxStats() const
Gets the maximum stats for the random stats generator.
Definition: RuleSoldier.cpp:174
const std::vector< int > & getMaleDeathSounds() const
Gets the soldier&#39;s male death sounds.
Definition: RuleSoldier.cpp:255
This struct holds some plain unit attribute data together.
Definition: Unit.h:30
int getBuyCost() const
Gets the cost of the soldier.
Definition: RuleSoldier.cpp:192
const std::vector< std::string > & getRequirements() const
Gets the soldier&#39;s requirements.
Definition: RuleSoldier.cpp:156
Represents the creation data for an X-COM unit.
Definition: RuleSoldier.h:35
UnitStats getStatCaps() const
Gets the stat caps.
Definition: RuleSoldier.cpp:183
const std::vector< SoldierNamePool * > & getNames() const
Gets the pool list for soldier names.
Definition: RuleSoldier.cpp:273
int getTransferTime() const
Gets the soldier&#39;s transfer time.
Definition: RuleSoldier.cpp:292
std::string getType() const
Gets the soldier&#39;s type.
Definition: RuleSoldier.cpp:146
int getKneelHeight() const
Gets the height of the soldier when it&#39;s kneeling.
Definition: RuleSoldier.cpp:219
UnitStats getMinStats() const
Gets the minimum stats for the random stats generator.
Definition: RuleSoldier.cpp:165
std::string getArmor() const
Gets the default-equipped armor.
Definition: RuleSoldier.cpp:237
Definition: BaseInfoState.cpp:40
int getFemaleFrequency() const
Gets the female appearance ratio.
Definition: RuleSoldier.cpp:246