#include <attack_type.hpp>
Classes | |
| class | recursion_guard |
| Helper similar to std::unique_lock for detecting when calculations such as has_special have entered infinite recursion. More... | |
| class | specials_context_t |
Public Member Functions | |
| attack_type (const config &cfg) | |
| const t_string & | name () const |
| const std::string & | id () const |
| const std::string & | type () const |
| const std::string & | icon () const |
| const std::string & | range () const |
| int | min_range () const |
| int | max_range () const |
| std::string | accuracy_parry_description () const |
| std::string | accuracy_parry_tooltip () const |
| int | accuracy () const |
| int | parry () const |
| int | damage () const |
| int | num_attacks () const |
| double | attack_weight () const |
| double | defense_weight () const |
| const ability_vector & | specials () const |
| config | specials_cfg () const |
| ability_vector | specials (const std::string &tag) const |
| void | set_name (const t_string &value) |
| void | set_id (const std::string &value) |
| void | set_type (const std::string &value) |
| void | set_icon (const std::string &value) |
| void | set_range (const std::string &value) |
| void | set_min_range (int value) |
| void | set_max_range (int value) |
| void | set_attack_alignment (const std::string &value) |
| void | set_accuracy (int value) |
| void | set_parry (int value) |
| void | set_damage (int value) |
| void | set_num_attacks (int value) |
| void | set_attack_weight (double value) |
| void | set_defense_weight (double value) |
| void | set_specials_cfg (const config &value) |
| bool | has_special (const std::string &special, bool simple_check=false) const |
| Returns whether or not *this has a special with a tag or id equal to special. More... | |
| active_ability_list | get_specials (const std::string &special) const |
| Returns the currently active specials as an ability list, given the current context (see set_specials_context). More... | |
| std::vector< std::pair< t_string, t_string > > | special_tooltips (boost::dynamic_bitset<> *active_list=nullptr) const |
| Returns a vector of names and descriptions for the specials of *this. More... | |
| std::vector< std::pair< t_string, t_string > > | abilities_special_tooltips (boost::dynamic_bitset<> *active_list) const |
| utils::optional< unit_alignments::type > | alignment () const |
| Returns alignment specified by alignment_ variable. More... | |
| std::string | alignment_str () const |
| Returns alignment specified by alignment() for filtering when exist. More... | |
| bool | attack_empty () const |
| Returns true if this is a dummy attack_type, for example the placeholder that the unit_attack dialog uses when a defender has no weapon for a given range. More... | |
| void | remove_special_by_filter (const config &filter) |
| remove special if matche condition More... | |
| bool | matches_filter (const config &filter, const std::string &check_if_recursion="") const |
| Returns whether or not *this matches the given filter. More... | |
| void | apply_effect (const config &cfg) |
| Applies effect modifications described by cfg. More... | |
| int | movement_used () const |
| void | set_movement_used (int value) |
| int | attacks_used () const |
| void | set_attacks_used (int value) |
| void | write (config &cfg) const |
| config | to_config () const |
| void | add_formula_context (wfl::map_formula_callable &) const |
| recursion_guard | update_variables_recursion (const config &special) 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... | |
| specials_context_t | specials_context (unit_const_ptr self, unit_const_ptr other, const map_location &unit_loc, const map_location &other_loc, bool attacking, const_attack_ptr other_attack) const |
| specials_context_t | specials_context (unit_const_ptr self, const map_location &loc, bool attacking=true) const |
| specials_context_t | specials_context (const unit_type &self_type, const map_location &loc, bool attacking=true) const |
| specials_context_t | specials_context_for_listing (bool attacking=true) const |
| void | set_changed (bool value) |
| bool | get_changed () const |
Static Public Member Functions | |
| static std::string | describe_effect (const config &cfg) |
| Generates a description of the effect specified by cfg, if applicable. More... | |
Private Types | |
| enum | AFFECTS { AFFECT_SELF =1 , AFFECT_OTHER =2 , AFFECT_EITHER =3 } |
Private Attributes | |
| map_location | self_loc_ |
| map_location | other_loc_ |
| unit_const_ptr | self_ |
| unit_const_ptr | other_ |
| bool | is_attacker_ |
| const_attack_ptr | other_attack_ |
| bool | is_for_listing_ = false |
| t_string | description_ |
| std::string | id_ |
| std::string | type_ |
| std::string | icon_ |
| std::string | range_ |
| int | min_range_ |
| int | max_range_ |
| utils::optional< unit_alignments::type > | alignment_ |
| int | damage_ |
| int | num_attacks_ |
| double | attack_weight_ |
| double | defense_weight_ |
| int | accuracy_ |
| int | movement_used_ |
| int | attacks_used_ |
| int | parry_ |
| ability_vector | specials_ |
| bool | changed_ |
| std::vector< const config * > | open_queries_ |
| While processing a recursive match, all the filters that are currently being checked, oldest first. More... | |
Friends | |
| class | specials_context_t |
already added | |
| std::string | describe_weapon_specials () const |
| Returns a comma-separated string of active names for the specials of *this. More... | |
| std::string | describe_weapon_specials_value (const std::set< std::string > &checking_tags) const |
| void | modified_attacks (unsigned &min_attacks, unsigned &max_attacks) const |
| Calculates the number of attacks this weapon has, considering specials. More... | |
| std::pair< std::string, std::set< std::string > > | damage_types () const |
| Return a type()/replacement_type and a list of alternative_types that should be displayed in the selected unit's report. More... | |
| std::pair< std::string, int > | effective_damage_type () const |
| The type of attack used and the resistance value that does the most damage. More... | |
| double | modified_damage () const |
| Returns the damage per attack of this weapon, considering specials. More... | |
| int | modified_chance_to_hit (int cth, bool special_only=false) const |
| Return the defense value, considering specials. More... | |
| int | composite_value (const active_ability_list &abil_list, int base_value) const |
| Return the special weapon value, considering specials. More... | |
| active_ability_list | get_weapon_ability (const std::string &ability) const |
| Returns list for weapon like abilities for each ability type. More... | |
| active_ability_list | get_specials_and_abilities (const std::string &special) const |
| bool | has_special_or_ability (const std::string &special) const |
| used for abilities used like weapon and true specials More... | |
| bool | has_filter_special_or_ability (const config &filter, bool simple_check=false) const |
| check if special matche More... | |
| bool | has_special_or_ability_with_filter (const config &filter) const |
| check if special matche More... | |
| bool | special_matches_filter (const unit_ability_t &ab, const config &filter) const |
| Filter a list of abilities or weapon specials. More... | |
| std::string | select_replacement_type (const active_ability_list &damage_type_list) const |
| Select best damage type based on frequency count for replacement_type. More... | |
| std::pair< std::string, int > | select_alternative_type (const active_ability_list &damage_type_list, const active_ability_list &resistance_list) const |
| Select best damage type based on highest damage for alternative_type. More... | |
| active_ability_list | overwrite_special_overwriter (active_ability_list overwriters) const |
| Filter a list of abilities or weapon specials, removing any entries that don't own the overwrite_specials attributes. More... | |
| bool | overwrite_special_checking (active_ability_list &overwriters, const unit_ability_t &ab) const |
| Check whether cfg would be overwritten by any element of overwriters. More... | |
| bool | special_active (const unit_ability_t &ab, AFFECTS whom, bool in_abilities_tag=false) const |
| bool | special_tooltip_active (const unit_ability_t &ab) const |
| Returns whether or not the given special is active for the specified unit disregarding other units, based on the current context (see specials_context). More... | |
| static void | weapon_specials_impl_self (std::string &temp_string, const unit_const_ptr &self, const const_attack_ptr &self_attack, const const_attack_ptr &other_attack, const map_location &self_loc, AFFECTS whom, std::set< std::string > &checking_name, const std::set< std::string > &checking_tags={}, bool leader_bool=false) |
| weapon_specials_impl_self and weapon_specials_impl_adj : check if special name can be added. More... | |
| static void | weapon_specials_impl_adj (std::string &temp_string, const unit_const_ptr &self, const const_attack_ptr &self_attack, const const_attack_ptr &other_attack, const map_location &self_loc, AFFECTS whom, std::set< std::string > &checking_name, const std::set< std::string > &checking_tags={}, const std::string &affect_adjacents="", bool leader_bool=false) |
| static bool | check_self_abilities_impl (const const_attack_ptr &self_attack, const const_attack_ptr &other_attack, const unit_ability_t &ab, const unit_const_ptr &u, const map_location &loc, AFFECTS whom, bool leader_bool=false) |
| check_self_abilities_impl : return an boolean value for checking of activities of abilities used like weapon More... | |
| static bool | check_adj_abilities_impl (const const_attack_ptr &self_attack, const const_attack_ptr &other_attack, const unit_ability_t &ab, const unit_const_ptr &u, const unit &from, std::size_t dist, int dir, const map_location &loc, const map_location &from_loc, AFFECTS whom, bool leader_bool=false) |
| check_adj_abilities_impl : return an boolean value for checking of activities of abilities used like weapon in unit adjacent to fighter More... | |
| static bool | special_active_impl (const const_attack_ptr &self_attack, const const_attack_ptr &other_attack, const unit_ability_t &special, AFFECTS whom, bool in_abilities_tag=false) |
| Returns whether or not the given special is active for the specified unit, based on the current context (see set_specials_context). More... | |
| static bool | has_ability_impl (const const_attack_ptr &self_attack, const unit_const_ptr &self, const map_location &self_loc, const const_attack_ptr &other_attack, AFFECTS whom, const std::string &special) |
| has_ability_impl : return an boolean value for checking of activities of abilities used like weapon More... | |
| static bool | special_distant_filtering_impl (const const_attack_ptr &self_attack, const unit_const_ptr &self, const map_location &self_loc, const const_attack_ptr &other_attack, AFFECTS whom, const config &filter, bool sub_filter, bool leader_bool=false) |
| special_distant_filtering_impl : return an boolean value if special matche with filter More... | |
Definition at line 84 of file attack_type.hpp.
|
private |
| Enumerator | |
|---|---|
| AFFECT_SELF | |
| AFFECT_OTHER | |
| AFFECT_EITHER | |
Definition at line 284 of file attack_type.hpp.
|
explicit |
Definition at line 159 of file attack_type.cpp.
References cfg, config::child_or_empty(), description_, translation::egettext(), t_string::empty(), icon_, id_, unit_ability_t::parse_vector(), and specials_.
| std::vector< std::pair< t_string, t_string > > attack_type::abilities_special_tooltips | ( | boost::dynamic_bitset<> * | active_list | ) | const |
Definition at line 838 of file abilities.cpp.
References distance_between(), t_string::empty(), and unit::name().
|
inline |
Definition at line 98 of file attack_type.hpp.
References accuracy_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
| std::string attack_type::accuracy_parry_description | ( | ) | const |
Definition at line 196 of file attack_type.cpp.
References accuracy_, parry_, s, and utils::signed_percent().
| std::string attack_type::accuracy_parry_tooltip | ( | ) | const |
Definition at line 212 of file attack_type.cpp.
References _(), accuracy_, markup::bold(), parry_, utils::signed_percent(), and tooltip.
| void attack_type::add_formula_context | ( | wfl::map_formula_callable & | callable | ) | const |
Definition at line 592 of file abilities.cpp.
References wfl::map_formula_callable::add().
|
inline |
Returns alignment specified by alignment_ variable.
Definition at line 149 of file attack_type.hpp.
References alignment_.
|
inline |
Returns alignment specified by alignment() for filtering when exist.
Definition at line 152 of file attack_type.hpp.
References alignment_, and string_enums::enum_base< Definition >::get_string().
Referenced by impl_unit_attack_get(), matches_simple_filter(), and write().
| void attack_type::apply_effect | ( | const config & | cfg | ) |
Applies effect modifications described by cfg.
Definition at line 390 of file attack_type.cpp.
References accuracy_, alignment_, utils::apply_modifier(), attack_weight_, attacks_used_, cfg, utils::contains(), unit_ability_t::create(), damage_, defense_weight_, deprecated_message(), description_, config_attribute_value::empty(), t_string::empty(), string_enums::enum_base< Definition >::get_enum(), icon_, id_, INDEFINITE, max_range_, min_range_, movement_used_, num_attacks_, config::optional_child(), parry_, range_, remove_special_by_filter(), set_accuracy(), set_attack_alignment(), set_attack_weight(), set_attacks_used(), set_changed(), set_damage(), set_defense_weight(), set_icon(), set_max_range(), set_min_range(), set_name(), set_parry(), set_range(), set_type(), specials_, utils::split(), config_attribute_value::to_int(), and type_.
|
inline |
Returns true if this is a dummy attack_type, for example the placeholder that the unit_attack dialog uses when a defender has no weapon for a given range.
Definition at line 198 of file attack_type.hpp.
References name(), range(), and type().
Referenced by effective_damage_type().
|
inline |
Definition at line 102 of file attack_type.hpp.
References attack_weight_.
Referenced by battle_context::choose_attacker_weapon(), and impl_unit_attack_get().
|
inline |
Definition at line 224 of file attack_type.hpp.
References attacks_used_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
staticprivate |
check_adj_abilities_impl : return an boolean value for checking of activities of abilities used like weapon in unit adjacent to fighter
| self_attack | the attack used by unit who fight. |
| other_attack | the attack used by opponent. |
| ab | the ability/special checked |
| u | the unit who is or not affected by an abilities owned by from. |
| from | unit distant to u is checked. |
| dist | distance between unit distant and u. |
| dir | direction to research a unit distant to u. |
| loc | location of the unit checked. |
| from_loc | location of the unit distant to u. |
| whom | determine if unit affected or not by special ability. |
| leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1651 of file abilities.cpp.
References loc, special_active_impl(), and unit_ability_t::tag().
Referenced by has_ability_impl(), and special_distant_filtering_impl().
|
staticprivate |
check_self_abilities_impl : return an boolean value for checking of activities of abilities used like weapon
| self_attack | the attack used by unit checked in this function. |
| other_attack | the attack used by opponent to unit checked. |
| ab | the ability/special checked |
| u | the unit checked. |
| loc | location of the unit checked. |
| whom | determine if unit affected or not by special ability. |
| leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1636 of file abilities.cpp.
References loc, special_active_impl(), and unit_ability_t::tag().
Referenced by has_ability_impl(), and special_distant_filtering_impl().
| int attack_type::composite_value | ( | const active_ability_list & | abil_list, |
| int | base_value | ||
| ) | const |
Return the special weapon value, considering specials.
| abil_list | The list of special checked. |
| base_value | The value modified or not by function. |
Definition at line 1501 of file abilities.cpp.
References unit_abilities::effect::get_composite_value().
Referenced by modified_attacks(), and modified_chance_to_hit().
|
inline |
Definition at line 100 of file attack_type.hpp.
References damage_.
Referenced by impl_unit_attack_get(), matches_simple_filter(), modified_damage(), and events::mouse_handler::show_attack_dialog().
| std::pair< std::string, std::set< std::string > > attack_type::damage_types | ( | ) | const |
Return a type()/replacement_type and a list of alternative_types that should be displayed in the selected unit's report.
Definition at line 1276 of file abilities.cpp.
References c, active_ability_list::empty(), get_specials_and_abilities(), i, select_replacement_type(), and type().
|
inline |
Definition at line 103 of file attack_type.hpp.
References defense_weight_.
Referenced by battle_context::choose_defender_weapon(), and impl_unit_attack_get().
|
static |
Generates a description of the effect specified by cfg, if applicable.
This covers a subset of the effects which can be applied via apply_effect.
Definition at line 560 of file attack_type.cpp.
References cfg, config_attribute_value::empty(), utils::print_modifier(), set_accuracy(), set_attacks_used(), set_damage(), set_max_range(), set_min_range(), set_parry(), config_attribute_value::to_int(), VGETTEXT, and VNGETTEXT.
Referenced by unit::describe_builtin_effect().
| std::string attack_type::describe_weapon_specials | ( | ) | const |
Returns a comma-separated string of active names for the specials of *this.
Empty names are skipped.
Whether or not a special is active depends on the current context (see set_specials_context)
Definition at line 919 of file abilities.cpp.
References t_string::empty(), font::INACTIVE_COLOR, utils::join(), unit::name(), markup::span_color(), t_string::str(), and unit_abilities::substitute_variables().
Referenced by events::mouse_handler::show_attack_dialog().
| std::string attack_type::describe_weapon_specials_value | ( | const std::set< std::string > & | checking_tags | ) | const |
Definition at line 964 of file abilities.cpp.
References _(), add_name(), and add_name_list().
Referenced by events::mouse_handler::show_attack_dialog().
| std::pair< std::string, int > attack_type::effective_damage_type | ( | ) | const |
The type of attack used and the resistance value that does the most damage.
Definition at line 1245 of file abilities.cpp.
References attack_empty(), active_ability_list::empty(), utils::erase_if(), get_specials_and_abilities(), i, is_attacker_, other_, other_attack_, other_loc_, select_alternative_type(), select_replacement_type(), and type().
Referenced by matches_simple_filter(), and events::mouse_handler::show_attack_dialog().
|
inline |
Definition at line 507 of file attack_type.hpp.
References changed_.
| active_ability_list attack_type::get_specials | ( | const std::string & | special | ) | const |
Returns the currently active specials as an ability list, given the current context (see set_specials_context).
Definition at line 769 of file abilities.cpp.
References active_ability_list::emplace_back(), and loc.
Referenced by get_specials_and_abilities(), and modified_chance_to_hit().
| active_ability_list attack_type::get_specials_and_abilities | ( | const std::string & | special | ) | const |
| special | the tag name to check for |
Definition at line 1484 of file abilities.cpp.
References active_ability::ability(), active_ability_list::append(), active_ability_list::empty(), utils::erase_if(), get_specials(), get_weapon_ability(), overwrite_special_checking(), and overwrite_special_overwriter().
Referenced by damage_types(), effective_damage_type(), modified_attacks(), modified_chance_to_hit(), and modified_damage().
| active_ability_list attack_type::get_weapon_ability | ( | const std::string & | ability | ) | const |
Returns list for weapon like abilities for each ability type.
Definition at line 1465 of file abilities.cpp.
References active_ability_list::append_if(), i, loc, other_, other_loc_, self_, and self_loc_.
Referenced by get_specials_and_abilities().
|
staticprivate |
has_ability_impl : return an boolean value for checking of activities of abilities used like weapon
| self_attack | the attack used by unit who fight. |
| other_attack | the attack used by opponent. |
| self | the unit who fight. |
| self_loc | location of self. |
| whom | determine if unit affected or not by special ability. |
| special | The special ability type who is being checked. |
Definition at line 1666 of file abilities.cpp.
References check_adj_abilities_impl(), check_self_abilities_impl(), and distance_between().
Referenced by has_special_or_ability().
| bool attack_type::has_filter_special_or_ability | ( | const config & | filter, |
| bool | simple_check = false |
||
| ) | const |
check if special matche
| simple_check | If true, check whether the unit has the special. Else, check whether the special is currently active. |
| filter | contain attributes to check(special_id, special_type etc...). |
Definition at line 1789 of file abilities.cpp.
References AFFECT_OTHER, AFFECT_SELF, utils::views::filter, other_, other_attack_, other_loc_, range(), self_, self_loc_, special_active(), special_distant_filtering_impl(), specials(), and utils::split_set().
Referenced by matches_simple_filter().
| bool attack_type::has_special | ( | const std::string & | special, |
| bool | simple_check = false |
||
| ) | const |
Returns whether or not *this has a special with a tag or id equal to special.
| special | The special being checked. |
| simple_check | If true, check whether the unit has the special. Else, check whether the special is currently active. |
If simple_check is set to true, then the check is merely for being present. Otherwise (the default), the check is for a special active in the current context (see set_specials_context), including specials obtained from the opponent's attack.
Definition at line 740 of file abilities.cpp.
Referenced by has_special_or_ability().
| bool attack_type::has_special_or_ability | ( | const std::string & | special | ) | const |
used for abilities used like weapon and true specials
Returns whether or not *this has a special ability with a tag or id equal to special.
| special | The special being checked. |
the Check is for a special ability active in the current context (see set_specials_context), including specials obtained from the opponent's attack.
Definition at line 1705 of file abilities.cpp.
References AFFECT_OTHER, AFFECT_SELF, has_ability_impl(), has_special(), other_, other_attack_, other_loc_, range(), self_, and self_loc_.
| bool attack_type::has_special_or_ability_with_filter | ( | const config & | filter | ) | const |
check if special matche
| filter | if special check with filter, return true. |
Definition at line 2034 of file abilities.cpp.
References AFFECT_OTHER, AFFECT_SELF, utils::views::filter, other_, other_attack_, other_loc_, range(), self_, self_loc_, special_active(), special_distant_filtering_impl(), special_matches_filter(), and specials().
Referenced by matches_simple_filter().
|
inline |
Definition at line 92 of file attack_type.hpp.
References icon_.
Referenced by impl_unit_attack_get(), and events::mouse_handler::show_attack_dialog().
|
inline |
Definition at line 90 of file attack_type.hpp.
References id_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
| bool attack_type::matches_filter | ( | const config & | filter, |
| const std::string & | check_if_recursion = "" |
||
| ) | const |
Returns whether or not *this matches the given filter.
Definition at line 354 of file attack_type.cpp.
References utils::views::filter, and matches_simple_filter().
|
inline |
Definition at line 95 of file attack_type.hpp.
References max_range_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
inline |
Definition at line 94 of file attack_type.hpp.
References min_range_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
| void attack_type::modified_attacks | ( | unsigned & | min_attacks, |
| unsigned & | max_attacks | ||
| ) | const |
Calculates the number of attacks this weapon has, considering specials.
This returns two numbers because of the swarm special. The actual number of attacks depends on the unit's health and should be: min_attacks + (max_attacks - min_attacks) * (current hp) / (max hp) c.f. swarm_blows()
Definition at line 1162 of file abilities.cpp.
References composite_value(), active_ability_list::empty(), ERR_NG, get_specials_and_abilities(), active_ability_list::highest(), and num_attacks().
| int attack_type::modified_chance_to_hit | ( | int | cth, |
| bool | special_only = false |
||
| ) | const |
Return the defense value, considering specials.
| cth | The chance_to_hit value modified or not by function. |
| special_only | Decide if get_specials() or get_specials_and_abilities()should be used. |
Definition at line 1303 of file abilities.cpp.
References accuracy_, composite_value(), get_specials(), get_specials_and_abilities(), other_attack_, and parry().
| double attack_type::modified_damage | ( | ) | const |
Returns the damage per attack of this weapon, considering specials.
Definition at line 1297 of file abilities.cpp.
References damage(), unit_abilities::effect::get_composite_double_value(), and get_specials_and_abilities().
|
inline |
Definition at line 222 of file attack_type.hpp.
References movement_used_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
inline |
Definition at line 89 of file attack_type.hpp.
References description_.
Referenced by attack_empty(), impl_unit_attack_get(), and events::mouse_handler::show_attack_dialog().
|
inline |
Definition at line 101 of file attack_type.hpp.
References num_attacks_.
Referenced by impl_unit_attack_get(), matches_simple_filter(), modified_attacks(), and events::mouse_handler::show_attack_dialog().
|
private |
Check whether cfg would be overwritten by any element of overwriters.
| overwriters | list used for check if element is overwritable. |
| ab | the ability/special checked |
Definition at line 1548 of file abilities.cpp.
References unit_ability_t::cfg(), deprecated_message(), active_ability_list::empty(), INDEFINITE, is_attacker_, config::optional_child(), overwrite_special_affects(), and special_matches_filter().
Referenced by get_specials_and_abilities(), and overwrite_special_overwriter().
|
private |
Filter a list of abilities or weapon specials, removing any entries that don't own the overwrite_specials attributes.
| overwriters | list that may have overwrite_specials attributes. |
Definition at line 1512 of file abilities.cpp.
References active_ability::ability_cfg(), active_ability_list::empty(), utils::erase_if(), i, overwrite_special_affects(), overwrite_special_checking(), active_ability_list::size(), and utils::sort_if().
Referenced by get_specials_and_abilities().
|
inline |
Definition at line 99 of file attack_type.hpp.
References parry_.
Referenced by impl_unit_attack_get(), matches_simple_filter(), and modified_chance_to_hit().
|
inline |
Definition at line 93 of file attack_type.hpp.
References range_.
Referenced by attack_empty(), battle_context::choose_defender_weapon(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), impl_unit_attack_get(), matches_simple_filter(), and events::mouse_handler::show_attack_dialog().
| void attack_type::remove_special_by_filter | ( | const config & | filter | ) |
remove special if matche condition
| filter | if special check with filter, it will be removed. |
Definition at line 378 of file attack_type.cpp.
References utils::views::filter, i, special_matches_filter(), and specials_.
Referenced by apply_effect().
|
private |
Select best damage type based on highest damage for alternative_type.
| damage_type_list | list of [damage_type] to check. |
| resistance_list | list of "resistance" abilities to check for each type of damage checked. |
Definition at line 1212 of file abilities.cpp.
References c, i, other_, and type().
Referenced by effective_damage_type().
|
private |
Select best damage type based on frequency count for replacement_type.
| damage_type_list | list of [damage_type] to check. |
Definition at line 1183 of file abilities.cpp.
Referenced by damage_types(), and effective_damage_type().
|
inline |
Definition at line 122 of file attack_type.hpp.
References accuracy_, and set_changed().
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 121 of file attack_type.hpp.
References alignment_, string_enums::enum_base< Definition >::get_enum(), and set_changed().
Referenced by apply_effect().
|
inline |
Definition at line 126 of file attack_type.hpp.
References attack_weight_, and set_changed().
Referenced by apply_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 225 of file attack_type.hpp.
References attacks_used_.
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 503 of file attack_type.hpp.
References changed_.
Referenced by apply_effect(), set_accuracy(), set_attack_alignment(), set_attack_weight(), set_damage(), set_defense_weight(), set_icon(), set_id(), set_max_range(), set_min_range(), set_name(), set_num_attacks(), set_parry(), set_range(), set_specials_cfg(), and set_type().
|
inline |
Definition at line 124 of file attack_type.hpp.
References damage_, and set_changed().
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 127 of file attack_type.hpp.
References defense_weight_, and set_changed().
Referenced by apply_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 117 of file attack_type.hpp.
References icon_, and set_changed().
Referenced by apply_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 115 of file attack_type.hpp.
References id_, and set_changed().
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 120 of file attack_type.hpp.
References max_range_, and set_changed().
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 119 of file attack_type.hpp.
References min_range_, and set_changed().
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 223 of file attack_type.hpp.
References movement_used_.
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 114 of file attack_type.hpp.
References description_, and set_changed().
Referenced by apply_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 125 of file attack_type.hpp.
References num_attacks_, and set_changed().
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 123 of file attack_type.hpp.
References parry_, and set_changed().
Referenced by apply_effect(), describe_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 118 of file attack_type.hpp.
References range_, and set_changed().
Referenced by apply_effect(), and impl_unit_attack_set().
|
inline |
Definition at line 128 of file attack_type.hpp.
References unit_ability_t::cfg_to_vector(), set_changed(), and specials_.
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 116 of file attack_type.hpp.
References set_changed(), and type_.
Referenced by apply_effect(), and impl_unit_attack_set().
|
private |
Definition at line 2075 of file abilities.cpp.
References other_attack_, and special_active_impl().
Referenced by has_filter_special_or_ability(), and has_special_or_ability_with_filter().
|
staticprivate |
Returns whether or not the given special is active for the specified unit, based on the current context (see set_specials_context).
| self_attack | this unit's attack |
| other_attack | the other unit's attack |
| ab | the ability |
| whom | specifies which combatant we care about |
| in_abilities_tag | if special coded in [specials] or [abilities] tags |
Definition at line 2090 of file abilities.cpp.
References AFFECT_EITHER, AFFECT_OTHER, AFFECT_SELF, unit_ability_t::cfg(), unit_map::find(), resources::gameboard, map_location::get_relative_dir(), unit_map::iterator_base< iter_types >::get_shared_ptr(), gamemap::is_village(), game_board::map(), unit::STATE_POISONED, unit::STATE_SLOWED, unit_ability_t::tag(), and unit_map::iterator_base< iter_types >::valid().
Referenced by check_adj_abilities_impl(), check_self_abilities_impl(), and special_active().
|
staticprivate |
special_distant_filtering_impl : return an boolean value if special matche with filter
| self_attack | the attack used by unit who fight. |
| other_attack | the attack used by opponent. |
| self | the unit who fight. |
| self_loc | location of self. |
| whom | determine if unit affected or not by special ability. |
| filter | if special check with filter, return true. |
| sub_filter | if true, check the attributes of [filter_special], else, check special(_id/type)(_active). |
| leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1745 of file abilities.cpp.
References check_adj_abilities_impl(), check_self_abilities_impl(), distance_between(), utils::views::filter, and utils::split_set().
Referenced by has_filter_special_or_ability(), and has_special_or_ability_with_filter().
|
private |
Filter a list of abilities or weapon specials.
| ab | the ability/special |
| filter | config contain list of attribute who are researched in cfg |
Definition at line 2029 of file abilities.cpp.
References unit_ability_t::cfg(), utils::views::filter, and unit_ability_t::tag().
Referenced by has_special_or_ability_with_filter(), overwrite_special_checking(), and remove_special_by_filter().
|
private |
Returns whether or not the given special is active for the specified unit disregarding other units, based on the current context (see specials_context).
| ab | the ability/special |
Definition at line 2225 of file abilities.cpp.
References unit_ability_t::cfg(), is_attacker_, is_for_listing_, other_, self_, self_loc_, and unit_ability_t::tag().
| std::vector< std::pair< t_string, t_string > > attack_type::special_tooltips | ( | boost::dynamic_bitset<> * | active_list = nullptr | ) | const |
Returns a vector of names and descriptions for the specials of *this.
Each std::pair in the vector has first = name and second = description.
This uses either the active or inactive name/description for each special, based on the current context (see set_specials_context), provided active_list is not nullptr. Otherwise specials are assumed active. If the appropriate name is empty, the special is skipped.
Definition at line 802 of file abilities.cpp.
References t_string::empty(), unit::name(), t_string::str(), and unit_abilities::substitute_variables().
|
inline |
Definition at line 104 of file attack_type.hpp.
References specials_.
Referenced by has_filter_special_or_ability(), and has_special_or_ability_with_filter().
|
inline |
Definition at line 110 of file attack_type.hpp.
References unit_ability_t::filter_tag(), specials_, and markup::tag().
|
inline |
Definition at line 106 of file attack_type.hpp.
References specials_, and unit_ability_t::vector_to_cfg().
Referenced by impl_unit_attack_get(), and write().
|
inline |
Definition at line 497 of file attack_type.hpp.
References loc, and specials_context_t.
|
inline |
Definition at line 494 of file attack_type.hpp.
References loc, and specials_context_t.
|
inline |
Definition at line 489 of file attack_type.hpp.
References specials_context_t.
Referenced by events::mouse_handler::show_attack_dialog(), and unit_display::unit_attack().
|
inline |
Definition at line 500 of file attack_type.hpp.
References specials_context_t.
|
inline |
Definition at line 228 of file attack_type.hpp.
Referenced by impl_unit_attack_get().
|
inline |
Definition at line 91 of file attack_type.hpp.
References type_.
Referenced by attack_empty(), damage_types(), effective_damage_type(), impl_unit_attack_get(), matches_simple_filter(), unit::resistance_against(), select_alternative_type(), select_replacement_type(), unit_abilities::individual_effect::set(), events::mouse_handler::show_attack_dialog(), and unit_abilities::substitute_variables().
| attack_type::recursion_guard attack_type::update_variables_recursion | ( | const config & | special | ) | 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, but the whole of attack_type makes that assumption, for example its' mutable members are assumed to be set up by the current caller (or caller's caller, probably several layers up).
Definition at line 716 of file attack_type.cpp.
References utils::contains(), and open_queries_.
Referenced by unit::get_self_ability_bool().
|
staticprivate |
Definition at line 1024 of file abilities.cpp.
References add_name(), and distance_between().
|
staticprivate |
weapon_specials_impl_self and weapon_specials_impl_adj : check if special name can be added.
| [in,out] | temp_string | the string modified and returned |
| [in] | self | the unit checked. |
| [in] | self_attack | the attack used by unit checked in this function. |
| [in] | other_attack | the attack used by opponent to unit checked. |
| [in] | self_loc | location of the unit checked. |
| [in] | whom | determine if unit affected or not by special ability. |
| [in,out] | checking_name | the reference for checking if a name is already added |
| [in] | checking_tags | the reference for checking if special ability type can be used |
| [in] | leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1004 of file abilities.cpp.
References add_name().
| void attack_type::write | ( | config & | cfg | ) | const |
Definition at line 762 of file attack_type.cpp.
References accuracy_, config::add_child(), alignment_str(), attack_weight_, attacks_used_, cfg, damage_, defense_weight_, description_, icon_, id_, max_range_, min_range_, movement_used_, num_attacks_, parry_, range_, specials_cfg(), and type_.
Referenced by to_config().
|
friend |
Definition at line 458 of file attack_type.hpp.
Referenced by specials_context(), and specials_context_for_listing().
|
private |
Definition at line 525 of file attack_type.hpp.
Referenced by accuracy(), accuracy_parry_description(), accuracy_parry_tooltip(), apply_effect(), modified_chance_to_hit(), set_accuracy(), and write().
|
private |
Definition at line 519 of file attack_type.hpp.
Referenced by alignment(), alignment_str(), apply_effect(), and set_attack_alignment().
|
private |
Definition at line 522 of file attack_type.hpp.
Referenced by apply_effect(), attack_weight(), set_attack_weight(), and write().
|
private |
Definition at line 527 of file attack_type.hpp.
Referenced by apply_effect(), attacks_used(), set_attacks_used(), and write().
|
private |
Definition at line 530 of file attack_type.hpp.
Referenced by get_changed(), and set_changed().
|
private |
Definition at line 520 of file attack_type.hpp.
Referenced by apply_effect(), damage(), set_damage(), and write().
|
private |
Definition at line 523 of file attack_type.hpp.
Referenced by apply_effect(), defense_weight(), set_defense_weight(), and write().
|
private |
Definition at line 513 of file attack_type.hpp.
Referenced by apply_effect(), attack_type(), name(), set_name(), and write().
|
private |
Definition at line 516 of file attack_type.hpp.
Referenced by apply_effect(), attack_type(), icon(), set_icon(), and write().
|
private |
Definition at line 514 of file attack_type.hpp.
Referenced by apply_effect(), attack_type(), id(), set_id(), and write().
|
mutableprivate |
Definition at line 462 of file attack_type.hpp.
Referenced by effective_damage_type(), overwrite_special_checking(), special_tooltip_active(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 464 of file attack_type.hpp.
Referenced by special_tooltip_active(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 518 of file attack_type.hpp.
Referenced by apply_effect(), max_range(), set_max_range(), and write().
|
private |
Definition at line 518 of file attack_type.hpp.
Referenced by apply_effect(), min_range(), set_min_range(), and write().
|
private |
Definition at line 526 of file attack_type.hpp.
Referenced by apply_effect(), movement_used(), set_movement_used(), and write().
|
private |
Definition at line 521 of file attack_type.hpp.
Referenced by apply_effect(), num_attacks(), set_num_attacks(), and write().
|
mutableprivate |
While processing a recursive match, all the filters that are currently being checked, oldest first.
Each will have an instance of recursion_guard that is currently allocated permission to recurse, and which will pop the config off this stack when the recursion_guard is finalized.
Definition at line 536 of file attack_type.hpp.
Referenced by update_variables_recursion().
|
mutableprivate |
Definition at line 461 of file attack_type.hpp.
Referenced by effective_damage_type(), get_weapon_ability(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), select_alternative_type(), special_tooltip_active(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 463 of file attack_type.hpp.
Referenced by effective_damage_type(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), modified_chance_to_hit(), special_active(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 459 of file attack_type.hpp.
Referenced by effective_damage_type(), get_weapon_ability(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 528 of file attack_type.hpp.
Referenced by accuracy_parry_description(), accuracy_parry_tooltip(), apply_effect(), parry(), set_parry(), and write().
|
private |
Definition at line 517 of file attack_type.hpp.
Referenced by apply_effect(), range(), set_range(), and write().
|
mutableprivate |
Definition at line 460 of file attack_type.hpp.
Referenced by get_weapon_ability(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), special_tooltip_active(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 459 of file attack_type.hpp.
Referenced by get_weapon_ability(), has_filter_special_or_ability(), has_special_or_ability(), has_special_or_ability_with_filter(), special_tooltip_active(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 529 of file attack_type.hpp.
Referenced by apply_effect(), attack_type(), remove_special_by_filter(), set_specials_cfg(), specials(), and specials_cfg().
|
private |
Definition at line 515 of file attack_type.hpp.
Referenced by apply_effect(), set_type(), type(), and write().