Enumerations | |
enum | unit::state_t { unit::STATE_SLOWED = 0 , unit::STATE_POISONED , unit::STATE_PETRIFIED , unit::STATE_UNCOVERED , unit::STATE_NOT_MOVED , unit::STATE_UNHEALABLE , unit::STATE_GUARDIAN , unit::STATE_INVULNERABLE , unit::NUMBER_OF_STATES , unit::STATE_UNKNOWN = -1 } |
Built-in status effects known to the engine. More... | |
Functions | |
int | unit::side () const |
The side this unit belongs to. More... | |
void | unit::set_side (unsigned int new_side) |
Sets the side this unit belongs to. More... | |
const unit_type & | unit::type () const |
This unit's type, accounting for gender and variation. More... | |
const std::string & | unit::type_id () const |
The id of this unit's type. More... | |
const t_string & | unit::type_name () const |
Gets the translatable name of this unit's type. More... | |
const std::string & | unit::id () const |
Gets this unit's id. More... | |
void | unit::set_id (const std::string &id) |
Sets this unit's string ID. More... | |
std::size_t | unit::underlying_id () const |
This unit's unique internal ID. More... | |
void | unit::set_underlying_id (n_unit::id_manager &id_manager) |
Sets the internal ID. More... | |
const t_string & | unit::name () const |
Gets this unit's translatable display name. More... | |
void | unit::set_name (const t_string &name) |
Sets this unit's translatable display name. More... | |
void | unit::rename (const std::string &name) |
Attempts to rename this unit's translatable display name, taking the 'unrenamable' flag into account. More... | |
bool | unit::unrenamable () const |
Whether this unit can be renamed. More... | |
void | unit::set_unrenamable (bool unrenamable) |
Sets the 'unrenamable' flag. More... | |
t_string | unit::unit_description () const |
A detailed description of this unit. More... | |
void | unit::set_unit_description (const t_string &new_desc) |
A detailed description of this unit. More... | |
std::vector< t_string > | unit::unit_special_notes () const |
The unit's special notes. More... | |
unit_race::GENDER | unit::gender () const |
The gender of this unit. More... | |
unit_alignments::type | unit::alignment () const |
The alignment of this unit. More... | |
void | unit::set_alignment (unit_alignments::type alignment) |
Sets the alignment of this unit. More... | |
const unit_race * | unit::race () const |
Gets this unit's race. More... | |
int | unit::hitpoints () const |
The current number of hitpoints this unit has. More... | |
int | unit::max_hitpoints () const |
The max number of hitpoints this unit can have. More... | |
void | unit::set_max_hitpoints (int value) |
void | unit::set_hitpoints (int hp) |
Sets the current hitpoint amount. More... | |
int | unit::experience () const |
The current number of experience points this unit has. More... | |
int | unit::max_experience () const |
The max number of experience points this unit can have. More... | |
void | unit::set_max_experience (int value) |
unsigned int | unit::experience_to_advance () const |
The number of experience points this unit needs to level up, or 0 if current XP > max XP. More... | |
unsigned int | unit::experience_overflow () const |
The number of experience points over max this unit has, or 0 if current XP < max XP. More... | |
void | unit::set_experience (int xp) |
Sets the current experience point amount. More... | |
int | unit::level () const |
The current level of this unit. More... | |
void | unit::set_level (int level) |
Sets the current level of this unit. More... | |
const std::string & | unit::variation () const |
The ID of the variation of this unit's type. More... | |
void | unit::set_undead_variation (const std::string &value) |
The ID of the undead variation (ie, dwarf, swimmer) of this unit. More... | |
const std::string & | unit::undead_variation () const |
std::string | unit::small_profile () const |
An optional profile image to display in Help. More... | |
void | unit::set_small_profile (const std::string &value) |
std::string | unit::big_profile () const |
An optional profile image displays when this unit is 'speaking' via [message]. More... | |
void | unit::set_big_profile (const std::string &value) |
bool | unit::can_recruit () const |
Whether this unit can recruit other units - ie, are they a leader unit. More... | |
void | unit::set_can_recruit (bool canrecruit) |
Sets whether this unit can recruit other units. More... | |
const std::vector< std::string > & | unit::recruits () const |
The type IDs of the other units this unit may recruit, if possible. More... | |
void | unit::set_recruits (const std::vector< std::string > &recruits) |
Sets the recruit list. More... | |
int | unit::cost () const |
How much gold is required to recruit this unit. More... | |
int | unit::recall_cost () const |
How much gold it costs to recall this unit, or -1 if the side's default recall cost is used. More... | |
void | unit::set_recall_cost (int recall_cost) |
Sets the cost of recalling this unit. More... | |
const config & | unit::recall_filter () const |
Gets the filter constraints upon which units this unit may recall, if able. More... | |
void | unit::set_recall_filter (const config &filter) |
Sets the filter constraints upon which units this unit may recall, if able. More... | |
const std::string & | unit::get_role () const |
Gets this unit's role. More... | |
void | unit::set_role (const std::string &role) |
Sets a unit's role. More... | |
std::string | unit::usage () const |
Gets this unit's usage. More... | |
void | unit::set_usage (const std::string &usage) |
Sets this unit's usage. More... | |
config & | unit::variables () |
Gets any user-defined variables this unit 'owns'. More... | |
const config & | unit::variables () const |
Const overload of variables. More... | |
bool | unit::get_hidden () const |
Gets whether this unit is currently hidden on the map. More... | |
void | unit::set_hidden (bool state) const |
Sets whether the unit is hidden on the map. More... | |
double | unit::hp_bar_scaling () const |
The factor by which the HP bar should be scaled. More... | |
double | unit::xp_bar_scaling () const |
The factor by which the XP bar should be scaled. More... | |
bool | unit::hold_position () const |
Whether the unit has been instructed to hold its position. More... | |
void | unit::toggle_hold_position () |
Toggle the unit's hold position status. More... | |
void | unit::set_user_end_turn (bool value=true) |
Set whether the user ended their turn. More... | |
void | unit::toggle_user_end_turn () |
Toggle whether the user ended their turn. More... | |
bool | unit::user_end_turn () const |
Check whether the user ended their turn. More... | |
void | unit::new_turn () |
Refresh unit for the beginning of a turn. More... | |
void | unit::end_turn () |
Refresh unit for the end of a turn. More... | |
void | unit::new_scenario () |
Refresh unit for the beginning of a new scenario. More... | |
bool | unit::take_hit (int damage) |
Damage the unit. More... | |
void | unit::heal (int amount) |
Heal the unit. More... | |
void | unit::heal_fully () |
Fully heal the unit, restoring it to max hitpoints. More... | |
const std::set< std::string > | unit::get_states () const |
Get the status effects currently affecting the unit. More... | |
bool | unit::get_state (const std::string &state) const |
Check if the unit is affected by a status effect. More... | |
void | unit::set_state (const std::string &state, bool value) |
Set whether the unit is affected by a status effect. More... | |
void | unit::set_state (state_t state, bool value) |
Set whether the unit is affected by a status effect. More... | |
bool | unit::get_state (state_t state) const |
Check if the unit is affected by a status effect. More... | |
static state_t | unit::get_known_boolean_state_id (const std::string &state) |
Convert a string status effect ID to a built-in status effect ID. More... | |
bool | unit::poisoned () const |
Check if the unit has been poisoned. More... | |
bool | unit::incapacitated () const |
Check if the unit has been petrified. More... | |
bool | unit::slowed () const |
Check if the unit has been slowed. More... | |
enum unit::state_t |
Built-in status effects known to the engine.
Enumerator | |
---|---|
STATE_SLOWED | |
STATE_POISONED | The unit is slowed - it moves slower and does less damage. |
STATE_PETRIFIED | The unit is poisoned - it loses health each turn. |
STATE_UNCOVERED | The unit is petrified - it cannot move or be attacked. |
STATE_NOT_MOVED | The unit is uncovered - it was hiding but has been spotted. |
STATE_UNHEALABLE | The unit has not moved.
|
STATE_GUARDIAN | The unit cannot be healed. |
STATE_INVULNERABLE | The unit is a guardian - it won't move unless a target is sighted. |
NUMBER_OF_STATES | The unit is invulnerable - it cannot be hit by any attack. |
STATE_UNKNOWN | To set the size of known_boolean_states_. |
|
inline |
The alignment of this unit.
This affects the time of day during which this unit's attacks do the most damage.
Definition at line 476 of file unit.hpp.
References unit::alignment_.
Referenced by attack_info(), battle_context_unit_stats::battle_context_unit_stats(), wfl::unit_callable::get_value(), ai::readonly_context_impl::power_projection(), unit::set_alignment(), gui2::dialogs::attack_predictions::set_data(), gui2::unit_preview_pane::set_displayed_unit(), and unit_alignment().
std::string unit::big_profile | ( | ) | const |
An optional profile image displays when this unit is 'speaking' via [message].
Definition at line 1029 of file unit.cpp.
References unit::absolute_image(), and unit::profile_.
|
inline |
Whether this unit can recruit other units - ie, are they a leader unit.
Definition at line 613 of file unit.hpp.
References unit::canrecruit_.
Referenced by gui2::dialogs::add_unit_entry(), ai::ai_default_rca::get_healing_phase::evaluate(), wb::find_backup_leader(), unit::generate_traits(), ai::default_recruitment::recruitment::get_cost_map_of_side(), ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), gui2::dialogs::unit_recall::pre_show(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_displayed_unit(), editor::map_context::to_config(), ai::default_recruitment::recruitment::update_own_units_count(), unit::upkeep(), and unit::write().
|
inline |
How much gold is required to recruit this unit.
Definition at line 634 of file unit.hpp.
References unit::unit_value_.
Referenced by ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), statistics_t::recall_unit(), statistics_t::recruit_unit(), statistics_t::un_recall_unit(), and statistics_t::un_recruit_unit().
void unit::end_turn | ( | ) |
Refresh unit for the end of a turn.
Definition at line 1266 of file unit.cpp.
References unit::expire_modifications(), unit::get_state(), unit::movement_, unit::resting_, unit::set_interrupted_move(), unit::set_state(), unit::STATE_NOT_MOVED, unit::STATE_SLOWED, and unit::total_movement().
|
inline |
The current number of experience points this unit has.
Definition at line 524 of file unit.hpp.
References unit::experience_.
Referenced by gui2::dialogs::add_unit_entry(), gui2::dialogs::unit_recall::dismiss_unit(), wfl::unit_callable::get_value(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_displayed_unit(), and unit_xp().
|
inline |
The number of experience points over max this unit has, or 0 if current XP < max XP.
Definition at line 548 of file unit.hpp.
References unit::experience_, and unit::max_experience_.
|
inline |
The number of experience points this unit needs to level up, or 0 if current XP > max XP.
Definition at line 542 of file unit.hpp.
References unit::experience_, and unit::max_experience_.
Referenced by gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), and unit::xp_color().
|
inline |
The gender of this unit.
Definition at line 466 of file unit.hpp.
References unit::gender_.
Referenced by unit::create(), gui2::dialogs::unit_recall::dismiss_unit(), unit_filter_impl::unit_filter_compound::fill(), wfl::unit_callable::get_value(), unit::init(), gui2::unit_preview_pane::set_displayed_unit(), unit_alignment(), and unit_race().
|
inline |
Gets whether this unit is currently hidden on the map.
Hidden units are not drawn on the main map or the minimap. They are an implementation detail. For the [hides] ability, see invisible().
Definition at line 721 of file unit.hpp.
References unit::hidden_.
Referenced by wfl::unit_callable::get_value(), unit_drawer::redraw_unit(), events::mouse_handler::select_hex(), and events::mouse_handler::touch_action().
|
static |
Convert a string status effect ID to a built-in status effect ID.
Definition at line 1356 of file unit.cpp.
References i, unit::known_boolean_state_names_, and unit::STATE_UNKNOWN.
Referenced by unit::get_state(), and unit::set_state().
|
inline |
Gets this unit's role.
A role is a special string flag usually used to represent a unit's purpose in a scenario. It can be filtered on.
Definition at line 670 of file unit.hpp.
References unit::role_.
Referenced by wfl::unit_callable::get_value().
bool unit::get_state | ( | const std::string & | state | ) | const |
Check if the unit is affected by a status effect.
state | The status effect to check |
Definition at line 1328 of file unit.cpp.
References unit::get_known_boolean_state_id(), unit::STATE_UNKNOWN, and unit::states_.
Referenced by unit::add_modification(), pathfind::full_cost_map::add_unit(), unit::advance_to(), attack_info(), battle_context_unit_stats::battle_context_unit_stats(), actions::shroud_clearer::clear_unit(), unit::end_turn(), ai::ai_default_rca::get_healing_phase::evaluate(), unit::get_states(), wfl::unit_callable::get_value(), impl_unit_status_get(), unit::incapacitated(), unit::invisible(), unit::jamming_cost(), pathfind::jamming_path::jamming_path(), unit::movement_cost(), pathfind::paths::paths(), unit::poisoned(), gui2::dialogs::unit_list::pre_show(), unit::slowed(), unit_status(), unit::vision_cost(), and pathfind::vision_path::vision_path().
bool unit::get_state | ( | state_t | state | ) | const |
Check if the unit is affected by a status effect.
state | The status effect to check |
Definition at line 1351 of file unit.cpp.
References unit::known_boolean_states_.
const std::set< std::string > unit::get_states | ( | ) | const |
Get the status effects currently affecting the unit.
Definition at line 1311 of file unit.cpp.
References unit::get_state(), unit::known_boolean_state_names_, and unit::states_.
Referenced by wfl::unit_callable::get_value(), and unit::write().
void unit::heal | ( | int | amount | ) |
Heal the unit.
amount | The number of hitpoints to gain |
Definition at line 1295 of file unit.cpp.
References unit::hit_points_, and unit::max_hitpoints().
|
inline |
Fully heal the unit, restoring it to max hitpoints.
Definition at line 832 of file unit.hpp.
References unit::hit_points_, and unit::max_hitpoints().
Referenced by unit::apply_builtin_effect(), and unit::new_scenario().
|
inline |
The current number of hitpoints this unit has.
Definition at line 500 of file unit.hpp.
References unit::hit_points_.
Referenced by gui2::dialogs::add_unit_entry(), attack_info(), battle_context_unit_stats::battle_context_unit_stats(), ai::ai_default_rca::move_to_targets_phase::choose_move(), ai::default_recruitment::recruitment::do_combat_analysis(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), ai::ai_default_rca::get_healing_phase::evaluate(), ai::ai_default_rca::get_villages_phase::find_villages(), ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), unit::hp_color(), ai::readonly_context_impl::power_projection(), gui2::dialogs::unit_list::pre_show(), ai::ai_default_rca::move_to_targets_phase::rate_group(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_displayed_unit(), unit_display::unit_attack(), and unit_hp().
|
inline |
Whether the unit has been instructed to hold its position.
This excludes it from the unit cycling function.
Definition at line 752 of file unit.hpp.
References unit::hold_position_.
|
inline |
The factor by which the HP bar should be scaled.
Definition at line 733 of file unit.hpp.
References unit::hp_bar_scaling_.
|
inline |
Gets this unit's id.
This is a unique string usually set by WML. It should not be used for internal tracking in the unit_map. Use underlying_id for that.
Definition at line 381 of file unit.hpp.
References unit::id_.
Referenced by unit::ability_affects_adjacent(), display::add_exclusive_draw(), gui2::dialogs::add_unit_entry(), wb::attack::apply_temp_modifier(), wb::move::apply_temp_modifier(), wb::manager::create_temp_move(), gui2::dialogs::unit_recall::dismiss_unit(), ai::ai_default_rca::get_healing_phase::evaluate(), unit_filter_impl::unit_filter_compound::fill(), wb::find_backup_leader(), actions::find_recall_location(), wfl::unit_callable::get_value(), impl_unit_tostring(), unit::init(), wb::move::init(), game_lua_kernel::intf_erase_unit(), game_lua_kernel::intf_match_unit(), unit::invisible(), wb::move::modify_unit(), events::menu_handler::recall(), wb::attack::remove_temp_modifier(), wb::move::remove_temp_modifier(), REPORT_GENERATOR(), unit::set_id(), and editor::map_context::to_config().
|
inline |
Check if the unit has been petrified.
Definition at line 906 of file unit.hpp.
References unit::get_state(), and unit::STATE_PETRIFIED.
Referenced by unit::attacks_left(), wfl::attack_map_callable::collect_possible_attacks(), ai::default_recruitment::recruitment::do_combat_analysis(), unit::emits_zoc(), ai::default_recruitment::recruitment::get_cost_map_of_side(), ai::move_result::get_unit(), ai::stopunit_result::get_unit(), ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), unit::movement_left(), unit_drawer::redraw_unit(), unit_animation_component::refresh(), unit_animation_component::set_selecting(), unit_animation_component::set_standing(), events::mouse_handler::show_attack_options(), ai::default_recruitment::recruitment::update_own_units_count(), and display_context::would_be_discovered().
|
inline |
The current level of this unit.
Definition at line 560 of file unit.hpp.
References unit::level_.
Referenced by gui2::dialogs::add_unit_entry(), gui2::dialogs::unit_recall::dismiss_unit(), wfl::unit_callable::get_value(), unit::upkeep_value_visitor::operator()(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::unit_recall::rename_unit(), gui2::unit_preview_pane::set_displayed_unit(), unit::set_level(), unit_level(), and unit_helper::unit_level_tooltip().
|
inline |
The max number of experience points this unit can have.
Definition at line 530 of file unit.hpp.
References unit::max_experience_.
Referenced by gui2::dialogs::add_unit_entry(), unit::advances(), gui2::dialogs::unit_recall::dismiss_unit(), wfl::unit_callable::get_value(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_displayed_unit(), and unit_xp().
|
inline |
The max number of hitpoints this unit can have.
Definition at line 506 of file unit.hpp.
References unit::max_hit_points_.
Referenced by gui2::dialogs::add_unit_entry(), attack_info(), battle_context_unit_stats::battle_context_unit_stats(), ai::ai_default_rca::get_healing_phase::evaluate(), ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), unit::heal(), unit::heal_fully(), unit::hp_color(), ai::readonly_context_impl::power_projection(), gui2::dialogs::unit_list::pre_show(), ai::ai_default_rca::move_to_targets_phase::rate_group(), unit_drawer::redraw_unit(), gui2::unit_preview_pane::set_displayed_unit(), and unit_hp().
|
inline |
Gets this unit's translatable display name.
Definition at line 404 of file unit.hpp.
References unit::name_.
Referenced by unit::add_trait_description(), wb::attack::apply_temp_modifier(), wb::move::apply_temp_modifier(), unit_filter_impl::unit_filter_compound::fill(), wfl::unit_callable::get_value(), unit_map::insert(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), events::menu_handler::recall(), wb::attack::remove_temp_modifier(), wb::move::remove_temp_modifier(), unit::rename(), gui2::dialogs::unit_recall::rename_unit(), gui2::unit_preview_pane::set_displayed_unit(), unit::set_name(), editor::map_context::to_config(), and unit_name().
void unit::new_scenario | ( | ) |
Refresh unit for the beginning of a new scenario.
Definition at line 1280 of file unit.cpp.
References unit::expire_modifications(), unit::goto_, unit::heal_fully(), unit::set_state(), unit::STATE_GUARDIAN, unit::STATE_PETRIFIED, unit::STATE_POISONED, and unit::STATE_SLOWED.
void unit::new_turn | ( | ) |
Refresh unit for the beginning of a turn.
Definition at line 1256 of file unit.cpp.
References unit::attacks_left_, unit::end_turn_, unit::expire_modifications(), unit::hold_position_, unit::max_attacks_, unit::movement_, unit::set_state(), unit::STATE_UNCOVERED, and unit::total_movement().
|
inline |
Check if the unit has been poisoned.
Definition at line 897 of file unit.hpp.
References unit::get_state(), and unit::STATE_POISONED.
Referenced by unit_drawer::redraw_unit().
|
inline |
Gets this unit's race.
Definition at line 494 of file unit.hpp.
References unit::race_.
Referenced by unit_filter_impl::unit_filter_compound::fill(), wfl::unit_callable::get_value(), gui2::unit_preview_pane::set_displayed_unit(), and unit_race().
|
inline |
How much gold it costs to recall this unit, or -1 if the side's default recall cost is used.
Definition at line 641 of file unit.hpp.
References unit::recall_cost_.
Referenced by unit::apply_builtin_effect(), wb::recall::draw_hex(), gui2::dialogs::unit_recall::pre_show(), and unit::set_recall_cost().
|
inline |
Gets the filter constraints upon which units this unit may recall, if able.
Definition at line 653 of file unit.hpp.
References unit::filter_recall_.
Referenced by wb::recall::check_validity().
|
inline |
The type IDs of the other units this unit may recruit, if possible.
Definition at line 625 of file unit.hpp.
References unit::recruit_list_.
Referenced by wb::recruit::check_validity(), wfl::unit_callable::get_value(), and unit::set_recruits().
|
inline |
Attempts to rename this unit's translatable display name, taking the 'unrenamable' flag into account.
If a direct rename is desired, use set_name.
Definition at line 425 of file unit.hpp.
References unit::name(), unit::name_, and unit::unrenamable_.
Referenced by gui2::dialogs::unit_recall::rename_unit().
|
inline |
Sets the alignment of this unit.
Definition at line 482 of file unit.hpp.
References unit::alignment(), unit::alignment_, unit::set_attr_changed(), and unit::UA_ALIGNMENT.
Referenced by unit::apply_builtin_effect().
void unit::set_big_profile | ( | const std::string & | value | ) |
Definition at line 1940 of file unit.cpp.
References adjust_profile(), unit::profile_, unit::set_attr_changed(), and unit::UA_PROFILE.
Referenced by unit::apply_builtin_effect(), and unit::init().
|
inline |
Sets whether this unit can recruit other units.
Definition at line 619 of file unit.hpp.
References unit::canrecruit_.
|
inline |
Sets the current experience point amount.
Definition at line 554 of file unit.hpp.
References unit::experience_.
void unit::set_hidden | ( | bool | state | ) | const |
Sets whether the unit is hidden on the map.
Definition at line 2793 of file unit.cpp.
References unit::anim_comp_, and unit::hidden_.
Referenced by wb::temporary_unit_hider::temporary_unit_hider(), and wb::temporary_unit_hider::~temporary_unit_hider().
|
inline |
Sets the current hitpoint amount.
Definition at line 518 of file unit.hpp.
References unit::hit_points_.
|
inline |
Sets this unit's string ID.
Definition at line 387 of file unit.hpp.
References unit::id(), and unit::id_.
|
inline |
Sets the current level of this unit.
Definition at line 566 of file unit.hpp.
References unit::level(), unit::level_, unit::set_attr_changed(), and unit::UA_LEVEL.
Referenced by unit::init().
|
inline |
Definition at line 535 of file unit.hpp.
References unit::max_experience_, unit::set_attr_changed(), and unit::UA_MAX_XP.
Referenced by unit::apply_builtin_effect(), and unit::init().
|
inline |
Definition at line 511 of file unit.hpp.
References unit::max_hit_points_, unit::set_attr_changed(), and unit::UA_MAX_HP.
Referenced by unit::apply_builtin_effect(), and unit::init().
|
inline |
Sets this unit's translatable display name.
This should only be used internally since it ignores the 'unrenamable' flag.
Definition at line 414 of file unit.hpp.
References unit::name(), and unit::name_.
|
inline |
Sets the cost of recalling this unit.
Definition at line 647 of file unit.hpp.
References unit::recall_cost(), and unit::recall_cost_.
|
inline |
Sets the filter constraints upon which units this unit may recall, if able.
Definition at line 659 of file unit.hpp.
References unit::filter_recall_.
void unit::set_recruits | ( | const std::vector< std::string > & | recruits | ) |
Sets the recruit list.
Definition at line 1165 of file unit.cpp.
References unit_type_data::check_types(), unit::recruit_list_, unit::recruits(), and unit_types.
Referenced by unit::init().
|
inline |
|
inline |
Sets the side this unit belongs to.
Definition at line 350 of file unit.hpp.
References unit::side_.
|
inline |
Definition at line 597 of file unit.hpp.
References unit::set_attr_changed(), unit::small_profile_, and unit::UA_SMALL_PROFILE.
Referenced by unit::apply_builtin_effect(), and unit::init().
void unit::set_state | ( | const std::string & | state, |
bool | value | ||
) |
Set whether the unit is affected by a status effect.
state | The status effect to change |
value | Whether the unit should be affected by the status |
Definition at line 1377 of file unit.cpp.
References unit::appearance_changed_, unit::get_known_boolean_state_id(), unit::STATE_UNKNOWN, and unit::states_.
Referenced by unit::add_modification(), unit::advance_to(), unit::apply_builtin_effect(), unit::end_turn(), impl_unit_status_set(), unit::init(), unit::new_scenario(), unit::new_turn(), and unit::remove_movement_ai().
void unit::set_state | ( | state_t | state, |
bool | value | ||
) |
Set whether the unit is affected by a status effect.
state | The status effect to change |
value | Whether the unit should be affected by the status |
Definition at line 1346 of file unit.cpp.
References unit::known_boolean_states_.
|
inline |
The ID of the undead variation (ie, dwarf, swimmer) of this unit.
Definition at line 579 of file unit.hpp.
References unit::set_attr_changed(), unit::UA_UNDEAD_VARIATION, and unit::undead_variation_.
Referenced by unit::init().
|
private |
Sets the internal ID.
Definition at line 2680 of file unit.cpp.
References resources::gamedata, unit::id_, game_data::INITIAL, synced_context::is_synced(), n_unit::id_manager::next_fake_id(), n_unit::id_manager::next_id(), unit::type_id(), unit::underlying_id_, and n_unit::unit_id::value.
Referenced by unit::init(), and unit::mark_clone().
|
inline |
A detailed description of this unit.
Definition at line 457 of file unit.hpp.
References unit::description_.
|
inline |
Sets the 'unrenamable' flag.
Usually used for scenario-specific units which should not be renamed.
Definition at line 445 of file unit.hpp.
References unit::unrenamable(), and unit::unrenamable_.
|
inline |
Sets this unit's usage.
Definition at line 693 of file unit.hpp.
References unit::usage(), and unit::usage_.
Referenced by unit::advance_to(), and unit::init().
|
inline |
Set whether the user ended their turn.
Definition at line 772 of file unit.hpp.
References unit::end_turn_.
|
inline |
The side this unit belongs to.
Note that side numbers starts from 1, not 0, so be sure to subtract 1 if using as a container index.
Definition at line 344 of file unit.hpp.
References unit::side_.
Referenced by unit::ability_active(), actions::actor_sighted(), gui2::dialogs::add_unit_entry(), attack_info(), game_state::can_recruit_from(), game_state::can_recruit_on(), can_see(), actions::shroud_clearer::clear_dest(), actions::shroud_clearer::clear_unit(), wfl::attack_map_callable::collect_possible_attacks(), pathfind::shortest_path_calculator::cost(), unit::create(), wb::manager::create_temp_move(), gui2::dialogs::unit_recall::dismiss_unit(), ai::recall_result::do_check_after(), ai::recruit_result::do_check_after(), ai::default_recruitment::recruitment::do_combat_analysis(), game_display::draw_hex(), pathfind::enemy_zoc(), ai::ai_default_rca::get_healing_phase::evaluate(), events::menu_handler::execute_gotos(), wfl::set_unit_var_callable::execute_self(), wb::find_actions_of(), pathfind::find_routes(), pathfind::find_vacant_castle(), wb::future_visible_unit(), unit::get_abilities(), unit::get_ability_bool(), unit::get_adj_ability_bool(), ai::default_recruitment::recruitment::get_cost_map_of_side(), ai::move_result::get_unit(), ai::stopunit_result::get_unit(), ai::default_recruitment::recruitment::get_unit_ratio(), wfl::unit_callable::get_value(), unit::halo_or_icon_abilities(), unit::init(), game_lua_kernel::intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_find_vision_range(), ai::ai_default_rca::aspect_attacks::is_allowed_attacker(), ai::ai_default_rca::aspect_attacks::is_allowed_enemy(), unit::is_visible_to_team(), luaW_pushfaivariant(), pathfind::mark_route(), events::mouse_handler::move_action(), wb::path_cost(), unit_creator::post_create(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), unit_drawer::redraw_unit(), events::mouse_handler::select_hex(), events::mouse_handler::show_attack_options(), attack_type::special_active_impl(), unit::TC_image_mods(), pathfind::teleport_map::teleport_map(), editor::map_context::to_config(), display_context::unit_can_move(), unit_moves(), unit_side(), ai::default_recruitment::recruitment::update_important_hexes(), ai::default_recruitment::recruitment::update_own_units_count(), pathfind::vision_path::vision_path(), and display_context::would_be_discovered().
|
inline |
Check if the unit has been slowed.
Definition at line 915 of file unit.hpp.
References unit::get_state(), and unit::STATE_SLOWED.
Referenced by unit_drawer::redraw_unit().
std::string unit::small_profile | ( | ) | const |
An optional profile image to display in Help.
Definition at line 1038 of file unit.cpp.
References unit::absolute_image(), unit::profile_, and unit::small_profile_.
Referenced by REPORT_GENERATOR().
|
inline |
Damage the unit.
Definition at line 817 of file unit.hpp.
References unit::hit_points_.
Referenced by unit_display::unit_attack().
|
inline |
Toggle the unit's hold position status.
Definition at line 760 of file unit.hpp.
References unit::end_turn_, and unit::hold_position_.
|
inline |
Toggle whether the user ended their turn.
Definition at line 781 of file unit.hpp.
References unit::end_turn_, and unit::hold_position_.
|
inline |
This unit's type, accounting for gender and variation.
Definition at line 356 of file unit.hpp.
References unit::type_.
Referenced by unit::absolute_image(), unit::advance_to(), unit::advances_to_translated(), unit::apply_builtin_effect(), battle_context_unit_stats::battle_context_unit_stats(), unit::default_anim_image(), unit::expire_modifications(), unit_filter_impl::unit_filter_compound::fill(), unit::generate_traits(), gui2::dialogs::unit_advance::pre_show(), statistics_t::recruit_unit(), gui2::unit_preview_pane::set_displayed_unit(), help::show_unit_description(), statistics_t::un_recruit_unit(), actions::undo::recruit_action::undo(), unit_defense(), unit_type(), and unit::write().
const std::string & unit::type_id | ( | ) | const |
The id of this unit's type.
If you are dealing with creating units (e.g. recruitment), this is not what you want, as a variation can change this; use type().parent_id() instead.
Definition at line 1935 of file unit.cpp.
References unit_type::id(), and unit::type_.
Referenced by gui2::dialogs::add_unit_entry(), statistics_t::advance_unit(), events::mouse_handler::attack_enemy_(), ai::default_recruitment::recruitment::do_combat_analysis(), unit_filter_impl::unit_filter_compound::fill(), wfl::unit_callable::get_value(), impl_unit_tostring(), unit_creator::post_create(), statistics_t::recall_unit(), unit::set_underlying_id(), editor::map_context::to_config(), statistics_t::un_recall_unit(), unit_defense(), unit_type(), ai::default_recruitment::recruitment::update_own_units_count(), and unit::write().
|
inline |
Gets the translatable name of this unit's type.
Definition at line 370 of file unit.hpp.
References unit::type_name_.
Referenced by gui2::dialogs::faction_select::on_faction_select(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::unit_recall::rename_unit(), gui2::unit_preview_pane::set_displayed_unit(), and unit_type().
|
inline |
Definition at line 584 of file unit.hpp.
References unit::undead_variation_.
Referenced by battle_context_unit_stats::battle_context_unit_stats().
|
inline |
This unit's unique internal ID.
This should not be used for user-facing operations.
Definition at line 393 of file unit.hpp.
References unit::underlying_id_, and n_unit::unit_id::value.
Referenced by wb::side_actions::actions_of(), ai::call_lua_filter_fcn(), actions::shroud_clearer::clear_dest(), actions::shroud_clearer::clear_unit(), wb::side_actions::count_actions_of(), wb::manager::create_temp_move(), wfl::unit_callable::do_compare(), wb::side_actions::find_first_action_of(), wb::side_actions::find_last_action_of(), impl_unit_equality(), luaW_pushfaivariant(), wb::move::modify_unit(), actions::shroud_clearer::record_sighting(), and wb::side_actions::unit_has_actions().
|
inline |
A detailed description of this unit.
Definition at line 451 of file unit.hpp.
References unit::description_.
Referenced by unit_type().
std::vector< t_string > unit::unit_special_notes | ( | ) | const |
The unit's special notes.
Definition at line 2840 of file unit.cpp.
References unit::abilities(), unit::attacks(), combine_special_notes(), unit::movement_type(), and unit::special_notes_.
Referenced by unit_type().
|
inline |
Whether this unit can be renamed.
This flag is considered by rename, but not set_name.
Definition at line 437 of file unit.hpp.
References unit::unrenamable_.
Referenced by gui2::dialogs::unit_recall::list_item_clicked(), unit::set_unrenamable(), and editor::map_context::to_config().
|
inline |
Gets this unit's usage.
This is relevant to the AI.
Usage refers to how the AI may consider utilizing this unit in combat.
Definition at line 687 of file unit.hpp.
References unit::usage_.
Referenced by wfl::unit_callable::get_value(), and unit::set_usage().
|
inline |
Check whether the user ended their turn.
Definition at line 793 of file unit.hpp.
References unit::end_turn_.
Referenced by display_context::unit_orb_status().
|
inline |
Gets any user-defined variables this unit 'owns'.
These are accessible via WML if the unit's data is serialized to a variable. They're strictly user-facing; internal engine calculations shouldn't use this.
Definition at line 704 of file unit.hpp.
References unit::variables_.
Referenced by wfl::unit_callable::get_value(), impl_unit_variables_get(), impl_unit_variables_set(), and unit::init().
|
inline |
|
inline |
The ID of the variation of this unit's type.
Definition at line 573 of file unit.hpp.
References unit::variation_.
Referenced by unit::create(), unit_filter_impl::unit_filter_compound::fill(), wfl::unit_callable::get_value(), and unit::init().
|
inline |
The factor by which the XP bar should be scaled.
Definition at line 742 of file unit.hpp.
References unit::xp_bar_scaling_.