26 #include <boost/dynamic_bitset_fwd.hpp> 42 : student_loc(student_loc)
43 , teacher_loc(teacher_loc)
44 , ability_cfg(ability_cfg)
70 std::pair<int, map_location>
highest(
const std::string& key,
int def=0)
const 72 return get_extremum(key, def, std::less<int>());
74 std::pair<int, map_location>
lowest(
const std::string& key,
int def=0)
const 76 return get_extremum(key, def, std::greater<int>());
79 template<
typename TComp>
80 std::pair<int, map_location> get_extremum(
const std::string& key,
int def,
const TComp& comp)
const;
86 iterator
begin() {
return cfgs_.begin(); }
87 const_iterator
begin()
const {
return cfgs_.begin(); }
88 iterator
end() {
return cfgs_.end(); }
89 const_iterator
end()
const {
return cfgs_.end(); }
92 bool empty()
const {
return cfgs_.empty(); }
98 iterator
erase(
const iterator& erase_it) {
return cfgs_.erase(erase_it); }
99 iterator
erase(
const iterator& first,
const iterator& last) {
return cfgs_.erase(first, last); }
101 template<
typename... T>
109 std::copy(other.
begin(), other.
end(), std::back_inserter(cfgs_ ));
118 template<
typename Predicate>
121 std::copy_if(other.
begin(), other.
end(), std::back_inserter(cfgs_ ), predicate);
133 class unit :
public std::enable_shared_from_this<unit>
140 static void clear_status_caches();
143 static const std::string& leader_crown();
146 void init(
const config& cfg,
bool use_traits =
false,
const vconfig* vcfg =
nullptr);
188 changed_attributes_[int(attr)] =
true;
191 bool get_attacks_changed()
const;
195 return changed_attributes_[int(attr)];
198 void clear_changed_attributes();
205 res->init(cfg, use_traits, vcfg);
217 res->init(t, side, real_unit, gender, variation);
224 return std::shared_ptr<unit>(
new unit(*
this));
231 unit& operator=(
const unit&) =
delete;
239 void advance_to(
const unit_type& t,
bool use_traits =
false);
257 const std::vector<std::string> advances_to_translated()
const;
264 void set_advances_to(
const std::vector<std::string>& advances_to);
277 return !advances_to_.empty() || !get_modification_advances().empty();
288 return experience_ >= max_experience() && can_advance();
302 std::map<std::string, std::string> advancement_icons()
const;
315 std::vector<config> get_modification_advances()
const;
323 std::vector<std::pair<std::string, std::string>> amla_icons()
const;
328 return advancements_;
332 void set_advancements(std::vector<config> advancements);
369 const std::string& type_id()
const;
383 const std::string&
id()
const 397 return underlying_id_.value;
449 unrenamable_ = unrenamable;
461 description_ = new_desc;
465 std::vector<t_string> unit_special_notes()
const;
486 set_attr_changed(UA_ALIGNMENT);
487 alignment_ = alignment;
510 return max_hit_points_;
515 set_attr_changed(UA_MAX_HP);
516 max_hit_points_ = value;
534 return max_experience_;
539 set_attr_changed(UA_MAX_XP);
540 max_experience_ = value;
546 return std::max(0, max_experience_ - experience_);
552 return std::max(0, experience_ - max_experience_);
570 set_attr_changed(UA_LEVEL);
583 set_attr_changed(UA_UNDEAD_VARIATION);
584 undead_variation_ = value;
588 return undead_variation_;
597 std::string small_profile()
const;
601 set_attr_changed(UA_SMALL_PROFILE);
602 small_profile_ = value;
610 std::string big_profile()
const;
612 void set_big_profile(
const std::string& value);
623 canrecruit_ = canrecruit;
629 return recruit_list_;
633 void set_recruits(
const std::vector<std::string>& recruits);
657 return filter_recall_;
663 filter_recall_ = filter;
691 return usage_.value_or(
"");
729 void set_hidden(
bool state)
const;
737 return hp_bar_scaling_;
746 return xp_bar_scaling_;
756 return hold_position_;
764 hold_position_ = !hold_position_;
785 end_turn_ = !end_turn_;
787 hold_position_ =
false;
821 hit_points_ -= damage;
822 return hit_points_ <= 0;
829 void heal(
int amount);
836 hit_points_ = max_hitpoints();
843 const std::set<std::string> get_states()
const;
850 bool get_state(
const std::string& state)
const;
857 void set_state(
const std::string& state,
bool value);
878 void set_state(
state_t state,
bool value);
885 bool get_state(
state_t state)
const;
891 static state_t get_known_boolean_state_id(
const std::string& state);
899 return get_state(STATE_POISONED);
908 return get_state(STATE_PETRIFIED);
917 return get_state(STATE_SLOWED);
944 template<
typename... Args>
947 set_attr_changed(UA_ATTACKS);
948 return *attacks_.emplace(position.base(),
new attack_type(std::forward<Args>(args)...));
961 void remove_attacks_ai();
975 return resistance_against(attack, attacker, loc, weapon);
986 set_attr_changed(UA_MAX_AP);
987 max_attacks_ = value;
997 return (attacks_left_ == 0 || incapacitated()) ? 0 : attacks_left_;
1009 return base_value ? attacks_left_ : attacks_left();
1018 attacks_left_ = std::max<int>(0, left);
1046 return resistance_against(atk.
type(), attacker, loc , weapon, atk.shared_from_this());
1052 return movement_type_.damage_table();
1056 bool resistance_filter_matches(
const config& cfg,
bool attacker,
const std::string& damage_name,
int res)
const;
1077 void generate_traits(
bool must_have_only =
false);
1086 return trait_names_;
1096 return trait_descriptions_;
1104 std::vector<std::string> get_traits_list()
const;
1114 void add_trait_description(
const config& trait,
const t_string& description);
1130 static std::string
type() {
static std::string v =
"full";
return v; }
1135 static std::string
type() {
static std::string v =
"loyal";
return v; }
1138 using upkeep_t = utils::variant<upkeep_full, upkeep_loyal, int>;
1142 #ifdef USING_BOOST_VARIANT
1143 :
public boost::static_visitor<int>
1172 #ifdef USING_BOOST_VARIANT
1173 :
public boost::static_visitor<std::string>
1176 template<
typename T>
1177 std::enable_if_t<!std::is_same_v<int, T>, std::string>
1186 return std::to_string(v);
1192 #ifdef USING_BOOST_VARIANT
1193 :
public boost::static_visitor<upkeep_t>
1197 template<
typename N>
1198 std::enable_if_t<std::is_arithmetic_v<N>,
upkeep_t>
1202 if(n < 0)
throw std::invalid_argument(std::to_string(n));
1203 return static_cast<int>(
n);
1206 template<
typename B>
1207 std::enable_if_t<std::is_convertible_v<B, bool> && !std::is_arithmetic_v<B>,
upkeep_t>
1210 throw std::invalid_argument(b.str());
1220 if(s ==
"loyal" || s ==
"free")
1224 throw std::invalid_argument(s);
1250 return is_fearless_;
1269 return max_movement_;
1274 set_attr_changed(UA_MAX_MP);
1275 max_movement_ = value;
1285 return (movement_ == 0 || incapacitated()) ? 0 : movement_;
1297 return base_value ? movement_ : movement_left();
1310 void set_movement(
int moves,
bool unit_action =
false);
1315 return movement_left() != total_movement();
1319 void remove_movement_ai();
1341 return emit_zoc_ && !incapacitated();
1353 set_attr_changed(UA_ZOC);
1385 return get_goto().valid();
1403 return vision_ < 0 ? max_movement_ : vision_;
1415 return movement_left() > 0 && interrupted_move_.x >= 0 && interrupted_move_.y >= 0;
1421 return interrupted_move_;
1427 interrupted_move_ = interrupted_move;
1433 return movement_type_;
1443 return movement_type_.movement_cost(terrain, get_state(STATE_SLOWED));
1453 return movement_type_.vision_cost(terrain, get_state(STATE_SLOWED));
1463 return movement_type_.jamming_cost(terrain, get_state(STATE_SLOWED));
1469 return movement_type_.is_flying();
1482 return modifications_;
1488 return modifications_;
1498 std::size_t modification_count(
const std::string&
type,
const std::string&
id)
const;
1508 void add_modification(
const std::string& type,
const config& modification,
bool no_add =
false);
1516 void expire_modifications(
const std::string& duration);
1525 void apply_builtin_effect(std::string type,
const config& effect);
1532 std::string describe_builtin_effect(std::string type,
const config& effect);
1535 void apply_modifications();
1551 std::string absolute_image()
const;
1554 std::string default_anim_image()
const;
1559 return halo_.value_or(
"");
1563 void set_image_halo(
const std::string&
halo);
1568 return ellipse_.value_or(
"");
1574 appearance_changed_ =
true;
1581 const std::string&
flag_rgb()
const;
1584 std::string TC_image_mods()
const;
1597 std::string image_mods()
const;
1612 static color_t hp_color_max();
1620 color_t hp_color(
int hitpoints)
const;
1626 static color_t xp_color(
int xp_to_advance,
bool can_advance,
bool has_amla);
1645 bool get_ability_bool(
const std::string& tag_name,
const map_location& loc)
const;
1659 return get_ability_bool(tag_name,
loc_);
1668 bool get_self_ability_bool(
const config& special,
const std::string& tag_name,
const map_location& loc)
const;
1686 bool get_adj_ability_bool(
const config& special,
const std::string& tag_name,
int dir,
const map_location& loc,
const unit& from)
const;
1714 return get_abilities(tag_name,
loc_);
1721 return get_abilities_weapons(tag_name,
loc_, weapon, opp_weapon);
1735 std::vector<std::tuple<std::string, t_string, t_string, t_string>>
1736 ability_tooltips()
const;
1749 std::vector<std::tuple<std::string, t_string, t_string, t_string>>
1750 ability_tooltips(boost::dynamic_bitset<>& active_list,
const map_location& loc)
const;
1753 std::vector<std::string> get_ability_list()
const;
1760 bool has_ability_type(
const std::string& ability)
const;
1767 bool has_ability_by_id(
const std::string& ability)
const;
1773 void remove_ability_by_id(
const std::string& ability);
1778 const std::set<std::string> checking_tags_{
"attacks",
"damage",
"chance_to_hit",
"berserk",
"swarm",
"drains",
"heal_on_hit",
"plague",
"slow",
"petrifies",
"firststrike",
"poison"};
1786 bool ability_active(
const std::string& ability,
const config& cfg,
const map_location& loc)
const;
1796 bool ability_affects_adjacent(
const std::string& ability,
const config& cfg,
int dir,
const map_location& loc,
const unit& from)
const;
1804 bool ability_affects_self(
const std::string& ability,
const config& cfg,
const map_location& loc)
const;
1816 return *formula_man_;
1820 void generate_name();
1823 bool invisible(
const map_location& loc,
bool see_all =
true)
const;
1825 bool is_visible_to_team(
const team&
team,
bool const see_all =
true)
const;
1827 bool is_visible_to_team(
const map_location& loc,
const team& team,
bool const see_all =
true)
const;
1835 void write(
config& cfg,
bool write_all =
true)
const;
1842 unit& mark_clone(
bool is_temporary);
1910 static const std::size_t num_bool_states = 7;
1971 mutable bool appearance_changed_ =
true;
1991 invisibility_cache_.clear();
void set_experience(int xp)
Sets the current experience point amount.
std::vector< attack_ptr > attack_list
bool move_interrupted() const
Check whether the unit's move has been interrupted.
int attacks_left() const
Gets the remaining number of attacks this unit can perform this turn.
const map_location & loc() const
std::vector< t_string > trait_descriptions_
void set_can_recruit(bool canrecruit)
Sets whether this unit can recruit other units.
static unit_ptr create(const unit_type &t, int side, bool real_unit, unit_race::GENDER gender=unit_race::NUM_GENDERS, const std::string &variation="")
Initializes a unit from a unit type.
const unit_ability & back() const
void set_recall_filter(const config &filter)
Sets the filter constraints upon which units this unit may recall, if able.
const config * ability_cfg
The contents of the ability tag, never nullptr.
std::map< std::string, t_string > string_map
int jamming() const
Gets the unit's jamming points.
int vision() const
Gets the unit's vision points.
The unit cannot be healed.
This class represents a single unit of a specific type.
boost::iterator_range< boost::indirect_iterator< attack_list::iterator > > attack_itors
int movement_cost(const t_translation::terrain_code &terrain) const
Get the unit's movement cost on a particular terrain.
std::string small_profile_
The unit is petrified - it cannot move or be attacked.
void set_usage(const std::string &usage)
Sets this unit's usage.
bool is_flying() const
Check if the unit is a flying unit.
const std::string & effect_image_mods() const
Gets any IPF image mods applied by effects.
const std::vector< config > & modification_advancements() const
The raw, unparsed data for modification advancements.
void emplace_back(T &&... args)
iterator erase(const iterator &erase_it)
std::enable_if_t< std::is_convertible_v< B, bool > &&!std::is_arithmetic_v< B >, upkeep_t > operator()(B b) const
Variant for storing WML attributes.
unit_race::GENDER gender_
unit_race::GENDER gender() const
The gender of this unit.
unit_alignments::type alignment_
void rename(const std::string &name)
Attempts to rename this unit's translatable display name, taking the 'unrenamable' flag into account...
const movetype & movement_type() const
Get the unit's movement type.
int hitpoints() const
The current number of hitpoints this unit has.
std::vector< t_string > trait_names_
std::optional< std::string > ellipse_
std::enable_if_t< std::is_arithmetic_v< N >, upkeep_t > operator()(N n) const
void set_user_end_turn(bool value=true)
Set whether the user ended their turn.
config & variables()
Gets any user-defined variables this unit 'owns'.
void set_image_ellipse(const std::string &ellipse)
Set the unit's ellipse image.
void set_small_profile(const std::string &value)
map_location student_loc
Used by the formula in the ability.
unit_ability(const config *ability_cfg, map_location student_loc, map_location teacher_loc)
map_location interrupted_move_
int operator()(const upkeep_loyal &) const
Loyal units cost no upkeep.
unit_checksum_version
Optional parameter for get_checksum to use the algorithm of an older version of Wesnoth, thus preventing spurious OOS warnings while watching old replays.
upkeep_t operator()(utils::monostate) const
const std::string & variation() const
The ID of the variation of this unit's type.
const config & variables() const
Const overload of variables.
The unit is slowed - it moves slower and does less damage.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
std::optional< std::string > usage_
void set_location(const map_location &loc)
Sets this unit's map location.
std::unique_ptr< unit_animation_component > anim_comp_
map_location::DIRECTION facing() const
The current direction this unit is facing within its hex.
The unit is poisoned - it loses health each turn.
bool take_hit(int damage)
Damage the unit.
const std::string & type() const
std::vector< config > advancements_
int resistance_against(const attack_type &atk, bool attacker, const map_location &loc, const_attack_ptr weapon=nullptr) const
The unit's resistance against a given attack.
bool resting() const
Checks whether this unit is 'resting'.
attack_itors make_attack_itors(attack_list &atks)
static std::string type()
The basic "size" of the unit - flying, small land, large land, etc.
std::string image_ellipse() const
Get the unit's ellipse image.
bool get_emit_zoc() const
Gets the raw zone-of-control flag, disregarding incapacitated.
void set_interrupted_move(const map_location &interrupted_move)
Set the target location of the unit's interrupted move.
bool get_hidden() const
Gets whether this unit is currently hidden on the map.
std::vector< unit_ability > cfgs_
std::shared_ptr< unit > unit_ptr
bool is_healthy() const
Gets whether this unit is healthy - ie, always rest heals.
attack_ptr add_attack(attack_itors::iterator position, Args &&... args)
Adds a new attack to the unit.
int cost() const
How much gold is required to recruit this unit.
void set_total_movement(int value)
static unit_ptr create(const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr)
Initializes a unit from a config.
double hp_bar_scaling() const
The factor by which the HP bar should be scaled.
bool get_ability_bool(const std::string &tag_name) const
Checks whether this unit currently possesses or is affected by a given ability.
void set_id(const std::string &id)
Sets this unit's string ID.
A single unit type that the player may recruit.
std::vector< std::string > recruit_list_
std::vector< unit_ability >::iterator iterator
std::enable_if_t<!std::is_same_v< int, T >, std::string > operator()(T &) const
state_t
Built-in status effects known to the engine.
void set_name(const t_string &name)
Sets this unit's translatable display name.
bool hold_position() const
Whether the unit has been instructed to hold its position.
void set_level(int level)
Sets the current level of this unit.
std::bitset< num_bool_states > known_boolean_states_
const unit_type & type() const
This unit's type, accounting for gender and variation.
int vision_cost(const t_translation::terrain_code &terrain) const
Get the unit's vision cost on a particular terrain.
utils::variant< upkeep_full, upkeep_loyal, int > upkeep_t
unsigned int experience_to_advance() const
The number of experience points this unit needs to level up, or 0 if current XP > max XP...
bool poisoned() const
Check if the unit has been poisoned.
std::vector< std::string > overlays_
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
This class stores all the data for a single 'side' (in game nomenclature).
void set_max_attacks(int value)
Data typedef for unit_ability_list.
static std::map< std::string, state_t > known_boolean_state_names_
void clear_visibility_cache() const
Clears the cache.
const std::set< std::string > & checking_tags() const
Included some of the flavortext from weapon specials.
std::vector< t_string > special_notes_
int damage_from(const attack_type &attack, bool attacker, const map_location &loc, const_attack_ptr weapon=nullptr) const
Calculates the damage this unit would take from a certain attack.
struct utils::detail::formula_initer init
const std::string & id() const
Gets this unit's id.
upkeep_t operator()(const std::string &s) const
map_location teacher_loc
The location of the teacher, that is the unit who owns the ability tags (different from student becau...
void swap(unit &lhs, unit &rhs)
Implement non-member swap function for std::swap (calls unit::swap).
unit_ability_list get_abilities(const std::string &tag_name) const
Gets the unit's active abilities of a particular type.
const config & abilities() const
unit_ability_list(const map_location &loc=map_location())
int operator()(int v) const
const unit_ability & front() const
bool get_attr_changed(UNIT_ATTRIBUTE attr) const
std::vector< unit_ability >::const_iterator const_iterator
const config & recall_filter() const
Gets the filter constraints upon which units this unit may recall, if able.
void set_max_experience(int value)
void set_recall_cost(int recall_cost)
Sets the cost of recalling this unit.
const_iterator end() const
void set_alignment(unit_alignments::type alignment)
Sets the alignment of this unit.
upkeep_t upkeep_raw() const
Gets the raw variant controlling the upkeep value.
const t_string & name() const
Gets this unit's translatable display name.
The basic class for representing 8-bit RGB or RGBA colour values.
std::vector< std::string > advances_to_t
utils::string_map_res get_base_resistances() const
Gets resistances without any abilities applied.
int max_experience() const
The max number of experience points this unit can have.
const map_location & get_goto() const
The map location to which this unit is moving over multiple turns, if any.
Object which temporarily resets a unit's movement.
int level() const
The current level of this unit.
std::map< std::string, t_string, res_compare > string_map_res
upkeep_value_visitor(const unit &unit)
unit_ability_list get_abilities_weapons(const std::string &tag_name, const_attack_ptr weapon=nullptr, const_attack_ptr opp_weapon=nullptr) const
const std::vector< t_string > & trait_names() const
Gets the names of the currently registered traits.
std::optional< std::string > halo_
const std::vector< std::string > & overlays() const
Get the unit's overlay images.
const t_string & type_name() const
Gets the translatable name of this unit's type.
The unit is uncovered - it was hiding but has been spotted.
const config & get_modifications() const
Set the raw modifications.
int attacks_left(bool base_value) const
Gets the remaining number of attacks this unit can perform this turn.
void set_hitpoints(int hp)
Sets the current hitpoint amount.
void set_attr_changed(UNIT_ATTRIBUTE attr)
unit_alignments::type alignment() const
The alignment of this unit.
t_string type_name_
The displayed name of this unit type.
Encapsulates the map of the game.
void set_unrenamable(bool unrenamable)
Sets the 'unrenamable' flag.
std::pair< int, map_location > lowest(const std::string &key, int def=0) const
bool user_end_turn() const
Check whether the user ended their turn.
std::set< std::string > states_
const unit_race * race_
Never nullptr, but may point to the null race.
bool has_moved() const
Checks if this unit has moved.
int jamming_cost(const t_translation::terrain_code &terrain) const
Get the unit's jamming cost on a particular terrain.
std::string id
Text to match against addon_info.tags()
unit_animation_component & anim_comp() const
void set_undead_variation(const std::string &value)
The ID of the undead variation (ie, dwarf, swimmer) of this unit.
void set_attacks(int left)
Sets the number of attacks this unit has left this turn.
int max_hitpoints() const
The max number of hitpoints this unit can have.
bool appearance_changed() const
Visitor helper class to fetch the appropriate upkeep value.
const std::string & get_role() const
Gets this unit's role.
static map_location::DIRECTION s
bool advances() const
Checks whether this unit is eligible for level-up.
void set_emit_zoc(bool val)
Sets the raw zone-of-control flag.
bool can_recruit() const
Whether this unit can recruit other units - ie, are they a leader unit.
std::string usage() const
Gets this unit's usage.
attack_itors attacks()
Gets an iterator over this unit's attacks.
int operator()(const upkeep_full &) const
Full upkeep equals the unit's level.
iterator erase(const iterator &first, const iterator &last)
static std::string type()
bool has_goto() const
Gets whether this unit has a multi-turn destination set.
void append(const unit_ability_list &other)
Appends the abilities from other to this, ignores other.loc()
DIRECTION
Valid directions which can be moved in our hexagonal world.
std::vector< std::string > advances_to_
const unit_race * race() const
Gets this unit's race.
std::unique_ptr< unit_formula_manager > formula_man_
void heal_fully()
Fully heal the unit, restoring it to max hitpoints.
n_unit::unit_id underlying_id_
void set_max_hitpoints(int value)
void set_goto(const map_location &new_goto)
Sets this unit's long term destination.
std::map< map_location, bool > invisibility_cache_
Hold the visibility status cache for a unit, when not uncovered.
std::shared_ptr< attack_type > attack_ptr
const_iterator begin() const
const std::vector< std::string > & recruits() const
The type IDs of the other units this unit may recruit, if possible.
double xp_bar_scaling() const
The factor by which the XP bar should be scaled.
std::string undead_variation_
void set_role(const std::string &role)
Sets a unit's role.
const std::string & undead_variation() const
std::string image_halo() const
Get the unit's halo image.
unit_formula_manager & formula_manager() const
Get the unit formula manager.
const_attack_itors attacks() const
Const overload of attacks.
const unit_type * type_
Never nullptr.
void set_appearance_changed(bool value)
static const std::set< std::string > builtin_effects
bool is_fearless() const
Gets whether this unit is fearless - ie, unaffected by time of day.
void toggle_hold_position()
Toggle the unit's hold position status.
unsigned int experience_overflow() const
The number of experience points over max this unit has, or 0 if current XP < max XP.
int experience() const
The current number of experience points this unit has.
const map_location & get_location() const
The current map location this unit is at.
int movement_left(bool base_value) const
Gets how far a unit can move.
void append_if(const unit_ability_list &other, const Predicate &predicate)
Appends any abilities from other for which the given condition returns true to this, ignores other.loc().
void set_upkeep(upkeep_t v)
Sets the upkeep value to a specific value value.
A variable-expanding proxy for the config class.
bool can_advance() const
Checks whether this unit has any options to advance to.
t_string unit_description() const
A detailed description of this unit.
void set_side(unsigned int new_side)
Sets the side this unit belongs to.
std::string get_checksum(const unit &u, backwards_compatibility::unit_checksum_version version=backwards_compatibility::unit_checksum_version::current)
Gets a checksum for a unit.
bool incapacitated() const
Check if the unit has been petrified.
int total_movement() const
The maximum moves this unit has.
MacOS doesn't support std::visit when targing MacOS < 10.14 (currently we target 10.11).
void set_unit_description(const t_string &new_desc)
A detailed description of this unit.
void set_resting(bool rest)
Sets this unit's resting status.
bool emits_zoc() const
Tests whether the unit has a zone-of-control, considering incapacitated.
int side() const
The side this unit belongs to.
std::string operator()(int v) const
Visitor helper class to parse the upkeep value from a config.
boost::iterator_range< boost::indirect_iterator< attack_list::const_iterator > > const_attack_itors
config & get_modifications()
Get the raw modifications.
Visitor helper struct to fetch the upkeep type flag if applicable, or the the value otherwise...
A config object defines a single node in a WML file, with access to child nodes.
bool slowed() const
Check if the unit has been slowed.
std::shared_ptr< const attack_type > const_attack_ptr
void toggle_user_end_turn()
Toggle whether the user ended their turn.
static map_location::DIRECTION n
const advances_to_t & advances_to() const
Gets the possible types this unit can advance to on level-up.
bool unrenamable() const
Whether this unit can be renamed.
int recall_cost() const
How much gold it costs to recall this unit, or -1 if the side's default recall cost is used...
std::string::const_iterator iterator
int movement_left() const
Gets how far a unit can move, considering the incapacitated flag.
std::size_t underlying_id() const
This unit's unique internal ID.
std::bitset< UA_COUNT > changed_attributes_
utils::string_map modification_descriptions_
int max_attacks() const
The maximum number of attacks this unit may perform per turn, usually 1.
std::pair< int, map_location > highest(const std::string &key, int def=0) const
const map_location & get_interrupted_move() const
Get the target location of the unit's interrupted move.
map_location::DIRECTION facing_
const std::vector< t_string > & trait_descriptions() const
Gets the descriptions of the currently registered traits.