Stores a set of resistances. More...
#include <movetype.hpp>
Public Member Functions | |
resistances () | |
resistances (const config &cfg) | |
utils::string_map | damage_table () const |
Returns a map from attack types to resistances. 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... | |
void | merge (const config &new_data, bool overwrite) |
Merges the given config over the existing costs. More... | |
void | write (config &out_cfg, const std::string &child_name="") const |
Writes our data to a config, as a child if child_name is specified. More... | |
Private Attributes | |
config | cfg_ |
Stores a set of resistances.
Definition at line 153 of file movetype.hpp.
|
inline |
Definition at line 156 of file movetype.hpp.
|
inlineexplicit |
Definition at line 157 of file movetype.hpp.
utils::string_map movetype::resistances::damage_table | ( | ) | const |
Returns a map from attack types to resistances.
Definition at line 630 of file movetype.cpp.
Referenced by movetype::damage_table().
Merges the given config over the existing costs.
If overwrite is false, the new values will be added to the old.
Definition at line 664 of file movetype.cpp.
References config::attribute_range(), and config::attribute_value::to_int().
Referenced by unit::apply_builtin_effect(), and movetype::merge().
int movetype::resistances::resistance_against | ( | const attack_type & | attack | ) | const |
Returns the resistance against the indicated attack.
Definition at line 645 of file movetype.cpp.
References attack_type::type().
Referenced by movetype::resistance_against().
int movetype::resistances::resistance_against | ( | const std::string & | damage_type | ) | const |
Returns the resistance against the indicated damage type.
Definition at line 654 of file movetype.cpp.
void movetype::resistances::write | ( | config & | out_cfg, |
const std::string & | child_name = "" |
||
) | const |
Writes our data to a config, as a child if child_name is specified.
(No child is created if there is no data.)
Definition at line 683 of file movetype.cpp.
References config::add_child(), and config::merge_with().
Referenced by movetype::write().
|
private |
Definition at line 171 of file movetype.hpp.