OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | List of all members
OpenXcom::RuleMissionScript Class Reference

Public Member Functions

 RuleMissionScript (const std::string &type)
 Creates a new mission script. More...
 
 ~RuleMissionScript ()
 Deletes a mission script. More...
 
void load (const YAML::Node &node)
 Loads a mission script from yaml. More...
 
std::string getType () const
 Gets the name of the script command. More...
 
std::string getVarName () const
 Gets the name of the variable to use for keeping track of... things. More...
 
std::set< std::string > getAllMissionTypes () const
 Gets a complete and unique list of all the mission types contained within this command. More...
 
std::vector< std::string > getRegions (const int month) const
 Gets a list of the regions in this command's region weights for a given month. More...
 
std::vector< std::string > getMissionTypes (const int month) const
 Gets a list of the mission types in this command's mission weights for a given month. More...
 
int getFirstMonth () const
 Gets the first month this command will run. More...
 
int getLastMonth () const
 Gets the last month this command will run. More...
 
int getLabel () const
 Gets the label of this command, used for conditionals. More...
 
int getExecutionOdds () const
 Gets the odds of this command executing. More...
 
int getTargetBaseOdds () const
 Gets the odds of this mission targetting an xcom base. More...
 
int getMinDifficulty () const
 Gets the minimum difficulty for this command to run. More...
 
int getMaxRuns () const
 Gets the maximum number of times to run a command with this varName. More...
 
int getRepeatAvoidance () const
 Gets how many previous mission sites to keep track of (to avoid using them again) More...
 
int getDelay () const
 Gets the number of minutes to delay spawning of the first wave of this mission, overrides the spawn delay defined in the mission waves. More...
 
const std::vector< int > & getConditionals () const
 Gets the list of conditions this command requires in order to run. More...
 
bool hasRaceWeights () const
 Does this command have raceWeights? More...
 
bool hasMissionWeights () const
 Does this command have mission weights? More...
 
bool hasRegionWeights () const
 Does this command have region weights? More...
 
const std::map< std::string, bool > & getResearchTriggers () const
 Gets the research triggers that may apply to this command. More...
 
bool getUseTable () const
 Delete this mission from the table? stops it coming up again in random selection, but NOT if a missionScript calls it by name. More...
 
void setSiteType (const bool siteType)
 Sets this script to a terror mission type command or not. More...
 
bool getSiteType () const
 Checks if this is a terror-type mission or not. More...
 
std::string generate (const size_t monthsPassed, const GenerationType type) const
 Generates either a region, a mission, or a race based on the month. More...
 

Constructor & Destructor Documentation

◆ RuleMissionScript()

OpenXcom::RuleMissionScript::RuleMissionScript ( const std::string &  type)

Creates a new mission script.

RuleMissionScript: the rules for the alien mission progression.

Each script element is independant, and the saved game will probe the list of these each month to determine what's going to happen.

◆ ~RuleMissionScript()

OpenXcom::RuleMissionScript::~RuleMissionScript ( )

Deletes a mission script.

Destructor, cleans up the mess we left in ram.

Member Function Documentation

◆ generate()

std::string OpenXcom::RuleMissionScript::generate ( const size_t  monthsPassed,
const GenerationType  type 
) const

Generates either a region, a mission, or a race based on the month.

Chooses one of the available races, regions, or missions for this command.

Parameters
monthsPassedThe number of months that have passed in the game world.
typethe type of thing we want to generate, region, mission or race.
Returns
The string id of the thing.

◆ getAllMissionTypes()

std::set< std::string > OpenXcom::RuleMissionScript::getAllMissionTypes ( ) const

Gets a complete and unique list of all the mission types contained within this command.

Returns
a complete, unique list of all the mission types this command could possibly generate.

◆ getConditionals()

const std::vector< int > & OpenXcom::RuleMissionScript::getConditionals ( ) const

Gets the list of conditions this command requires in order to run.

Returns
the list of conditions that govern execution of this command.

◆ getDelay()

int OpenXcom::RuleMissionScript::getDelay ( ) const

Gets the number of minutes to delay spawning of the first wave of this mission, overrides the spawn delay defined in the mission waves.

Returns
the fixed delay on spawning the first wave (if any) to override whatever's written in the mission definition.

