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

Represents the static data for a unit that is generated on the battlescape, this includes: HWPs, aliens and civilians. More...

#include <Unit.h>

Public Member Functions

 Unit (const std::string &type)
 Creates a blank unit ruleset. More...
 
 ~Unit ()
 Cleans up the unit ruleset.
 
void load (const YAML::Node &node, Mod *mod)
 Loads the unit data from YAML. More...
 
std::string getType () const
 Gets the unit's type. More...
 
UnitStatsgetStats ()
 Gets the unit's stats. More...
 
int getStandHeight () const
 Gets the unit's height when standing. More...
 
int getKneelHeight () const
 Gets the unit's height when kneeling. More...
 
int getFloatHeight () const
 Gets the unit's float elevation. More...
 
std::string getArmor () const
 Gets the armor type. More...
 
std::string getRace () const
 Gets the alien race type. More...
 
std::string getRank () const
 Gets the alien rank. More...
 
int getValue () const
 Gets the value - for score calculation. More...
 
const std::vector< int > & getDeathSounds () const
 Gets the death sound id. More...
 
int getMoveSound () const
 Gets the move sound id. More...
 
int getIntelligence () const
 Gets the intelligence. This is the number of turns AI remembers your troop positions. More...
 
int getAggression () const
 Gets the aggression. Determines the chance of revenge and taking cover. More...
 
int getSpecialAbility () const
 Gets the alien's special ability. More...
 
std::string getSpawnUnit () const
 Gets the unit's spawn unit. More...
 
int getAggroSound () const
 Gets the unit's war cry. More...
 
int getEnergyRecovery () const
 Gets how much energy this unit recovers per turn. More...
 
bool isLivingWeapon () const
 Checks if this unit has a built in weapon. More...
 
std::string getMeleeWeapon () const
 Gets the name of any melee weapon that may be built in to this unit. More...
 
std::string getPsiWeapon () const
 Gets the name of any psi weapon that may be built in to this unit. More...
 
const std::vector< std::vector< std::string > > & getBuiltInWeapons () const
 Gets a vector of integrated items this unit has available. More...
 
bool getCapturable () const
 Gets whether the alien can be captured alive. More...
 

Detailed Description

Represents the static data for a unit that is generated on the battlescape, this includes: HWPs, aliens and civilians.

See also
Soldier BattleUnit

Constructor & Destructor Documentation

◆ Unit()

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

Creates a blank unit ruleset.

Creates a certain type of unit.

Parameters
typeString defining the type.

Member Function Documentation

◆ getAggression()

int OpenXcom::Unit::getAggression ( ) const

Gets the aggression. Determines the chance of revenge and taking cover.

Gets the aggression.

Determines the chance of revenge and taking cover.

Returns
The unit's aggression.

◆ getAggroSound()

int OpenXcom::Unit::getAggroSound ( ) const

Gets the unit's war cry.

Returns
The id of the unit's aggro sound.

◆ getArmor()

std::string OpenXcom::Unit::getArmor ( ) const

Gets the armor type.

Gets the unit's armor type.

Returns
The unit's armor type.

◆ getBuiltInWeapons()

const std::vector< std::vector< std::string > > & OpenXcom::Unit::getBuiltInWeapons ( ) const

Gets a vector of integrated items this unit has available.

What weapons does this unit have built in? this is a vector of strings representing any weapons that may be inherent to this creature.

note: unlike "livingWeapon" this is used in ADDITION to any loadout or living weapon item that may be defined.

Returns
list of weapons that are integral to this unit.

◆ getCapturable()

bool OpenXcom::Unit::getCapturable ( ) const

Gets whether the alien can be captured alive.

Returns
a value determining whether the alien can be captured alive.

◆ getDeathSounds()

const std::vector< int > & OpenXcom::Unit::getDeathSounds ( ) const

Gets the death sound id.

Get the unit's death sounds.

Returns
List of sound IDs.

◆ getEnergyRecovery()

int OpenXcom::Unit::getEnergyRecovery ( ) const

Gets how much energy this unit recovers per turn.

How much energy does this unit recover per turn?

Returns
energy recovery amount.

◆ getFloatHeight()

int OpenXcom::Unit::getFloatHeight ( ) const

Gets the unit's float elevation.

Returns the unit's floating elevation.

Returns
The unit's floating height.

◆ getIntelligence()

int OpenXcom::Unit::getIntelligence ( ) const

Gets the intelligence. This is the number of turns AI remembers your troop positions.

Gets the intelligence.

This is the number of turns the AI remembers your troop positions.

Returns
The unit's intelligence.

◆ getKneelHeight()

int OpenXcom::Unit::getKneelHeight ( ) const

Gets the unit's height when kneeling.

Returns the unit's height at kneeling.

Returns
The unit's kneeling height.

◆ getMeleeWeapon()

std::string OpenXcom::Unit::getMeleeWeapon ( ) const

Gets the name of any melee weapon that may be built in to this unit.

What is this unit's built in melee weapon (if any).

Returns
the name of the weapon.

◆ getMoveSound()

int OpenXcom::Unit::getMoveSound ( ) const

Gets the move sound id.

Gets the unit's move sound.

Returns
The id of the unit's move sound.

◆ getPsiWeapon()

std::string OpenXcom::Unit::getPsiWeapon ( ) const

Gets the name of any psi weapon that may be built in to this unit.

What is this unit's built in psi weapon (if any).

Returns
the name of the weapon.

◆ getRace()

std::string OpenXcom::Unit::getRace ( ) const

Gets the alien race type.

Gets the alien's race.

Returns
The alien's race.

◆ getRank()

std::string OpenXcom::Unit::getRank ( ) const

Gets the alien rank.

Gets the unit's rank.

Returns
The unit's rank.

◆ getSpawnUnit()

std::string OpenXcom::Unit::getSpawnUnit ( ) const

Gets the unit's spawn unit.

Gets the unit that is spawned when this one dies.

Returns
The unit's spawn unit.

◆ getSpecialAbility()

int OpenXcom::Unit::getSpecialAbility ( ) const

Gets the alien's special ability.

Gets the unit's special ability.

Returns
The unit's specab.

◆ getStandHeight()

int OpenXcom::Unit::getStandHeight ( ) const

Gets the unit's height when standing.

Returns the unit's height at standing.

Returns
The unit's height.

◆ getStats()

UnitStats * OpenXcom::Unit::getStats ( )

Gets the unit's stats.

Returns the unit's stats data object.

Returns
The unit's stats.

◆ getType()

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

Gets the unit's type.

Returns the language string that names this unit.

Each unit type has a unique name.

Returns
The unit's name.

◆ getValue()

int OpenXcom::Unit::getValue ( ) const

Gets the value - for score calculation.

Gets the unit's value - for scoring.

Returns
The unit's value.

◆ isLivingWeapon()

bool OpenXcom::Unit::isLivingWeapon ( ) const

Checks if this unit has a built in weapon.

Checks if this unit is a living weapon.

a living weapon ignores any loadout that may be available to its rank and uses the one associated with its race.

Returns
True if this unit is a living weapon.

◆ load()

void OpenXcom::Unit::load ( const YAML::Node &  node,
Mod mod 
)

Loads the unit data from YAML.

Loads the unit from a YAML file.

Parameters
nodeYAML node.
modMod for the unit.

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