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;
109 bool has_weapon_ability(
const std::string& special,
bool special_id=
true,
bool special_tags=
true)
const;
116 bool has_special_or_ability(
const std::string& special,
bool special_id=
true,
bool special_tags=
true)
const;
120 bool matches_filter(
const config& filter)
const;
121 bool apply_modification(
const config& cfg);
122 bool describe_modification(
const config& cfg,std::string* description);
137 enum AFFECTS { AFFECT_SELF=1, AFFECT_OTHER=2, AFFECT_EITHER=3 };
154 bool check_self_abilities(
const config& cfg,
const std::string& special)
const;
162 bool check_adj_abilities(
const config& cfg,
const std::string& special,
int dir,
const unit& from)
const;
163 bool special_active(
const config& special,
AFFECTS whom,
const std::string& tag_name,
164 const std::string& filter_self =
"filter_self")
const;
177 static void weapon_specials_impl_self(
178 std::string& temp_string,
184 std::set<std::string>& checking_name,
185 const std::set<std::string>& checking_tags={},
186 bool leader_bool=false
189 static void weapon_specials_impl_adj(
190 std::string& temp_string,
196 std::set<std::string>& checking_name,
197 const std::set<std::string>& checking_tags={},
198 const std::string& affect_adjacents=
"",
199 bool leader_bool=false
212 static bool check_self_abilities_impl(
219 const std::string& tag_name,
220 bool leader_bool=
false 237 static bool check_adj_abilities_impl(
246 const std::string& tag_name,
247 bool leader_bool=
false 250 static bool special_active_impl(
255 const std::string& tag_name,
256 const std::string& filter_self =
"filter_self" 267 mutable bool is_for_listing_ =
false;
270 std::shared_ptr<const attack_type>
parent;
284 bool was_moved =
false;
295 return specials_context_t(*
this, other_attack,
self, other, unit_loc, other_loc, attacking);
336 using attack_itors = boost::iterator_range<boost::indirect_iterator<attack_list::iterator>>;
337 using const_attack_itors = boost::iterator_range<boost::indirect_iterator<attack_list::const_iterator>>;
340 return boost::make_iterator_range(boost::make_indirect_iterator(atks.begin()), boost::make_indirect_iterator(atks.end()));
344 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
void set_attacks_used(int value)
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)