Functions | |
config & | unit::get_modifications () |
Get the raw modifications. More... | |
const config & | unit::get_modifications () const |
Set the raw modifications. More... | |
std::size_t | unit::modification_count (const std::string &type, const std::string &id) const |
Count modifications of a particular type. More... | |
std::size_t | unit::modification_count (const std::string &type) const |
Count modifications of a particular type. More... | |
std::size_t | unit::traits_count () const |
std::size_t | unit::objects_count () const |
std::size_t | unit::advancements_count () const |
void | unit::add_modification (const std::string &type, const config &modification, bool no_add=false) |
Add a new modification to the unit. More... | |
void | unit::expire_modifications (const std::string &duration) |
Clears those modifications whose duration has expired. More... | |
void | unit::apply_builtin_effect (const std::string &type, const config &effect) |
Apply a builtin effect to the unit. More... | |
std::string | unit::describe_builtin_effect (const std::string &type, const config &effect) |
Construct a string describing a built-in effect. More... | |
void | unit::apply_modifications () |
Re-apply all saved modifications. More... | |
Variables | |
static const std::set< std::string > | unit::builtin_effects |
void unit::add_modification | ( | const std::string & | type, |
const config & | modification, | ||
bool | no_add = false |
||
) |
Add a new modification to the unit.
type | The type of modification to add. Valid values are "advancement", "trait", "object" |
modification | The details of the modification |
no_add | If true, apply the modification but don't save it for unit rebuild time. Defaults to false. |
Definition at line 2440 of file unit.cpp.
References config::add_child(), unit::add_trait_description(), unit::apply_builtin_effect(), game_lua_kernel::apply_effect(), unit::builtin_effects, config::child_range(), unit::describe_builtin_effect(), t_string::empty(), resources::filter_con, unit::level_, unit::loc_, resources::lua_kernel, unit::modifications_, config::remove_children(), VGETTEXT, and WRN_UT.
Referenced by unit::apply_modifications(), unit::init(), and intf_add_modification().
|
inline |
Definition at line 1564 of file unit.hpp.
References unit::modification_count().
Referenced by wfl::unit_callable::get_value().
void unit::apply_builtin_effect | ( | const std::string & | type, |
const config & | effect | ||
) |
Apply a builtin effect to the unit.
type | The effect to apply. Must be one of the effects in builtin_effects. |
effect | The details of the effect |
Definition at line 2036 of file unit.cpp.
References unit::abilities_, config::add_child(), game_config::add_color_info(), game_events::manager::add_events(), unit::advance_to(), unit::advancements_, unit::advances_to_, unit::anim_comp_, unit::appearance_changed_, config::append(), utils::apply_modifier(), unit::attacks_, c, config::child_range(), deprecated_message(), unit::description_, movetype::effects, unit::emit_zoc_, prefs::encountered_units(), utils::erase(), utils::erase_if(), unit::experience_, unit_type_data::find(), utils::find(), resources::game_events, resources::gameboard, unit::gender_, prefs::get(), config::get(), string_enums::enum_base< Definition >::get_enum(), unit_type::get_gender_unit_type(), game_board::get_team(), unit::has_ability_by_id(), config::has_child(), unit_type::has_variation(), unit::heal_fully(), unit::hit_points_, i, unit::image_mods_, INDEFINITE, unit::is_fearless_, unit::is_healthy_, unit::jamming_, unit::level_, LOG_UT, resources::lua_kernel, unit::max_attacks_, unit::max_experience_, unit::max_hit_points_, unit::max_movement_, movetype::merge(), unit::movement_, unit::movement_type_, config::optional_child(), unit::overlays_, unit_type::parent_id(), utils::parenthetical_split(), team::recall_cost(), unit::recall_cost(), unit::recall_cost_, gui2::dialogs::tip::remove(), unit::remove_ability_by_attribute(), unit::remove_ability_by_id(), cursor::set(), unit::set_alignment(), unit::set_attr_changed(), unit::set_big_profile(), unit::set_image_ellipse(), unit::set_image_halo(), unit::set_max_attacks(), unit::set_max_experience(), unit::set_max_hitpoints(), unit::set_small_profile(), unit::set_state(), unit::set_total_movement(), unit::side_, unit::special_notes_, utils::split(), unit::upkeep_loyal::type(), unit::type(), unit::UA_ABILITIES, unit::UA_ADVANCEMENTS, unit::UA_ATTACKS, unit::UA_IS_FEARLESS, unit::UA_IS_HEALTHY, unit::UA_LEVEL, unit::UA_MOVEMENT_TYPE, unit::UA_ZOC, unit_types, unit::upkeep_, unit::variation_, unit::vision_, game_config_view::wrap(), and WRN_UT.
Referenced by unit::add_modification(), and game_lua_kernel::cfun_builtin_effect().
void unit::apply_modifications | ( | ) |
Re-apply all saved modifications.
Definition at line 2567 of file unit.cpp.
References unit::add_modification(), config::all_children_view(), config::clear_children(), deprecated_message(), config::has_child(), log_scope, unit::modifications_, PREEMPTIVE, and unit::variables_.
Referenced by unit::advance_to().
std::string unit::describe_builtin_effect | ( | const std::string & | type, |
const config & | effect | ||
) |
Construct a string describing a built-in effect.
type | The effect to describe. Must be one of the effects in builtin_effects. |
effect | The details of the effect |
Definition at line 1971 of file unit.cpp.
References unit::attacks_, utils::format_conjunct_list(), utils::print_modifier(), utils::stoi(), VGETTEXT, and VNGETTEXT.
Referenced by unit::add_modification(), and game_lua_kernel::cfun_builtin_effect().
void unit::expire_modifications | ( | const std::string & | duration | ) |
Clears those modifications whose duration has expired.
duration | If empty, all temporary modifications (those not lasting forever) expire. Otherwise, modifications whose duration equals duration expire. |
Definition at line 1282 of file unit.cpp.
References unit::advance_to(), unit::anim_comp_, config::child_count(), config::get(), get_unit_type(), config::mandatory_child(), mod_duration_match(), unit::modifications_, config::remove_child(), and unit::type().
Referenced by unit::end_turn(), intf_remove_modifications(), unit::new_scenario(), and unit::new_turn().
|
inline |
Get the raw modifications.
Definition at line 1526 of file unit.hpp.
References unit::modifications_.
Referenced by intf_remove_modifications(), and gui2::dialogs::unit_advance::pre_show().
|
inline |
Set the raw modifications.
Definition at line 1532 of file unit.hpp.
References unit::modifications_.
std::size_t unit::modification_count | ( | const std::string & | type | ) | const |
Count modifications of a particular type.
type | The type of modification to count. Valid values are "advancement", "trait", "object" |
Definition at line 952 of file unit.cpp.
References config::child_range(), unit::modification_count(), unit::modifications_, and unit::type().
std::size_t unit::modification_count | ( | const std::string & | type, |
const std::string & | id | ||
) | const |
Count modifications of a particular type.
type | The type of modification to count. Valid values are "advancement", "trait", "object" |
id | The ID of the modification to count |
Definition at line 1945 of file unit.cpp.
References config::child_range(), and unit::modifications_.
Referenced by unit::advancements_count(), unit::amla_icons(), unit::get_modification_advances(), unit::modification_count(), unit::objects_count(), and unit::traits_count().
|
inline |
Definition at line 1559 of file unit.hpp.
References unit::modification_count().
Referenced by wfl::unit_callable::get_value().
|
inline |
Definition at line 1554 of file unit.hpp.
References unit::modification_count().
Referenced by wfl::unit_callable::get_value().
|
static |
Definition at line 1587 of file unit.hpp.
Referenced by unit::add_modification(), and game_lua_kernel::game_lua_kernel().