59 explicit unit_type(
const config &cfg,
const std::string & parent_id=
"");
85 static void check_id(std::string&
id);
108 {
const_cast<unit_type *
>(
this)->
build(status, movement_types, races, traits); }
144 const std::string&
id()
const {
return id_; }
186 const std::vector<unit_animation>&
animations()
const;
188 const std::string&
flag_rgb()
const;
396 const unit_type_map &
types()
const {
return types_; }
403 void check_types(
const std::vector<std::string>& types)
const;
404 const unit_race *find_race(
const std::string &)
const;
412 bool hide_help(
const std::string &type_id,
const std::string &
race_id)
const;
418 void read_hide_help(
const config &cfg);
422 void apply_base_unit(
unit_type&
type, std::vector<std::string>& base_tree);
446 static int get_acceleration();
std::vector< attack_ptr > attack_list
std::string parent_id_
The id of the top ancestor of this unit_type.
const std::string & parent_id() const
The id of the original type from which this (variation) descended.
unit_type::BUILD_STATUS build_status_
std::map< std::string, unit_type > unit_type_map
int vision(bool base_value) const
If base_value is set to true, do not fall back to movement().
std::string default_variation_
bool generate_name() const
config_array_view traits() const
void build(BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
Performs a build of this to the indicated stage.
config::const_child_itors events() const
const std::string & big_profile() const
std::string debug_id_
A suffix for id_, used when logging messages.
const std::vector< std::string > & advances_to() const
A vector of unit_type ids that this unit_type can advance to.
std::string variation_id_
const std::string & flag_rgb() const
child_itors child_range(config_key_type key)
void adjust_profile(std::string &profile)
void clear(const std::string &key)
void fill_variations()
Processes [variation] tags of ut_cfg, handling inheritance and child clearing.
int experience_needed(bool with_acceleration=true) const
std::array< std::unique_ptr< unit_type >, 2 > gender_types_
void build_help_index(const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
Partially load data into an empty unit_type (build to HELP_INDEXED).
int resistance_against(const std::string &damage_name, bool attacker) const
Gets resistance while considering custom WML abilities.
const config & get_cfg() const
BUILD_STATUS
Records the status of the lazy building of unit types.
std::set< std::string > advancement_tree() const
Get the advancement tree.
const std::string & variation_id() const
The id of this variation; empty if it's a gender variation or a base unit.
variations_map variations_
const race_map & races() const
The basic "size" of the unit - flying, small land, large land, etc.
void build(BUILD_STATUS status, const movement_type_map &movement_types, const race_map &races, const config_array_view &traits) const
Performs a build of this to the indicated stage.
const unit_type_map & types() const
const std::vector< std::string > advances_from() const
A vector of unit_type ids that can advance to this unit_type.
A single unit type that the player may recruit.
const unit_race * race_
Never nullptr, but may point to the null race.
std::vector< t_string > combine_special_notes(const std::vector< t_string > direct, const config &abilities, const_attack_itors attacks, const movetype &mt)
Common logic for unit_type::special_notes() and unit::special_notes().
void build_full(const movement_type_map &movement_types, const race_map &races, const config_array_view &traits)
Load data into an empty unit_type (build to FULL).
bool musthave_status(const std::string &status) const
const std::vector< unit_race::GENDER > & genders() const
The returned vector will not be empty, provided this has been built to the HELP_INDEXED status...
unit_alignments::type alignment_
void fill_variations_and_gender()
movement_type_map movement_types_
const movetype & movement_type() const
unit_alignments::type alignment() const
const std::vector< unit_animation > & animations() const
const t_string & type_name() const
The name of the unit in the current language setting.
std::vector< std::set< std::string > > hide_help_type_
std::vector< std::set< std::string > > hide_help_race_
const std::string & usage() const
std::vector< unit_animation > animations_
std::string small_profile_
std::string ellipse() const
std::unique_ptr< config > built_cfg_
std::string undead_variation_
void remove_scenario_fixes()
const std::vector< ability_metadata > & abilities_metadata() const
std::string race_id() const
Returns the ID of this type's race without the need to build the type.
const std::string & id() const
The id for this unit_type.
std::map< std::string, movetype > movement_type_map
double xp_bar_scaling() const
boost::iterator_range< const_child_iterator > const_child_itors
const std::string & undead_variation() const
Info on the type of unit that the unit reanimates as.
const std::string log_id() const
A variant on id() that is more descriptive, for use with message logging.
const game_config_view & units_cfg() const
config::const_child_itors modification_advancements() const
Returns two iterators pointing to a range of AMLA configs.
std::vector< t_string > special_notes_
game_config_view units_cfg_
std::vector< std::string > variations() const
std::vector< std::string > get_ability_list() const
friend class unit_type_data
void apply_scenario_fix(const config &cfg)
bool show_variations_in_help() const
Whether the unit type has at least one help-visible variation.
const config & abilities_cfg() const
std::vector< std::string > advances_to_
bool has_ability_by_id(const std::string &ability) const
const std::string & icon() const
bool hide_help_all_
True if [hide_help] contains a 'all=yes' at its root.
std::string base_unit_id_
from [base_unit]
bool has_gender_variation(const unit_race::GENDER gender) const
const std::string & small_profile() const
const std::vector< ability_metadata > & adv_abilities_metadata() const
Some extra abilities that may be gained through AMLA advancements.
std::vector< t_string > special_notes() const
Returns all notes that should be displayed in the help page for this type, including those found in a...
static std::string alignment_description(unit_alignments::type align, unit_race::GENDER gender=unit_race::MALE)
Implementation detail of unit_type::alignment_description.
config::const_child_itors possible_traits() const
const std::string & image() const
std::vector< ability_metadata > abilities_
bool resistance_filter_matches(const config &cfg, bool attacker, const std::string &damage_name, int res) const
Identical to unit::resistance_filter_matches.
unsigned int num_traits() const
BUILD_STATUS build_status_
const unit_type & get_variation(const std::string &id) const
std::vector< std::reference_wrapper< const config > > config_array_view
std::vector< ability_metadata > adv_abilities_
const t_string & variation_name() const
const variations_map & variation_types() const
const unit_race * race() const
Never returns nullptr, but may point to the null race.
const unit_type & get_gender_unit_type(std::string gender) const
Returns a gendered variant of this unit_type.
static void check_id(std::string &id)
Validate the id argument.
double hp_bar_scaling() const
std::vector< t_string > direct_special_notes() const
Returns only the notes defined by [unit_type][special_note] tags, excluding any that would be found f...
unit_type & operator=(const unit_type &o)=delete
unit_type_data unit_types
std::unique_ptr< unit_type > create_sub_type(const config &var_cfg, bool default_inherit)
Handles inheritance for configs of [male], [female], and [variation].
const config & child_or_empty(config_key_type key) const
Returns the first child with the given key, or an empty config if there is none.
const_attack_itors attacks() const
std::map< std::string, unit_race > race_map
boost::iterator_range< boost::indirect_iterator< attack_list::const_iterator > > const_attack_itors
t_string unit_description() const
A config object defines a single node in a WML file, with access to child nodes.
attack_list attacks_cache_
bool has_random_traits() const
bool has_variation(const std::string &variation_id) const
config::const_child_itors advancements() const
std::vector< unit_race::GENDER > genders_
const std::string & default_variation() const
std::map< std::string, unit_type > variations_map
void build_created()
Load the most needed data into an empty unit_type (build to CREATE).