27 class map_formula_callable;
48 return std::make_shared<unit_ability_t>(
tag,
cfg, inside_attack);
53 const std::string&
tag()
const {
return tag_; };
54 const std::string&
id()
const {
return id_; };
127 operator bool()
const;
195 std::pair<int, map_location>
highest(
const std::string& key,
int def = 0)
const
199 std::pair<int, map_location>
lowest(
const std::string& key,
int def = 0)
const
204 template<
typename TComp>
205 std::pair<int, map_location>
get_extremum(
const std::string& key,
int def,
const TComp& comp)
const;
227 template<
typename... T>
235 std::copy(other.
begin(), other.
end(), std::back_inserter(
cfgs_));
244 template<
typename Predicate>
247 std::copy_if(other.
begin(), other.
end(), std::back_inserter(
cfgs_), predicate);
275 std::move(attacking ?
self :
other),
277 std::move(attacking ?
other :
self),
354 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.
self_and_other_ref self_and_other(const attack_type &self_att) const
bool has_active_special(const attack_type &at, const std::string &tag) const
Returns whether or not *this has a special ability with a tag or id equal to special.
void set_for_listing(bool for_listing)
active_ability_list get_abilities_weapons(const std::string &tag, const unit &un) const
bool is_special_active(const specials_combatant &wep, const unit_ability_t &ab, unit_ability_t::affects_t whom) const
Returns whether or not the given special is active for the specified unit, based on the current conte...
specials_combatant defender
std::vector< unit_ability_t::tooltip_info > special_tooltips(const attack_type &at, boost::dynamic_bitset<> &active_list) const
Returns a vector of names and descriptions for the specials of *this.
std::string describe_weapon_specials_value(const attack_type &at, const std::set< std::string > &checking_tags) const
specials_combatant attacker
const specials_combatant & other(const specials_combatant &self) const
std::string describe_weapon_specials(const attack_type &at) const
Returns a comma-separated string of active names for the specials of *this.
void add_formula_context(wfl::map_formula_callable &callable) const
bool has_active_special_id(const attack_type &at, const std::string &id) const
specials_context_t(specials_context_t &&)=delete
std::vector< unit_ability_t::tooltip_info > abilities_special_tooltips(const attack_type &at, boost::dynamic_bitset<> &active_list) const
self_and_other_ref self_and_other(const unit &self_un) const
bool has_active_special_matching_filter(const attack_type &at, const config &filter) const
static specials_context_t make(specials_combatant &&self, specials_combatant &&other, bool attacking)
active_ability_list get_active_specials(const attack_type &at, const std::string &tag) const
specials_context_t(const specials_context_t &)=delete
active_ability_list get_active_combat_teachers(const attack_type &at) const
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.
std::string tag(std::string_view tag, Args &&... data)
Wraps the given data in the specified tag.
static std::string at(const std::string &file, int line)
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 unit > unit_const_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.
static const map_location & null_location()
const specials_combatant & other
void set(value_modifier t, int val, const config &abil, const map_location &l)