#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 |
int | accuracy () const |
int | parry () const |
int | damage () const |
int | num_attacks () const |
double | attack_weight () const |
double | defense_weight () const |
const config & | specials () 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 (config value) |
bool | has_special (const std::string &special, bool simple_check=false, bool special_id=true, bool special_tags=true) const |
Returns whether or not *this has a special with a tag or id equal to special. More... | |
unit_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... | |
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... | |
bool | apply_modification (const config &cfg) |
Modifies *this using the specifications in cfg, but only if *this matches cfg viewed as a filter. More... | |
bool | describe_modification (const config &cfg, std::string *description) |
Trimmed down version of apply_modification(), with no modifications actually made. 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 |
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_ |
config | 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 | weapon_specials () const |
Returns a comma-separated string of active names for the specials of *this. More... | |
std::string | 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::string | select_damage_type (const unit_ability_list &damage_type_list, const std::string &key_name, const unit_ability_list &resistance_list) const |
Select best damage type based on frequency count for replacement_type and based on highest damage for alternative_type. More... | |
std::pair< std::string, std::string > | damage_type () const |
return a modified damage type and/or add a secondary_type for hybrid use if special is active. More... | |
std::set< std::string > | alternative_damage_types () const |
int | modified_damage () const |
Returns the damage per attack of this weapon, considering specials. More... | |
int | composite_value (const unit_ability_list &abil_list, int base_value) const |
Return the special weapon value, considering specials. More... | |
unit_ability_list | get_weapon_ability (const std::string &ability) const |
Returns list for weapon like abilities for each ability type. More... | |
unit_ability_list | get_specials_and_abilities (const std::string &special) const |
bool | has_weapon_ability (const std::string &special, bool special_id=true, bool special_tags=true) const |
used for abilities used like weapon More... | |
bool | has_special_or_ability (const std::string &special, bool special_id=true, bool special_tags=true) const |
used for abilities used like weapon and true specials More... | |
bool | has_special_with_filter (const config &filter) const |
check if special matche More... | |
bool | has_ability_with_filter (const config &filter) const |
bool | has_special_or_ability_with_filter (const config &filter) const |
bool | special_matches_filter (const config &cfg, const std::string &tag_name, const config &filter) const |
Filter a list of abilities or weapon specials. More... | |
unit_ability_list | overwrite_special_overwriter (unit_ability_list overwriters, const std::string &tag_name) 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 (unit_ability_list &overwriters, const config &cfg, const std::string &tag_name) const |
Check whether cfg would be overwritten by any element of overwriters. More... | |
bool | check_self_abilities (const config &cfg, const std::string &special) const |
check_self_abilities : return an boolean value for checking of activities of abilities used like weapon More... | |
bool | check_adj_abilities (const config &cfg, const std::string &special, int dir, const unit &from) const |
check_adj_abilities : return an boolean value for checking of activities of abilities used like weapon More... | |
bool | special_active (const config &special, AFFECTS whom, const std::string &tag_name, const std::string &filter_self="filter_self") const |
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 config &special, const unit_const_ptr &u, const map_location &loc, AFFECTS whom, const std::string &tag_name, 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 config &special, const unit_const_ptr &u, const unit &from, int dir, const map_location &loc, AFFECTS whom, const std::string &tag_name, 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 config &special, AFFECTS whom, const std::string &tag_name, const std::string &filter_self="filter_self") |
Returns whether or not the given special is active for the specified unit, based on the current context (see set_specials_context). More... | |
Definition at line 37 of file attack_type.hpp.
|
private |
Enumerator | |
---|---|
AFFECT_SELF | |
AFFECT_OTHER | |
AFFECT_EITHER |
Definition at line 228 of file attack_type.hpp.
|
explicit |
Definition at line 50 of file attack_type.cpp.
References description_, translation::egettext(), t_string::empty(), icon_, and id_.
|
inline |
Definition at line 50 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 85 of file attack_type.cpp.
References accuracy_, parry_, s, and utils::signed_percent().
void attack_type::add_formula_context | ( | wfl::map_formula_callable & | callable | ) | const |
Definition at line 613 of file abilities.cpp.
References wfl::map_formula_callable::add().
|
inline |
Returns alignment specified by alignment_ variable.
Definition at line 92 of file attack_type.hpp.
References alignment_.
|
inline |
Returns alignment specified by alignment() for filtering when exist.
Definition at line 95 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().
std::set< std::string > attack_type::alternative_damage_types | ( | ) | const |
Definition at line 1355 of file abilities.cpp.
References c, unit_ability_list::empty(), get_specials_and_abilities(), and i.
bool attack_type::apply_modification | ( | const config & | cfg | ) |
Modifies *this using the specifications in cfg, but only if *this matches cfg viewed as a filter.
this
matched the cfg as a filter. Definition at line 326 of file attack_type.cpp.
References accuracy_, config::add_child(), alignment_, config::all_children_view(), utils::apply_modifier(), attack_weight_, attacks_used_, config::clear(), damage_, defense_weight_, deprecated_message(), description_, t_string::empty(), utils::find(), string_enums::enum_base< Definition >::get_enum(), icon_, id_, INDEFINITE, matches_filter(), 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_specials(), set_type(), specials_, utils::split(), utils::stoi(), 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 147 of file attack_type.hpp.
References name(), range(), and type().
Referenced by damage_type().
|
inline |
Definition at line 54 of file attack_type.hpp.
References attack_weight_.
Referenced by battle_context::choose_attacker_weapon(), and impl_unit_attack_get().
|
inline |
Definition at line 168 of file attack_type.hpp.
References attacks_used_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
private |
check_adj_abilities : return an boolean value for checking of activities of abilities used like weapon
cfg | the config to one special ability checked. |
special | The special ability type who is being checked. |
dir | direction to research a unit adjacent to self_. |
from | unit adjacent to self_ is checked. |
Definition at line 1768 of file abilities.cpp.
References AFFECT_SELF, check_adj_abilities_impl(), other_attack_, self_, and self_loc_.
Referenced by has_ability_with_filter(), and has_weapon_ability().
|
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. |
special | the config to one special ability checked. |
u | the unit who is or not affected by an abilities owned by from. |
from | unit adjacent to u is checked. |
dir | direction to research a unit adjacent to u. |
loc | location of the unit checked. |
whom | determine if unit affected or not by special ability. |
tag_name | The special ability type who is being checked. |
leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1773 of file abilities.cpp.
References loc, and special_active_impl().
Referenced by check_adj_abilities(), has_ability_with_filter(), and has_weapon_ability().
|
private |
check_self_abilities : return an boolean value for checking of activities of abilities used like weapon
cfg | the config to one special ability checked. |
special | The special ability type who is being checked. |
Definition at line 1748 of file abilities.cpp.
References AFFECT_SELF, check_self_abilities_impl(), other_attack_, self_, and self_loc_.
Referenced by has_ability_with_filter(), and has_weapon_ability().
|
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. |
special | the config to one special ability checked. |
u | the unit checked. |
loc | location of the unit checked. |
whom | determine if unit affected or not by special ability. |
tag_name | The special ability type who is being checked. |
leader_bool | If true, [leadership] abilities are checked. |
Definition at line 1753 of file abilities.cpp.
References loc, and special_active_impl().
Referenced by check_self_abilities(), has_ability_with_filter(), and has_weapon_ability().
int attack_type::composite_value | ( | const unit_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 1588 of file abilities.cpp.
References unit_abilities::effect::get_composite_value().
Referenced by modified_attacks(), and modified_damage().
|
inline |
Definition at line 52 of file attack_type.hpp.
References damage_.
Referenced by impl_unit_attack_get(), matches_simple_filter(), modified_damage(), and gui2::dialogs::unit_attack::pre_show().
std::pair< std::string, std::string > attack_type::damage_type | ( | ) | const |
return a modified damage type and/or add a secondary_type for hybrid use if special is active.
Returns the type of damage inflicted.
Definition at line 1332 of file abilities.cpp.
References attack_empty(), unit_ability_list::empty(), get_specials_and_abilities(), other_, other_attack_, other_loc_, select_damage_type(), and type().
Referenced by matches_simple_filter(), and gui2::dialogs::unit_attack::pre_show().
|
inline |
Definition at line 55 of file attack_type.hpp.
References defense_weight_.
Referenced by battle_context::choose_defender_weapon(), and impl_unit_attack_get().
bool attack_type::describe_modification | ( | const config & | cfg, |
std::string * | description | ||
) |
Trimmed down version of apply_modification(), with no modifications actually made.
This can be used to get a description of the modification(s) specified by cfg (if *this matches cfg as a filter).
If *description is provided, it will be set to a (translated) description of the modification(s) applied (currently only changes to the number of strikes, damage, accuracy, and parry are included in this description).
this
matched the cfg as a filter. Definition at line 514 of file attack_type.cpp.
References utils::format_conjunct_list(), matches_filter(), utils::print_modifier(), set_accuracy(), set_attacks_used(), set_damage(), set_max_range(), set_min_range(), set_parry(), utils::stoi(), VGETTEXT, and VNGETTEXT.
|
inline |
Definition at line 416 of file attack_type.hpp.
References changed_.
unit_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 910 of file abilities.cpp.
References unit_ability_list::emplace_back(), i, and loc.
Referenced by get_specials_and_abilities().
unit_ability_list attack_type::get_specials_and_abilities | ( | const std::string & | special | ) | const |
special | the tag name to check for |
Definition at line 1571 of file abilities.cpp.
References unit_ability::ability_cfg, unit_ability_list::append(), unit_ability_list::empty(), utils::erase_if(), get_specials(), get_weapon_ability(), overwrite_special_checking(), and overwrite_special_overwriter().
Referenced by alternative_damage_types(), damage_type(), modified_attacks(), and modified_damage().
unit_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 1552 of file abilities.cpp.
References unit_ability_list::append_if(), i, loc, other_, other_loc_, self_, and self_loc_.
Referenced by get_specials_and_abilities().
bool attack_type::has_ability_with_filter | ( | const config & | filter | ) | const |
Definition at line 2136 of file abilities.cpp.
References AFFECT_OTHER, check_adj_abilities(), check_adj_abilities_impl(), check_self_abilities(), check_self_abilities_impl(), unit_map::end(), unit_map::find(), get_adjacent_tiles(), i, other_, other_attack_, other_loc_, self_, and self_loc_.
Referenced by has_special_or_ability_with_filter().
bool attack_type::has_special | ( | const std::string & | special, |
bool | simple_check = false , |
||
bool | special_id = true , |
||
bool | special_tags = true |
||
) | 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. |
special_id | If true, match special against the id of special tags. |
special_tags | If true, match special against the tag name of special tags. |
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 838 of file abilities.cpp.
Referenced by has_special_or_ability(), and matches_simple_filter().
bool attack_type::has_special_or_ability | ( | const std::string & | special, |
bool | special_id = true , |
||
bool | special_tags = true |
||
) | const |
used for abilities used like weapon and true specials
special | The special being checked. |
special_id | If true, match special against the id of special tags. |
special_tags | If true, match special against the tag name of special tags. |
Definition at line 1894 of file abilities.cpp.
References has_special(), has_weapon_ability(), and range().
Referenced by matches_simple_filter().
bool attack_type::has_special_or_ability_with_filter | ( | const config & | filter | ) | const |
Definition at line 2192 of file abilities.cpp.
References has_ability_with_filter(), has_special_with_filter(), and range().
Referenced by matches_simple_filter().
bool attack_type::has_special_with_filter | ( | const config & | filter | ) | const |
check if special matche
filter | if special check with filter, return true. |
Definition at line 2106 of file abilities.cpp.
References AFFECT_OTHER, AFFECT_SELF, other_attack_, special_active(), special_matches_filter(), and specials().
Referenced by has_special_or_ability_with_filter().
bool attack_type::has_weapon_ability | ( | const std::string & | special, |
bool | special_id = true , |
||
bool | special_tags = true |
||
) | const |
used for abilities used like weapon
Returns whether or not *this has a special ability with a tag or id equal to special.
special | The special being checked. |
special_id | If true, match special against the id of special tags. |
special_tags | If true, match special against the tag name of special tags. |
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 1793 of file abilities.cpp.
References AFFECT_OTHER, check_adj_abilities(), check_adj_abilities_impl(), check_self_abilities(), check_self_abilities_impl(), unit_map::end(), unit_map::find(), get_ability_children(), get_adjacent_tiles(), i, other_, other_attack_, other_loc_, self_, and self_loc_.
Referenced by has_special_or_ability().
|
inline |
Definition at line 45 of file attack_type.hpp.
References icon_.
Referenced by impl_unit_attack_get(), and gui2::dialogs::unit_attack::pre_show().
|
inline |
Definition at line 43 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 284 of file attack_type.cpp.
References config::all_children_view(), and matches_simple_filter().
Referenced by apply_modification(), and describe_modification().
|
inline |
Definition at line 48 of file attack_type.hpp.
References max_range_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
inline |
Definition at line 47 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 1240 of file abilities.cpp.
References composite_value(), unit_ability_list::empty(), ERR_NG, get_specials_and_abilities(), unit_ability_list::highest(), and num_attacks().
int attack_type::modified_damage | ( | ) | const |
Returns the damage per attack of this weapon, considering specials.
Definition at line 1376 of file abilities.cpp.
References composite_value(), damage(), and get_specials_and_abilities().
|
inline |
Definition at line 166 of file attack_type.hpp.
References movement_used_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
inline |
Definition at line 42 of file attack_type.hpp.
References description_.
Referenced by attack_empty(), impl_unit_attack_get(), and gui2::dialogs::unit_attack::pre_show().
|
inline |
Definition at line 53 of file attack_type.hpp.
References num_attacks_.
Referenced by impl_unit_attack_get(), matches_simple_filter(), modified_attacks(), and gui2::dialogs::unit_attack::pre_show().
|
private |
Check whether cfg would be overwritten by any element of overwriters.
overwriters | list used for check if element is overwritable. |
cfg | element checked. |
tag_name | type of abilitie/special checked. |
Definition at line 1635 of file abilities.cpp.
References deprecated_message(), unit_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. |
tag_name | type of abilitie/special checked. |
Definition at line 1599 of file abilities.cpp.
References unit_ability::ability_cfg, unit_ability_list::empty(), utils::erase_if(), i, overwrite_special_affects(), overwrite_special_checking(), unit_ability_list::size(), and utils::sort_if().
Referenced by get_specials_and_abilities().
|
inline |
Definition at line 51 of file attack_type.hpp.
References parry_.
Referenced by impl_unit_attack_get(), and matches_simple_filter().
|
inline |
Definition at line 46 of file attack_type.hpp.
References range_.
Referenced by attack_empty(), battle_context::choose_defender_weapon(), has_special_or_ability(), has_special_or_ability_with_filter(), impl_unit_attack_get(), matches_simple_filter(), and gui2::dialogs::unit_attack::pre_show().
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 308 of file attack_type.cpp.
References config::erase(), i, config::ordered_begin(), config::ordered_end(), special_matches_filter(), and specials_.
Referenced by apply_modification().
std::string attack_type::select_damage_type | ( | const unit_ability_list & | damage_type_list, |
const std::string & | key_name, | ||
const unit_ability_list & | resistance_list | ||
) | const |
Select best damage type based on frequency count for replacement_type and based on highest damage for alternative_type.
damage_type_list | list of [damage_type] to check. |
key_name | name of attribute checked 'alternative_type' or 'replacement_type'. |
resistance_list | list of "resistance" abilities to check for each type of damage checked. |
Definition at line 1318 of file abilities.cpp.
References other_, select_alternative_type(), and select_replacement_type().
Referenced by damage_type().
|
inline |
Definition at line 66 of file attack_type.hpp.
References accuracy_, and set_changed().
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 65 of file attack_type.hpp.
References alignment_, string_enums::enum_base< Definition >::get_enum(), and set_changed().
Referenced by apply_modification().
|
inline |
Definition at line 70 of file attack_type.hpp.
References attack_weight_, and set_changed().
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 169 of file attack_type.hpp.
References attacks_used_.
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 412 of file attack_type.hpp.
References changed_.
Referenced by apply_modification(), 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(), and set_type().
|
inline |
Definition at line 68 of file attack_type.hpp.
References damage_, and set_changed().
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 71 of file attack_type.hpp.
References defense_weight_, and set_changed().
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 61 of file attack_type.hpp.
References icon_, and set_changed().
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 59 of file attack_type.hpp.
References id_, and set_changed().
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 64 of file attack_type.hpp.
References max_range_, and set_changed().
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 63 of file attack_type.hpp.
References min_range_, and set_changed().
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 167 of file attack_type.hpp.
References movement_used_.
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 58 of file attack_type.hpp.
References description_, and set_changed().
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 69 of file attack_type.hpp.
References num_attacks_, and set_changed().
Referenced by impl_unit_attack_set().
|
inline |
Definition at line 67 of file attack_type.hpp.
References parry_, and set_changed().
Referenced by apply_modification(), describe_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 62 of file attack_type.hpp.
References range_, and set_changed().
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 72 of file attack_type.hpp.
References set_changed(), and specials_.
Referenced by apply_modification(), and impl_unit_attack_set().
|
inline |
Definition at line 60 of file attack_type.hpp.
References set_changed(), and type_.
Referenced by apply_modification(), and impl_unit_attack_set().
|
private |
Definition at line 2200 of file abilities.cpp.
References other_attack_, and special_active_impl().
Referenced by has_special_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 |
special | a weapon special WML structure |
whom | specifies which combatant we care about |
tag_name | tag name of the special config |
filter_self | the filter to use |
Definition at line 2216 of file abilities.cpp.
References AFFECT_EITHER, AFFECT_OTHER, AFFECT_SELF, config::child_range(), unit_map::end(), resources::filter_con, unit_map::find(), resources::gameboard, get_adjacent_tiles(), filter_context::get_disp_context(), map_location::get_relative_dir(), unit_map::iterator_base< iter_types >::get_shared_ptr(), display_context::get_team(), i, map_location::indeterminate, utf8::index(), team::is_enemy(), gamemap::is_village(), game_board::map(), terrain_filter::match(), config::matches(), map_location::parse_directions(), utils::parse_ranges_unsigned(), unit::side(), unit::STATE_POISONED, unit::STATE_SLOWED, and unit_map::iterator_base< iter_types >::valid().
Referenced by check_adj_abilities_impl(), check_self_abilities_impl(), and special_active().
|
private |
Filter a list of abilities or weapon specials.
cfg | config of ability checked |
tag_name | le type of ability who is checked |
filter | config contain list of attribute who are researched in cfg |
Definition at line 2101 of file abilities.cpp.
Referenced by has_special_with_filter(), overwrite_special_checking(), and remove_special_by_filter().
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 943 of file abilities.cpp.
References t_string::empty(), config::get_or(), unit::name(), and config_attribute_value::t_str().
|
inline |
Definition at line 56 of file attack_type.hpp.
References specials_.
Referenced by has_special_with_filter(), and impl_unit_attack_get().
|
inline |
Definition at line 406 of file attack_type.hpp.
References loc, and specials_context_t.
|
inline |
Definition at line 403 of file attack_type.hpp.
References loc, and specials_context_t.
|
inline |
Definition at line 398 of file attack_type.hpp.
References specials_context_t.
Referenced by gui2::dialogs::unit_attack::pre_show(), and unit_display::unit_attack().
|
inline |
Definition at line 409 of file attack_type.hpp.
References specials_context_t.
|
inline |
Definition at line 172 of file attack_type.hpp.
Referenced by impl_unit_attack_get().
|
inline |
Definition at line 44 of file attack_type.hpp.
References type_.
Referenced by attack_empty(), damage_type(), impl_unit_attack_get(), matches_simple_filter(), gui2::dialogs::unit_attack::pre_show(), unit::resistance_against(), select_alternative_type(), select_replacement_type(), and unit_abilities::individual_effect::set().
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 674 of file attack_type.cpp.
References utils::contains(), and open_queries_.
Referenced by unit::get_self_ability_bool().
std::string attack_type::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 997 of file abilities.cpp.
References t_string::empty(), config::get_or(), font::inactive_details_color, unit::name(), markup::span_color(), and config_attribute_value::str().
Referenced by gui2::dialogs::unit_attack::pre_show().
|
staticprivate |
Definition at line 1105 of file abilities.cpp.
References add_name(), unit::checking_tags(), unit_map::end(), unit_map::find(), cursor::get(), get_adjacent_tiles(), and i.
|
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 1085 of file abilities.cpp.
References add_name(), and unit::checking_tags().
std::string attack_type::weapon_specials_value | ( | const std::set< std::string > & | checking_tags | ) | const |
Definition at line 1045 of file abilities.cpp.
References _(), add_name(), add_name_list(), and unit::checking_tags().
Referenced by gui2::dialogs::unit_attack::pre_show().
void attack_type::write | ( | config & | cfg | ) | const |
Definition at line 720 of file attack_type.cpp.
References accuracy_, config::add_child(), alignment_str(), attack_weight_, attacks_used_, damage_, defense_weight_, description_, icon_, id_, max_range_, min_range_, movement_used_, num_attacks_, parry_, range_, specials_, and type_.
Referenced by to_config().
|
friend |
Definition at line 367 of file attack_type.hpp.
Referenced by specials_context(), and specials_context_for_listing().
|
private |
Definition at line 434 of file attack_type.hpp.
Referenced by accuracy(), accuracy_parry_description(), apply_modification(), set_accuracy(), and write().
|
private |
Definition at line 428 of file attack_type.hpp.
Referenced by alignment(), alignment_str(), apply_modification(), and set_attack_alignment().
|
private |
Definition at line 431 of file attack_type.hpp.
Referenced by apply_modification(), attack_weight(), set_attack_weight(), and write().
|
private |
Definition at line 436 of file attack_type.hpp.
Referenced by apply_modification(), attacks_used(), set_attacks_used(), and write().
|
private |
Definition at line 439 of file attack_type.hpp.
Referenced by get_changed(), and set_changed().
|
private |
Definition at line 429 of file attack_type.hpp.
Referenced by apply_modification(), damage(), set_damage(), and write().
|
private |
Definition at line 432 of file attack_type.hpp.
Referenced by apply_modification(), defense_weight(), set_defense_weight(), and write().
|
private |
Definition at line 422 of file attack_type.hpp.
Referenced by apply_modification(), attack_type(), name(), set_name(), and write().
|
private |
Definition at line 425 of file attack_type.hpp.
Referenced by apply_modification(), attack_type(), icon(), set_icon(), and write().
|
private |
Definition at line 423 of file attack_type.hpp.
Referenced by apply_modification(), attack_type(), id(), set_id(), and write().
|
mutableprivate |
Definition at line 371 of file attack_type.hpp.
Referenced by overwrite_special_checking(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 373 of file attack_type.hpp.
Referenced by attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 427 of file attack_type.hpp.
Referenced by apply_modification(), max_range(), set_max_range(), and write().
|
private |
Definition at line 427 of file attack_type.hpp.
Referenced by apply_modification(), min_range(), set_min_range(), and write().
|
private |
Definition at line 435 of file attack_type.hpp.
Referenced by apply_modification(), movement_used(), set_movement_used(), and write().
|
private |
Definition at line 430 of file attack_type.hpp.
Referenced by apply_modification(), 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 445 of file attack_type.hpp.
Referenced by update_variables_recursion().
|
mutableprivate |
Definition at line 370 of file attack_type.hpp.
Referenced by damage_type(), get_weapon_ability(), has_ability_with_filter(), has_weapon_ability(), select_damage_type(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 372 of file attack_type.hpp.
Referenced by check_adj_abilities(), check_self_abilities(), damage_type(), has_ability_with_filter(), has_special_with_filter(), has_weapon_ability(), special_active(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 368 of file attack_type.hpp.
Referenced by damage_type(), get_weapon_ability(), has_ability_with_filter(), has_weapon_ability(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 437 of file attack_type.hpp.
Referenced by accuracy_parry_description(), apply_modification(), parry(), set_parry(), and write().
|
private |
Definition at line 426 of file attack_type.hpp.
Referenced by apply_modification(), range(), set_range(), and write().
|
mutableprivate |
Definition at line 369 of file attack_type.hpp.
Referenced by check_adj_abilities(), check_self_abilities(), get_weapon_ability(), has_ability_with_filter(), has_weapon_ability(), and attack_type::specials_context_t::specials_context_t().
|
mutableprivate |
Definition at line 368 of file attack_type.hpp.
Referenced by check_adj_abilities(), check_self_abilities(), get_weapon_ability(), has_ability_with_filter(), has_weapon_ability(), and attack_type::specials_context_t::specials_context_t().
|
private |
Definition at line 438 of file attack_type.hpp.
Referenced by apply_modification(), remove_special_by_filter(), set_specials(), specials(), and write().
|
private |
Definition at line 424 of file attack_type.hpp.
Referenced by apply_modification(), set_type(), type(), and write().