The Battle for Wesnoth  1.19.18+dev
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
specials_context_t Class Reference

#include <abilities.hpp>

Classes

struct  self_and_other_red_t
 
struct  specials_combatant
 

Public Member Functions

 specials_context_t (specials_context_t &&)=delete
 
 specials_context_t (const specials_context_t &)=delete
 
 specials_context_t (specials_combatant &&att, specials_combatant &&def)
 
 ~specials_context_t ()
 
void set_for_listing (bool for_listing)
 
self_and_other_red_t self_and_other (const attack_type &self_att) const
 
self_and_other_red_t self_and_other (const unit &self_un) const
 
const specials_combatantother (const specials_combatant &self) const
 
active_ability_list get_active_specials (const attack_type &at, const std::string &tag) const
 
active_ability_list get_abilities_weapons (const std::string &tag, const unit &un) 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. More...
 
bool has_active_special_id (const attack_type &at, const std::string &id) const
 
bool has_active_special_matching_filter (const attack_type &at, const config &filter) 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 context (see set_specials_context). More...
 
void add_formula_context (wfl::map_formula_callable &callable) const
 
std::vector< unit_ability_t::tooltip_infospecial_tooltips (const attack_type &at, boost::dynamic_bitset<> &active_list) const
 Returns a vector of names and descriptions for the specials of *this. More...
 
std::vector< unit_ability_t::tooltip_infoabilities_special_tooltips (const attack_type &at, boost::dynamic_bitset<> &active_list) const
 
std::string describe_weapon_specials (const attack_type &at) const
 Returns a comma-separated string of active names for the specials of *this. More...
 
std::string describe_weapon_specials_value (const attack_type &at, const std::set< std::string > &checking_tags) const
 
active_ability_list get_active_combat_teachers (const attack_type &at) const
 

Static Public Member Functions

static specials_context_t make (specials_combatant &&self, specials_combatant &&other, bool attacking)
 

Public Attributes

specials_combatant attacker
 
specials_combatant defender
 
bool is_for_listing
 

Detailed Description

Definition at line 256 of file abilities.hpp.

Constructor & Destructor Documentation

◆ specials_context_t() [1/3]

specials_context_t::specials_context_t ( specials_context_t &&  )
delete

◆ specials_context_t() [2/3]

specials_context_t::specials_context_t ( const specials_context_t )
delete

◆ specials_context_t() [3/3]

specials_context_t::specials_context_t ( specials_combatant &&  att,
specials_combatant &&  def 
)

Definition at line 1008 of file abilities.cpp.

References specials_context_t::specials_combatant::at, attacker, and defender.

◆ ~specials_context_t()

specials_context_t::~specials_context_t ( )

Definition at line 1020 of file abilities.cpp.

References specials_context_t::specials_combatant::at, attacker, and defender.

Member Function Documentation

◆ abilities_special_tooltips()

std::vector< unit_ability_t::tooltip_info > specials_context_t::abilities_special_tooltips ( const attack_type at,
boost::dynamic_bitset<> &  active_list 
) const

◆ add_formula_context()

void specials_context_t::add_formula_context ( wfl::map_formula_callable callable) const

Definition at line 867 of file abilities.cpp.

References wfl::map_formula_callable::add().

◆ describe_weapon_specials()

std::string specials_context_t::describe_weapon_specials ( const attack_type at) const

Returns a comma-separated string of active names for the specials of *this.

Empty names are skipped.

Whether or not a special is active depends on the current context (see set_specials_context)

Definition at line 1044 of file abilities.cpp.

References schema_validation::at(), unit_ability_t::EITHER, font::INACTIVE_COLOR, is_enemy(), is_special_active(), utils::join(), loc, other(), unit_ability_t::SELF, self_and_other(), unit::side(), and markup::span_color().

◆ describe_weapon_specials_value()

std::string specials_context_t::describe_weapon_specials_value ( const attack_type at,
const std::set< std::string > &  checking_tags 
) const

◆ get_abilities_weapons()

active_ability_list specials_context_t::get_abilities_weapons ( const std::string &  tag,
const unit un 
) const

◆ get_active_combat_teachers()

active_ability_list specials_context_t::get_active_combat_teachers ( const attack_type at) const

◆ get_active_specials()

active_ability_list specials_context_t::get_active_specials ( const attack_type at,
const std::string &  tag 
) const

◆ has_active_special()

bool specials_context_t::has_active_special ( const attack_type at,
const std::string &  tag_name 
) const

Returns whether or not *this has a special ability with a tag or id equal to special.

the Check is for a special ability active in the current context (see set_specials_context), including specials obtained from the opponent's attack.

Definition at line 1524 of file abilities.cpp.

References schema_validation::at(), other(), and self_and_other().

Referenced by attack_type::has_special_or_ability().

◆ has_active_special_id()

bool specials_context_t::has_active_special_id ( const attack_type at,
const std::string &  id 
) const

◆ has_active_special_matching_filter()

bool specials_context_t::has_active_special_matching_filter ( const attack_type at,
const config filter 
) const

◆ is_special_active()

bool specials_context_t::is_special_active ( const specials_combatant self,
const unit_ability_t ab,
unit_ability_t::affects_t  whom 
) const

◆ make()

static specials_context_t specials_context_t::make ( specials_combatant &&  self,
specials_combatant &&  other,
bool  attacking 
)
inlinestatic

◆ other()

const specials_combatant& specials_context_t::other ( const specials_combatant self) const
inline

◆ self_and_other() [1/2]

self_and_other_red_t specials_context_t::self_and_other ( const attack_type self_att) const
inline

◆ self_and_other() [2/2]

self_and_other_red_t specials_context_t::self_and_other ( const unit self_un) const
inline

Definition at line 296 of file abilities.hpp.

References attacker, defender, and specials_context_t::specials_combatant::un.

◆ set_for_listing()

void specials_context_t::set_for_listing ( bool  for_listing)
inline

Definition at line 282 of file abilities.hpp.

References is_for_listing.

Referenced by attack_info().

◆ special_tooltips()

std::vector< unit_ability_t::tooltip_info > specials_context_t::special_tooltips ( const attack_type at,
boost::dynamic_bitset<> &  active_list 
) const

Returns a vector of names and descriptions for the specials of *this.

Each std::pair in the vector has first = name and second = description.

This uses either the active or inactive name/description for each special, based on the current context (see set_specials_context), provided active_list is not nullptr. Otherwise specials are assumed active. If the appropriate name is empty, the special is skipped.

Definition at line 1285 of file abilities.cpp.

References schema_validation::at(), unit_ability_t::EITHER, is_special_active(), other(), and self_and_other().

Member Data Documentation

◆ attacker

specials_combatant specials_context_t::attacker

◆ defender

specials_combatant specials_context_t::defender

◆ is_for_listing

bool specials_context_t::is_for_listing

Definition at line 308 of file abilities.hpp.

Referenced by is_special_active(), and set_for_listing().


The documentation for this class was generated from the following files: