#include <abilities.hpp>
Classes | |
| class | recursion_guard |
| struct | tooltip_info |
Public Types | |
| enum class | active_on_t { offense , defense , both } |
| enum class | apply_to_t { self , opponent , attacker , defender , both } |
| enum class | affects_allies_t { yes , no , same_side_only } |
| enum class | affects_t { SELF = 1 , OTHER = 2 , EITHER = 3 } |
Public Member Functions | |
| unit_ability_t (std::string tag, config cfg, bool inside_attack) | |
| const std::string & | tag () const |
| const std::string & | id () const |
| bool | in_specials_tag () const |
| const config & | cfg () const |
| active_on_t | active_on () const |
| apply_to_t | apply_to () const |
| double | priority () const |
| affects_allies_t | affects_allies () const |
| bool | affects_self () const |
| bool | affects_enemies () const |
| std::string | get_help_topic_id () const |
| std::string | get_name (bool is_inactive=false, unit_race::GENDER=unit_race::MALE) const |
| std::string | get_description (bool is_inactive=false, unit_race::GENDER=unit_race::MALE) const |
| bool | active_on_matches (bool student_is_attacker) const |
| void | write (config &abilities_cfg) |
| std::string | substitute_variables (const std::string &str) const |
| Substitute gettext variables in name and description of abilities and specials. More... | |
| recursion_guard | guard_against_recursion (const unit &u) const |
| Tests which might otherwise cause infinite recursion should call this, check that the returned object evaluates to true, and then keep the object returned as long as the recursion might occur, similar to a reentrant mutex that's limited to a small number of reentrances. More... | |
already added | |
| bool | matches_filter (const config &filter) const |
Static Public Member Functions | |
| static ability_ptr | create (std::string tag, config cfg, bool inside_attack) |
| static void | do_compat_fixes (config &cfg, const std::string &tag, bool inside_attack) |
| static std::string | get_help_topic_id (const config &cfg) |
| static void | parse_vector (const config &abilities_cfg, ability_vector &res, bool inside_attack) |
| static config | vector_to_cfg (const ability_vector &abilities) |
| static ability_vector | cfg_to_vector (const config &abilities_cfg, bool inside_attack) |
| static ability_vector | filter_tag (const ability_vector &vec, const std::string &tag) |
| static ability_vector | clone (const ability_vector &vec) |
Private Attributes | |
| std::string | tag_ |
| std::string | id_ |
| bool | in_specials_tag_ |
| active_on_t | active_on_ |
| apply_to_t | apply_to_ |
| affects_allies_t | affects_allies_ |
| bool | affects_self_ |
| bool | affects_enemies_ |
| double | priority_ |
| config | cfg_ |
| bool | currently_checked_ |
Definition at line 31 of file abilities.hpp.
|
strong |
| Enumerator | |
|---|---|
| offense | |
| defense | |
| both | |
Definition at line 35 of file abilities.hpp.
|
strong |
| Enumerator | |
|---|---|
| yes | |
| no | |
| same_side_only | |
Definition at line 37 of file abilities.hpp.
|
strong |
| Enumerator | |
|---|---|
| SELF | |
| OTHER | |
| EITHER | |
Definition at line 39 of file abilities.hpp.
|
strong |
| Enumerator | |
|---|---|
| self | |
| opponent | |
| attacker | |
| defender | |
| both | |
Definition at line 36 of file abilities.hpp.
| unit_ability_t::unit_ability_t | ( | std::string | tag, |
| config | cfg, | ||
| bool | inside_attack | ||
| ) |
Definition at line 125 of file abilities.cpp.
References active_on(), active_on_, affects_allies_, affects_enemies_, affects_self_, apply_to(), apply_to_, attacker, both, cfg_, defender, defense, do_compat_fixes(), config::has_child(), no, offense, opponent, self, tag_, and yes.
|
inline |
Definition at line 54 of file abilities.hpp.
References active_on_.
Referenced by active_on_matches(), and unit_ability_t().
| bool unit_ability_t::active_on_matches | ( | bool | student_is_attacker | ) | const |
Definition at line 365 of file abilities.cpp.
References active_on(), both, defense, and offense.
Referenced by attack_type::special_active_impl().
|
inline |
Definition at line 59 of file abilities.hpp.
References affects_allies_.
|
inline |
Definition at line 63 of file abilities.hpp.
References affects_enemies_.
|
inline |
Definition at line 61 of file abilities.hpp.
References affects_self_.
Referenced by unit::ability_affects_self().
|
inline |
Definition at line 55 of file abilities.hpp.
References apply_to_.
Referenced by attack_type::special_active_impl(), attack_type::special_tooltip_active(), and unit_ability_t().
|
inline |
Definition at line 52 of file abilities.hpp.
References cfg_.
Referenced by unit::ability_active_impl(), unit::ability_affects_adjacent(), unit::ability_affects_self(), add_string_to_vector(), create(), do_compat_fixes(), get_help_topic_id(), guard_against_recursion(), overwrite_special_affects(), attack_type::overwrite_special_checking(), substitute_variables(), and write().
|
static |
Definition at line 258 of file abilities.cpp.
References parse_vector().
Referenced by attack_type::set_specials_cfg().
|
static |
Definition at line 276 of file abilities.cpp.
Referenced by unit::advance_to().
|
inlinestatic |
Definition at line 43 of file abilities.hpp.
Referenced by unit::apply_builtin_effect(), attack_type::apply_effect(), unit_type::build_help_index(), and parse_vector().
|
static |
Definition at line 170 of file abilities.cpp.
References config::add_child(), game_config::images::blank, cfg(), config::child_or_add(), config::child_range(), deprecated_message(), config::empty(), FOR_REMOVAL, config::has_child(), INDEFINITE, config::optional_child(), map_location::parse_directions(), config::remove_attribute(), config::remove_children(), and tag().
Referenced by unit_ability_t().
|
static |
Definition at line 265 of file abilities.cpp.
References tag().
Referenced by unit::abilities(), and attack_type::specials().
| std::string unit_ability_t::get_description | ( | bool | is_inactive = false, |
| unit_race::GENDER | gender = unit_race::MALE |
||
| ) | const |
Definition at line 358 of file abilities.cpp.
References cfg_, unit_race::FEMALE, and substitute_variables().
| std::string unit_ability_t::get_help_topic_id | ( | ) | const |
Definition at line 245 of file abilities.cpp.
Referenced by help::generate_weapon_special_topics().
|
static |
Definition at line 236 of file abilities.cpp.
References cfg().
| std::string unit_ability_t::get_name | ( | bool | is_inactive = false, |
| unit_race::GENDER | gender = unit_race::MALE |
||
| ) | const |
Definition at line 351 of file abilities.cpp.
References cfg_, unit_race::FEMALE, and substitute_variables().
| unit_ability_t::recursion_guard unit_ability_t::guard_against_recursion | ( | const unit & | u | ) | const |
Tests which might otherwise cause infinite recursion should call this, check that the returned object evaluates to true, and then keep the object returned as long as the recursion might occur, similar to a reentrant mutex that's limited to a small number of reentrances.
This only expects to be called in a single thread
Definition at line 400 of file abilities.cpp.
References cfg(), utils::contains(), currently_checked_, config::debug(), ERR_NG, unit::id(), and utils::trim().
Referenced by unit::ability_active(), unit::get_adj_ability_bool(), and unit::get_self_ability_bool().
|
inline |
|
inline |
Definition at line 51 of file abilities.hpp.
References in_specials_tag_.
Referenced by attack_type::special_active_impl().
| bool unit_ability_t::matches_filter | ( | const config & | filter | ) | const |
Definition at line 1890 of file abilities.cpp.
References cfg, utils::views::filter, and markup::tag().
Referenced by attack_type::overwrite_special_checking().
|
static |
Definition at line 251 of file abilities.cpp.
References config::all_children_range(), and create().
Referenced by attack_type::attack_type(), cfg_to_vector(), and unit::init().
|
inline |
Definition at line 56 of file abilities.hpp.
References priority_.
| std::string unit_ability_t::substitute_variables | ( | const std::string & | str | ) | const |
Substitute gettext variables in name and description of abilities and specials.
| str | The string in which the substitution is to be done |
str with all gettext variables substitutes with corresponding special properties Definition at line 300 of file abilities.cpp.
References cfg(), utils::interpolate_variables_into_string(), tag(), unit_type_data::types(), and unit_types.
Referenced by get_description(), and get_name().
|
inline |
Definition at line 49 of file abilities.hpp.
References tag_.
Referenced by unit::ability_active_impl(), unit::ability_affects_adjacent(), unit::ability_affects_self(), create(), do_compat_fixes(), filter_tag(), attack_type::special_active_impl(), substitute_variables(), and write().
|
static |
Definition at line 285 of file abilities.cpp.
Referenced by unit::abilities_cfg(), and attack_type::specials_cfg().
| void unit_ability_t::write | ( | config & | abilities_cfg | ) |
Definition at line 295 of file abilities.cpp.
References config::add_child(), cfg(), and tag().
|
private |
Definition at line 143 of file abilities.hpp.
Referenced by active_on(), and unit_ability_t().
|
private |
Definition at line 145 of file abilities.hpp.
Referenced by affects_allies(), and unit_ability_t().
|
private |
Definition at line 147 of file abilities.hpp.
Referenced by affects_enemies(), and unit_ability_t().
|
private |
Definition at line 146 of file abilities.hpp.
Referenced by affects_self(), and unit_ability_t().
|
private |
Definition at line 144 of file abilities.hpp.
Referenced by apply_to(), and unit_ability_t().
|
private |
Definition at line 149 of file abilities.hpp.
Referenced by cfg(), get_description(), get_name(), and unit_ability_t().
|
mutableprivate |
Definition at line 151 of file abilities.hpp.
Referenced by guard_against_recursion().
|
private |
Definition at line 140 of file abilities.hpp.
Referenced by id().
|
private |
Definition at line 142 of file abilities.hpp.
Referenced by in_specials_tag().
|
private |
Definition at line 148 of file abilities.hpp.
Referenced by priority().
|
private |
Definition at line 139 of file abilities.hpp.
Referenced by tag(), and unit_ability_t().