25 #include <boost/iterator/indirect_iterator.hpp> 26 #include <boost/range/iterator_range.hpp> 27 #include <boost/dynamic_bitset_fwd.hpp> 34 class map_formula_callable;
38 class attack_type :
public std::enable_shared_from_this<attack_type>
44 const std::string&
id()
const {
return id_; }
45 const std::string&
type()
const {
return type_; }
46 const std::string&
icon()
const {
return icon_; }
47 const std::string&
range()
const {
return range_; }
50 std::string accuracy_parry_description()
const;
52 int parry()
const {
return parry_; }
53 int damage()
const {
return damage_; }
60 void set_id(
const std::string& value) { id_ = value; set_changed(
true); }
61 void set_type(
const std::string& value) { type_ = value; set_changed(
true); }
62 void set_icon(
const std::string& value) { icon_ = value; set_changed(
true); }
63 void set_range(
const std::string& value) { range_ = value; set_changed(
true); }
64 void set_accuracy(
int value) { accuracy_ = value; set_changed(
true); }
65 void set_parry(
int value) { parry_ = value; set_changed(
true); }
66 void set_damage(
int value) { damage_ = value; set_changed(
true); }
82 bool has_special(
const std::string& special,
bool simple_check=
false,
bool special_id=
true,
bool special_tags=
true)
const;
84 std::vector<std::pair<t_string, t_string>> special_tooltips(boost::dynamic_bitset<>* active_list =
nullptr)
const;
85 std::string weapon_specials()
const;
86 std::string weapon_specials_value(
const std::set<std::string> checking_tags)
const;
89 void modified_attacks(
unsigned & min_attacks,
90 unsigned & max_attacks)
const;
92 int modified_damage()
const;
103 bool has_weapon_ability(
const std::string& special,
bool special_id=
true,
bool special_tags=
true)
const;
110 bool has_special_or_ability(
const std::string& special,
bool special_id=
true,
bool special_tags=
true)
const;
114 bool matches_filter(
const config& filter)
const;
115 bool apply_modification(
const config& cfg);
116 bool describe_modification(
const config& cfg,std::string* description);
129 enum AFFECTS { AFFECT_SELF=1, AFFECT_OTHER=2, AFFECT_EITHER=3 };
146 bool check_self_abilities(
const config& cfg,
const std::string& special)
const;
154 bool check_adj_abilities(
const config& cfg,
const std::string& special,
int dir,
const unit& from)
const;
155 bool special_active(
const config& special,
AFFECTS whom,
const std::string& tag_name,
156 const std::string& filter_self =
"filter_self")
const;
169 static void weapon_specials_impl_self(
170 std::string& temp_string,
176 std::set<std::string>& checking_name,
177 const std::set<std::string>& checking_tags={},
178 bool leader_bool=false
181 static void weapon_specials_impl_adj(
182 std::string& temp_string,
188 std::set<std::string>& checking_name,
189 const std::set<std::string>& checking_tags={},
190 const std::string& affect_adjacents=
"",
191 bool leader_bool=false
204 static bool check_self_abilities_impl(
211 const std::string& tag_name,
212 bool leader_bool=
false 229 static bool check_adj_abilities_impl(
238 const std::string& tag_name,
239 bool leader_bool=
false 242 static bool special_active_impl(
247 const std::string& tag_name,
248 const std::string& filter_self =
"filter_self" 259 mutable bool is_for_listing_ =
false;
262 std::shared_ptr<const attack_type>
parent;
276 bool was_moved =
false;
287 return specials_context_t(*
this, other_attack,
self, other, unit_loc, other_loc, attacking);
327 using attack_itors = boost::iterator_range<boost::indirect_iterator<attack_list::iterator>>;
328 using const_attack_itors = boost::iterator_range<boost::indirect_iterator<attack_list::const_iterator>>;
331 return boost::make_iterator_range(boost::make_indirect_iterator(atks.begin()), boost::make_indirect_iterator(atks.end()));
335 return boost::make_iterator_range(boost::make_indirect_iterator(atks.begin()), boost::make_indirect_iterator(atks.end()));
std::vector< attack_ptr > attack_list
const std::string & id() const
This class represents a single unit of a specific type.
boost::iterator_range< boost::indirect_iterator< attack_list::iterator > > attack_itors
void set_num_attacks(int value)
const std::string & type() const
attack_itors make_attack_itors(attack_list &atks)
Definitions for the interface to Wesnoth Markup Language (WML).
void set_changed(bool value)
A single unit type that the player may recruit.
void set_name(const t_string &value)
std::shared_ptr< const unit > unit_const_ptr
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
int movement_used() const
const t_string & name() const
specials_context_t specials_context(const unit_type &self_type, const map_location &loc, bool attacking=true) const
const std::string & range() const
const std::string & icon() const
void set_defense_weight(double value)
void set_specials(config value)
Encapsulates the map of the game.
specials_context_t specials_context(unit_const_ptr self, const map_location &loc, bool attacking=true) const
void set_damage(int value)
const config & specials() const
double attack_weight() const
double defense_weight() const
friend class specials_context_t
void set_range(const std::string &value)
void set_parry(int value)
const_attack_ptr other_attack_
void set_icon(const std::string &value)
void set_id(const std::string &value)
specials_context_t specials_context_for_listing(bool attacking=true) const
specials_context_t specials_context(unit_const_ptr self, unit_const_ptr other, const map_location &unit_loc, const map_location &other_loc, bool attacking, const_attack_ptr other_attack) const
boost::iterator_range< boost::indirect_iterator< attack_list::const_iterator > > const_attack_itors
void set_movement_used(int value)
std::shared_ptr< const attack_type > parent
A config object defines a single node in a WML file, with access to child nodes.
std::shared_ptr< const attack_type > const_attack_ptr
void set_accuracy(int value)
void set_attack_weight(double value)
void set_type(const std::string &value)