The basic "size" of the unit - flying, small land, large land, etc. More...
#include <movetype.hpp>
Classes | |
class | resistances |
Stores a set of resistances. More... | |
class | terrain_costs |
Stores a set of terrain costs (for movement, vision, or "jamming"). More... | |
class | terrain_defense |
Stores a set of defense levels. More... | |
class | terrain_info |
Stores a set of data based on terrain. More... | |
Public Member Functions | |
movetype () | |
Default constructor. More... | |
movetype (const config &cfg) | |
Constructor from a config. More... | |
movetype (const movetype &that) | |
Copy constructor. More... | |
terrain_costs & | get_movement () |
terrain_costs & | get_vision () |
terrain_costs & | get_jamming () |
terrain_defense & | get_defense () |
resistances & | get_resistances () |
const terrain_costs & | get_movement () const |
const terrain_costs & | get_vision () const |
const terrain_costs & | get_jamming () const |
const terrain_defense & | get_defense () const |
const resistances & | get_resistances () const |
bool | is_flying () const |
Returns whether or not *this is flagged as a flying movement type. More... | |
void | set_flying (bool flies=true) |
Sets whether or not *this is flagged as a flying movement type. More... | |
int | movement_cost (const t_translation::t_terrain &terrain, bool slowed=false) const |
Returns the cost to move through the indicated terrain. More... | |
int | vision_cost (const t_translation::t_terrain &terrain, bool slowed=false) const |
Returns the cost to see through the indicated terrain. More... | |
int | jamming_cost (const t_translation::t_terrain &terrain, bool slowed=false) const |
Returns the cost to "jam" through the indicated terrain. More... | |
int | defense_modifier (const t_translation::t_terrain &terrain) const |
Returns the defensive value of the indicated terrain. More... | |
int | resistance_against (const attack_type &attack) const |
Returns the resistance against the indicated attack. More... | |
int | resistance_against (const std::string &damage_type) const |
Returns the resistance against the indicated damage type. More... | |
utils::string_map | damage_table () const |
Returns a map from attack types to resistances. More... | |
bool | has_terrain_defense_caps (const std::set< t_translation::t_terrain > &ts) const |
Returns whether or not there are any terrain caps with respect to a set of terrains. More... | |
bool | has_vision_data () const |
Returns whether or not there are any vision-specific costs. More... | |
bool | has_jamming_data () const |
Returns whether or not there are any jamming-specific costs. More... | |
void | merge (const config &new_cfg, bool overwrite=true) |
Merges the given config over the existing data. More... | |
void | write (config &cfg) const |
Writes the movement type data to the provided config. More... | |
Static Public Attributes | |
static const int | UNREACHABLE = 99 |
Magic value that signifies a hex is unreachable. More... | |
static const std::set < std::string > | effects |
The set of applicable effects for movement types. More... | |
Private Attributes | |
terrain_costs | movement_ |
terrain_costs | vision_ |
terrain_costs | jamming_ |
terrain_defense | defense_ |
resistances | resist_ |
bool | flying_ |
The basic "size" of the unit - flying, small land, large land, etc.
This encompasses terrain costs, defenses, and resistances.
Definition at line 28 of file movetype.hpp.
movetype::movetype | ( | ) |
Default constructor.
Definition at line 701 of file movetype.cpp.
|
explicit |
Constructor from a config.
Definition at line 715 of file movetype.cpp.
movetype::movetype | ( | const movetype & | that | ) |
Copy constructor.
Definition at line 729 of file movetype.cpp.
|
inline |
Returns a map from attack types to resistances.
Definition at line 219 of file movetype.hpp.
References movetype::resistances::damage_table(), and resist_.
Referenced by unit::get_base_resistances(), and help::unit_topic_generator::operator()().
|
inline |
Returns the defensive value of the indicated terrain.
Definition at line 209 of file movetype.hpp.
References movetype::terrain_defense::defense(), and defense_.
Referenced by unit::defense_modifier(), ai::default_recruitment::recruitment::get_average_defense(), and help::unit_topic_generator::operator()().
|
inline |
Definition at line 184 of file movetype.hpp.
References defense_.
Referenced by unit::apply_builtin_effect(), and help::unit_topic_generator::operator()().
|
inline |
Definition at line 190 of file movetype.hpp.
References defense_.
|
inline |
Definition at line 183 of file movetype.hpp.
References jamming_.
Referenced by unit::apply_builtin_effect(), and pathfind::jamming_path::jamming_path().
|
inline |
Definition at line 189 of file movetype.hpp.
References jamming_.
|
inline |
Definition at line 181 of file movetype.hpp.
References movement_.
Referenced by pathfind::full_cost_map::add_unit(), unit::apply_builtin_effect(), pathfind::paths::paths(), and ai::default_recruitment::recruitment::update_average_local_cost().
|
inline |
Definition at line 187 of file movetype.hpp.
References movement_.
|
inline |
Definition at line 185 of file movetype.hpp.
References resist_.
Referenced by unit::apply_builtin_effect().
|
inline |
Definition at line 191 of file movetype.hpp.
References resist_.
|
inline |
Definition at line 182 of file movetype.hpp.
References vision_.
Referenced by unit::apply_builtin_effect(), actions::shroud_clearer::clear_unit(), and pathfind::vision_path::vision_path().
|
inline |
Definition at line 188 of file movetype.hpp.
References vision_.
|
inline |
Returns whether or not there are any jamming-specific costs.
Definition at line 227 of file movetype.hpp.
References movetype::terrain_info::empty(), and jamming_.
Referenced by help::unit_topic_generator::operator()().
bool movetype::has_terrain_defense_caps | ( | const std::set< t_translation::t_terrain > & | ts | ) | const |
Returns whether or not there are any terrain caps with respect to a set of terrains.
Checks if we have a defense cap (nontrivial min value) for any of the given terrain types.
Definition at line 742 of file movetype.cpp.
References movetype::terrain_defense::capped(), and defense_.
Referenced by help::unit_topic_generator::operator()().
|
inline |
Returns whether or not there are any vision-specific costs.
Definition at line 225 of file movetype.hpp.
References movetype::terrain_info::empty(), and vision_.
Referenced by help::unit_topic_generator::operator()().
|
inline |
Returns whether or not *this is flagged as a flying movement type.
Definition at line 194 of file movetype.hpp.
References flying_.
Referenced by unit::is_flying().
|
inline |
Returns the cost to "jam" through the indicated terrain.
Definition at line 205 of file movetype.hpp.
References movetype::terrain_costs::cost(), jamming_, and game_config::sounds::status::slowed.
Referenced by unit::jamming_cost(), and help::unit_topic_generator::operator()().
Merges the given config over the existing data.
If overwrite is false, the new values will be added to the old.
Definition at line 754 of file movetype.cpp.
References config::child_range(), defense_, flying_, jamming_, movetype::terrain_info::merge(), movetype::terrain_defense::merge(), movetype::resistances::merge(), movement_, resist_, and vision_.
Referenced by unit_type::build_help_index(), help::unit_topic_generator::operator()(), and unit::unit().
|
inline |
Returns the cost to move through the indicated terrain.
Definition at line 199 of file movetype.hpp.
References movetype::terrain_costs::cost(), movement_, and game_config::sounds::status::slowed.
Referenced by pathfind::move_type_path_calculator::cost(), unit::movement_cost(), and help::unit_topic_generator::operator()().
|
inline |
Returns the resistance against the indicated attack.
Definition at line 213 of file movetype.hpp.
References resist_, and movetype::resistances::resistance_against().
Referenced by unit_type::resistance_against(), and unit::resistance_against().
|
inline |
Returns the resistance against the indicated damage type.
Definition at line 216 of file movetype.hpp.
References resist_, and movetype::resistances::resistance_against().
|
inline |
Sets whether or not *this is flagged as a flying movement type.
Definition at line 196 of file movetype.hpp.
References flying_.
|
inline |
Returns the cost to see through the indicated terrain.
Definition at line 202 of file movetype.hpp.
References movetype::terrain_costs::cost(), game_config::sounds::status::slowed, and vision_.
Referenced by help::unit_topic_generator::operator()(), and unit::vision_cost().
Writes the movement type data to the provided config.
Definition at line 792 of file movetype.cpp.
References defense_, flying_, jamming_, movement_, resist_, vision_, movetype::terrain_info::write(), movetype::terrain_defense::write(), and movetype::resistances::write().
Referenced by movetype::terrain_info::get_merged(), and unit::write().
|
private |
Definition at line 242 of file movetype.hpp.
Referenced by defense_modifier(), get_defense(), has_terrain_defense_caps(), merge(), and write().
|
static |
The set of applicable effects for movement types.
The set of strings defining effects which apply to movetypes.
Definition at line 233 of file movetype.hpp.
Referenced by help::unit_topic_generator::operator()().
|
private |
Definition at line 245 of file movetype.hpp.
Referenced by is_flying(), merge(), set_flying(), and write().
|
private |
Definition at line 241 of file movetype.hpp.
Referenced by get_jamming(), has_jamming_data(), jamming_cost(), merge(), and write().
|
private |
Definition at line 239 of file movetype.hpp.
Referenced by get_movement(), merge(), movement_cost(), and write().
|
private |
Definition at line 243 of file movetype.hpp.
Referenced by damage_table(), get_resistances(), merge(), resistance_against(), and write().
|
static |
Magic value that signifies a hex is unreachable.
The UNREACHABLE macro in the data tree should match this value.
Definition at line 85 of file movetype.hpp.
Referenced by movetype::terrain_costs::cost(), pathfind::find_vacant_tile(), and REPORT_GENERATOR().
|
private |
Definition at line 240 of file movetype.hpp.
Referenced by get_vision(), has_vision_data(), merge(), vision_cost(), and write().