44 return std::make_shared<unit_ability_t>(
tag,
cfg, inside_attack);
49 const std::string&
tag()
const {
return tag_; };
50 const std::string&
id()
const {
return id_; };
123 operator bool()
const;
191 std::pair<int, map_location>
highest(
const std::string& key,
int def = 0)
const
195 std::pair<int, map_location>
lowest(
const std::string& key,
int def = 0)
const
200 template<
typename TComp>
201 std::pair<int, map_location>
get_extremum(
const std::string& key,
int def,
const TComp& comp)
const;
223 template<
typename... T>
231 std::copy(other.
begin(), other.
end(), std::back_inserter(
cfgs_));
240 template<
typename Predicate>
243 std::copy_if(other.
begin(), other.
end(), std::back_inserter(
cfgs_), predicate);
276 typedef std::vector<individual_effect>::const_iterator
iterator;
std::vector< ability_ptr > ability_vector
std::vector< active_ability >::iterator iterator
void append_if(const active_ability_list &other, const Predicate &predicate)
Appends any abilities from other for which the given condition returns true to this,...
iterator erase(const iterator &first, const iterator &last)
std::vector< active_ability >::const_iterator const_iterator
std::pair< int, map_location > highest(const std::string &key, int def=0) const
std::vector< active_ability > cfgs_
iterator erase(const iterator &erase_it)
const map_location & loc() const
const_iterator begin() const
std::pair< int, map_location > get_extremum(const std::string &key, int def, const TComp &comp) const
void emplace_back(T &&... args)
const active_ability & front() const
active_ability_list(const map_location &loc=map_location())
void append(const active_ability_list &other)
Appends the abilities from other to this, ignores other.loc()
const_iterator end() const
std::pair< int, map_location > lowest(const std::string &key, int def=0) const
const active_ability & back() const
A config object defines a single node in a WML file, with access to child nodes.
int get_composite_value() const
std::vector< individual_effect > effect_list_
effect(const active_ability_list &list, int def, const const_attack_ptr &attacker=const_attack_ptr(), EFFECTS wham=EFFECT_DEFAULT)
const_iterator end() const
double get_composite_double_value() const
std::vector< individual_effect >::const_iterator const_iterator
double composite_double_value_
std::vector< individual_effect >::const_iterator iterator
const_iterator begin() const
void effect_impl(const active_ability_list &list, int def, const const_attack_ptr &att, EFFECTS wham)
Part of the constructor, calculates for a group of abilities with equal priority.
const unit_ability_t * parent
recursion_guard(recursion_guard &&)=delete
recursion_guard(const recursion_guard &)=delete
std::string substitute_variables(const std::string &str) const
Substitute gettext variables in name and description of abilities and specials.
const std::string & tag() const
apply_to_t apply_to() const
static config vector_to_cfg(const ability_vector &abilities)
static void do_compat_fixes(config &cfg, const std::string &tag, bool inside_attack)
const config & cfg() const
static void parse_vector(const config &abilities_cfg, ability_vector &res, bool inside_attack)
bool affects_enemies() const
std::string get_description(bool is_inactive=false, unit_race::GENDER=unit_race::MALE) const
bool matches_filter(const config &filter) const
active_on_t active_on() const
bool in_specials_tag() const
static ability_vector filter_tag(const ability_vector &vec, const std::string &tag)
const std::string & id() const
unit_ability_t(std::string tag, config cfg, bool inside_attack)
static ability_ptr create(std::string tag, config cfg, bool inside_attack)
affects_allies_t affects_allies_
static ability_vector clone(const ability_vector &vec)
std::string get_name(bool is_inactive=false, unit_race::GENDER=unit_race::MALE) const
std::string get_help_topic_id() const
recursion_guard guard_against_recursion(const unit &u) const
Tests which might otherwise cause infinite recursion should call this, check that the returned object...
void write(config &abilities_cfg)
static ability_vector cfg_to_vector(const config &abilities_cfg, bool inside_attack)
affects_allies_t affects_allies() const
bool active_on_matches(bool student_is_attacker) const
bool affects_self() const
This class represents a single unit of a specific type.
bool filter_base_matches(const config &cfg, int def)
@ EFFECT_WITHOUT_CLAMP_MIN_MAX
std::string::const_iterator iterator
std::shared_ptr< const unit_ability_t > const_ability_ptr
std::shared_ptr< const attack_type > const_attack_ptr
std::shared_ptr< unit_ability_t > ability_ptr
Data typedef for active_ability_list.
active_ability(const ability_ptr &p_ability, map_location student_loc, map_location teacher_loc)
const config & ability_cfg() const
map_location teacher_loc
The location of the teacher, that is the unit who owns the ability tags (different from student becau...
const unit_ability_t & ability() const
const_ability_ptr p_ability_
The contents of the ability tag, never nullptr.
map_location student_loc
Used by the formula in the ability.
Encapsulates the map of the game.
void set(value_modifier t, int val, const config &abil, const map_location &l)