◆ getExecutionOdds()

int OpenXcom::RuleMissionScript::getExecutionOdds ( ) const

Gets the odds of this command executing.

Returns
the odds of this command's execution.

◆ getFirstMonth()

int OpenXcom::RuleMissionScript::getFirstMonth ( ) const

Gets the first month this command will run.

Returns
the first month this script should run.

◆ getLabel()

int OpenXcom::RuleMissionScript::getLabel ( ) const

Gets the label of this command, used for conditionals.

Returns
the label this command uses for conditional tracking.

◆ getLastMonth()

int OpenXcom::RuleMissionScript::getLastMonth ( ) const

Gets the last month this command will run.

Returns
the last month this script should run.

◆ getMaxRuns()

int OpenXcom::RuleMissionScript::getMaxRuns ( ) const

Gets the maximum number of times to run a command with this varName.

Returns
the maximum runs for scripts tracking our varName.

◆ getMinDifficulty()

int OpenXcom::RuleMissionScript::getMinDifficulty ( ) const

Gets the minimum difficulty for this command to run.

Returns
the minimum difficulty for this script to run.

◆ getMissionTypes()

std::vector< std::string > OpenXcom::RuleMissionScript::getMissionTypes ( const int  month) const

Gets a list of the mission types in this command's mission weights for a given month.

Parameters
monththe month for which we want info.
Returns
a list of the possible missions for the given month.

◆ getRegions()

std::vector< std::string > OpenXcom::RuleMissionScript::getRegions ( const int  month) const

Gets a list of the regions in this command's region weights for a given month.

Parameters
monththe month for which we want info.
Returns
the list of regions we have to pick from this month.

◆ getRepeatAvoidance()

int OpenXcom::RuleMissionScript::getRepeatAvoidance ( ) const

Gets how many previous mission sites to keep track of (to avoid using them again)

Returns
the number of sites to avoid repeating missions against.

◆ getResearchTriggers()

const std::map< std::string, bool > & OpenXcom::RuleMissionScript::getResearchTriggers ( ) const

Gets the research triggers that may apply to this command.

Returns
a list of research topics that govern execution of this script.

◆ getSiteType()

bool OpenXcom::RuleMissionScript::getSiteType ( ) const

Checks if this is a terror-type mission or not.

Returns
if this is a mission site type command or not.

◆ getTargetBaseOdds()

int OpenXcom::RuleMissionScript::getTargetBaseOdds ( ) const

Gets the odds of this mission targetting an xcom base.

Returns
the odds of this command targetting a base.

◆ getType()

std::string OpenXcom::RuleMissionScript::getType ( ) const

Gets the name of the script command.

Gets the name of this command.

Returns
the name of the command.

◆ getUseTable()

bool OpenXcom::RuleMissionScript::getUseTable ( ) const

Delete this mission from the table? stops it coming up again in random selection, but NOT if a missionScript calls it by name.

Returns
if this command should remove the mission it generates from the strategy table.

◆ getVarName()

std::string OpenXcom::RuleMissionScript::getVarName ( ) const

Gets the name of the variable to use for keeping track of... things.

Returns
the name of the variable we want to use to track in the saved game.

◆ hasMissionWeights()

bool OpenXcom::RuleMissionScript::hasMissionWeights ( ) const

Does this command have mission weights?

Returns
if this command uses a weighted distribution to pick a mission.

◆ hasRaceWeights()

bool OpenXcom::RuleMissionScript::hasRaceWeights ( ) const

Does this command have raceWeights?

Returns
if this command uses a weighted distribution to pick a race.

◆ hasRegionWeights()

bool OpenXcom::RuleMissionScript::hasRegionWeights ( ) const

Does this command have region weights?

Returns
if this command uses a weighted distribution to pick a region.

◆ load()

void OpenXcom::RuleMissionScript::load ( const YAML::Node &  node)

Loads a mission script from yaml.

Loads a missionScript from a YML file.

Parameters
nodethe node within the file we're reading.

◆ setSiteType()

void OpenXcom::RuleMissionScript::setSiteType ( const bool  siteType)

Sets this script to a terror mission type command or not.

Parameters
siteTypeset this command to be a missionSite type or not.

The documentation for this class was generated from the following files: