OpenXcom  1.0
Open-source clone of the original X-Com
RuleAlienMission.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 <vector>
21 #include <map>
22 #include <string>
23 #include <yaml-cpp/yaml.h>
24 
25 namespace OpenXcom
26 {
27 
28 class WeightedOptions;
29 
35 {
37  std::string ufoType;
39 
42  size_t ufoCount;
44 
47  std::string trajectory;
49 
52  size_t spawnTimer;
54 
57  bool objective;
58 };
59 
60 enum MissionObjective { OBJECTIVE_SCORE, OBJECTIVE_INFILTRATION, OBJECTIVE_BASE, OBJECTIVE_SITE, OBJECTIVE_RETALIATION, OBJECTIVE_SUPPLY };
61 
68 {
69 public:
70  RuleAlienMission(const std::string &type);
74  const std::string &getType() const { return _type; }
76  std::string generateRace(const size_t monthsPassed) const;
78  void load(const YAML::Node &node);
80  size_t getWaveCount() const { return _waves.size(); }
82  const MissionWave &getWave(size_t index) const { return _waves[index]; }
84  int getPoints() const;
86  MissionObjective getObjective() const { return _objective; }
88  const std::string &getSpawnUfo() const { return _spawnUfo; }
90  int getSpawnZone() const { return _spawnZone; }
92  int getWeight(const size_t monthsPassed) const;
94  int getRetaliationOdds() const;
96  std::string getSiteType() const { return _siteType; }
97 private:
99  std::string _type;
101  std::string _spawnUfo;
103  std::vector<std::pair<size_t, WeightedOptions*> > _raceDistribution;
105  std::map<size_t, int> _weights;
107  std::vector<MissionWave> _waves;
109  int _points;
111  MissionObjective _objective;
113  int _spawnZone;
115  int _retaliationOdds;
117  std::string _siteType;
118 };
119 
120 }
const MissionWave & getWave(size_t index) const
Gets the full wave information.
Definition: RuleAlienMission.h:82
bool objective
This wave performs the mission objective.
Definition: RuleAlienMission.h:57
const std::string & getType() const
Gets the mission&#39;s type.
Definition: RuleAlienMission.h:74
std::string generateRace(const size_t monthsPassed) const
Gets a race based on the game time and the racial distribution.
Definition: RuleAlienMission.cpp:143
size_t getWaveCount() const
Gets the number of waves.
Definition: RuleAlienMission.h:80
int getRetaliationOdds() const
Gets the inherent odds of this mission spawning a retaliation mission.
Definition: RuleAlienMission.cpp:188
int getPoints() const
Gets the score for this mission.
Definition: RuleAlienMission.cpp:156
std::string ufoType
The type of the spawned UFOs.
Definition: RuleAlienMission.h:37
MissionObjective getObjective() const
Gets the objective for this mission.
Definition: RuleAlienMission.h:86
~RuleAlienMission()
Releases all resources held by the mission.
Definition: RuleAlienMission.cpp:63
const std::string & getSpawnUfo() const
Gets the UFO type for special spawns.
Definition: RuleAlienMission.h:88
size_t ufoCount
The number of UFOs that will be generated.
Definition: RuleAlienMission.h:42
size_t spawnTimer
Number of minutes between UFOs in the wave.
Definition: RuleAlienMission.h:52
int getSpawnZone() const
Gets the zone for spawning an alien site or base.
Definition: RuleAlienMission.h:90
std::string trajectory
The trajectory ID for this wave&#39;s UFOs.
Definition: RuleAlienMission.h:47
Information about a mission wave.
Definition: RuleAlienMission.h:34
Stores fixed information about a mission type.
Definition: RuleAlienMission.h:67
int getWeight(const size_t monthsPassed) const
Gets the chances of this mission based on the game time.
Definition: RuleAlienMission.cpp:166
void load(const YAML::Node &node)
Loads alien mission data from YAML.
Definition: RuleAlienMission.cpp:75
std::string getSiteType() const
the type of missionSite to spawn (if any)
Definition: RuleAlienMission.h:96
Definition: BaseInfoState.cpp:40