The Battle for Wesnoth  1.19.7+dev
abilities.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2024
3  by Dominic Bolin <dominic.bolin@exong.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include "map/location.hpp"
19 #include "units/ptr.hpp"
20 
21 class unit_ability_list;
22 namespace unit_abilities
23 {
24 bool filter_base_matches(const config& cfg, int def);
25 
27 
29 
31 {
33  loc(map_location::null_location()) {}
34  void set(value_modifier t, int val, const config *abil,const map_location &l);
36  int value;
37  const config *ability;
39 };
40 
41 class effect
42 {
43  public:
44  effect(const unit_ability_list& list, int def, const const_attack_ptr& attacker = const_attack_ptr(), EFFECTS wham = EFFECT_DEFAULT);
45  // Provide read-only access to the effect list:
46  typedef std::vector<individual_effect>::const_iterator iterator;
47  typedef std::vector<individual_effect>::const_iterator const_iterator;
48 
49  int get_composite_value() const
50  { return composite_value_; }
52  { return effect_list_.begin(); }
54  { return effect_list_.end(); }
55  private:
56  std::vector<individual_effect> effect_list_;
58 };
59 
60 
61 }
double t
Definition: astarsearch.cpp:63
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
int get_composite_value() const
Definition: abilities.hpp:49
std::vector< individual_effect > effect_list_
Definition: abilities.hpp:56
const_iterator end() const
Definition: abilities.hpp:53
effect(const unit_ability_list &list, int def, const const_attack_ptr &attacker=const_attack_ptr(), EFFECTS wham=EFFECT_DEFAULT)
Definition: abilities.cpp:2430
std::vector< individual_effect >::const_iterator const_iterator
Definition: abilities.hpp:47
std::vector< individual_effect >::const_iterator iterator
Definition: abilities.hpp:46
const_iterator begin() const
Definition: abilities.hpp:51
bool filter_base_matches(const config &cfg, int def)
Definition: abilities.cpp:2411
@ EFFECT_WITHOUT_CLAMP_MIN_MAX
Definition: abilities.hpp:28
std::shared_ptr< const attack_type > const_attack_ptr
Definition: ptr.hpp:34
Encapsulates the map of the game.
Definition: location.hpp:45
void set(value_modifier t, int val, const config *abil, const map_location &l)
Definition: abilities.cpp:2403