Functions | |
| attack_itors | unit::attacks () |
| Gets an iterator over this unit's attacks. More... | |
| const_attack_itors | unit::attacks () const |
| Const overload of attacks. More... | |
| template<typename... Args> | |
| attack_ptr | unit::add_attack (attack_itors::iterator position, Args &&... args) |
| Adds a new attack to the unit. More... | |
| bool | unit::remove_attack (const attack_ptr &atk) |
| Remove an attack from the unit. More... | |
| void | unit::remove_attacks_ai () |
| Set the unit to have no attacks left for this turn. More... | |
| int | unit::max_attacks () const |
| The maximum number of attacks this unit may perform per turn, usually 1. More... | |
| void | unit::set_max_attacks (int value) |
| int | unit::attacks_left () const |
| Gets the remaining number of attacks this unit can perform this turn. More... | |
| int | unit::attacks_left (bool base_value) const |
| Gets the remaining number of attacks this unit can perform this turn. More... | |
| void | unit::set_attacks (int left) |
| Sets the number of attacks this unit has left this turn. More... | |
| int | unit::defense_modifier (const t_translation::terrain_code &terrain, const map_location &loc) const |
| The unit's defense on a given terrain. More... | |
| int | unit::defense_modifier (const t_translation::terrain_code &terrain) const |
| int | unit::resistance_value (active_ability_list resistance_list, const std::string &damage_name) const |
| For the provided list of resistance abilities, determine the damage resistance based on which are active and any max_value that's present. More... | |
| int | unit::resistance_against (const std::string &damage_name, bool attacker, const map_location &loc) const |
| The unit's resistance against a given damage type. More... | |
| utils::string_map_res | unit::get_base_resistances () const |
| Gets resistances without any abilities applied. More... | |
| bool | unit::resistance_filter_matches (const config &cfg, const std::string &damage_name, int res) const |
|
inline |
Adds a new attack to the unit.
| position | An iterator pointing to the attack before which to insert the new one. |
| args | The arguments for constructing the attack |
Definition at line 865 of file unit.hpp.
References unit::attacks_, unit::set_attr_changed(), and unit::UA_ATTACKS.
Referenced by impl_unit_attacks_set().
|
inline |
Gets an iterator over this unit's attacks.
Definition at line 848 of file unit.hpp.
References unit::attacks_, and make_attack_itors().
Referenced by battle_context::battle_context(), battle_context_unit_stats::battle_context_unit_stats(), battle_context::choose_attacker_weapon(), battle_context::choose_defender_weapon(), get_attack_iter(), wfl::unit_callable::get_value(), impl_unit_attacks_len(), impl_unit_attacks_set(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::move_to_targets_phase::rate_group(), gui2::unit_preview_pane::set_display_data(), display_context::unit_can_move(), unit::unit_special_notes(), and unit_weapons().
|
inline |
Const overload of attacks.
Definition at line 854 of file unit.hpp.
References unit::attacks_, and make_attack_itors().
|
inline |
Gets the remaining number of attacks this unit can perform this turn.
If the 'incapacitated' status is set, this will always be 0.
Definition at line 900 of file unit.hpp.
References unit::attacks_left_, and unit::incapacitated().
Referenced by wb::attack::apply_temp_modifier(), unit::attacks_left(), wfl::unit_callable::get_value(), wb::attack::remove_temp_modifier(), gui2::unit_preview_pane::set_display_data(), display_context::unit_can_move(), UNIT_GETTER(), display_context::unit_orb_status(), and unit_weapons().
|
inline |
Gets the remaining number of attacks this unit can perform this turn.
| base_value | If false, consider the incapacitated flag. |
Definition at line 912 of file unit.hpp.
References unit::attacks_left(), and unit::attacks_left_.
|
inline |
Definition at line 933 of file unit.hpp.
References unit::defense_modifier(), and unit::loc_.
| int unit::defense_modifier | ( | const t_translation::terrain_code & | terrain, |
| const map_location & | loc | ||
| ) | const |
The unit's defense on a given terrain.
| terrain | The terrain to check |
| loc | location of unit |
Definition at line 1756 of file unit.cpp.
References movetype::defense_modifier(), active_ability_list::empty(), unit::get_abilities(), unit_abilities::effect::get_composite_value(), loc, and unit::movement_type_.
Referenced by battle_context_unit_stats::battle_context_unit_stats(), ai::ai_default_rca::move_to_targets_phase::choose_move(), pathfind::shortest_path_calculator::cost(), unit::defense_modifier(), ai::ai_default_rca::get_villages_phase::find_villages(), intf_unit_defense(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::move_to_targets_phase::rate_group(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), ai::default_ai_context_impl::rate_terrain(), REPORT_GENERATOR(), and unit_defense().
|
inline |
Gets resistances without any abilities applied.
Definition at line 956 of file unit.hpp.
References movetype::damage_table(), and unit::movement_type_.
Referenced by gui2::unit_preview_pane::set_display_data(), and unit_hp().
|
inline |
The maximum number of attacks this unit may perform per turn, usually 1.
Definition at line 884 of file unit.hpp.
References unit::max_attacks_.
Referenced by wfl::unit_callable::get_value(), UNIT_GETTER(), display_context::unit_orb_status(), and unit_weapons().
| bool unit::remove_attack | ( | const attack_ptr & | atk | ) |
Remove an attack from the unit.
| atk | A pointer to the attack to remove |
Definition at line 2787 of file unit.cpp.
References unit::attacks_, utils::find(), unit::set_attr_changed(), and unit::UA_ATTACKS.
Referenced by impl_unit_attacks_set().
| void unit::remove_attacks_ai | ( | ) |
Set the unit to have no attacks left for this turn.
Definition at line 2798 of file unit.cpp.
References unit::attacks_left_, unit::max_attacks_, and unit::set_attacks().
| int unit::resistance_against | ( | const std::string & | damage_name, |
| bool | attacker, | ||
| const map_location & | loc | ||
| ) | const |
The unit's resistance against a given damage type.
| damage_name | The damage type |
| attacker | True if this unit is on the offensive (to resolve [resistance] abilities) |
| loc | The unit's location (to resolve [resistance] abilities) |
Definition at line 1806 of file unit.cpp.
References utils::erase_if(), unit::get_abilities(), i, loc, and unit::resistance_value().
Referenced by wfl::gamestate::DEFINE_WFL_FUNCTION(), intf_unit_resistance(), and unit_hp().
|
private |
Definition at line 1768 of file unit.cpp.
References cfg, utils::contains(), unit_abilities::filter_base_matches(), and utils::split().
Referenced by unit::resistance_value().
| int unit::resistance_value | ( | active_ability_list | resistance_list, |
| const std::string & | damage_name | ||
| ) | const |
For the provided list of resistance abilities, determine the damage resistance based on which are active and any max_value that's present.
| resistance_list | A list of resistance abilities that the unit has. |
| damage_name | The name of the damage type, for example "blade". |
Definition at line 1790 of file unit.cpp.
References active_ability_list::empty(), utils::erase_if(), unit_abilities::effect::get_composite_value(), i, unit::movement_type_, movetype::resistance_against(), and unit::resistance_filter_matches().
Referenced by unit::resistance_against().
|
inline |
Sets the number of attacks this unit has left this turn.
| left | The number of attacks left |
Definition at line 921 of file unit.hpp.
References unit::attacks_left_.
Referenced by wb::attack::apply_temp_modifier(), unit::remove_attacks_ai(), wb::attack::remove_temp_modifier(), and UNIT_SETTER().
|
inline |
Definition at line 889 of file unit.hpp.
References unit::max_attacks_, unit::set_attr_changed(), and unit::UA_MAX_AP.
Referenced by unit::apply_builtin_effect(), unit::init(), and UNIT_SETTER().