The Battle for Wesnoth  1.17.0-dev
abilities.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2021
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  loc(map_location::null_location()) {}
32  void set(value_modifier t, int val, const config *abil,const map_location &l);
34  int value;
35  const config *ability;
37 };
38 
39 class effect
40 {
41  public:
42  effect(const unit_ability_list& list, int def, bool backstab, const_attack_ptr attacker = const_attack_ptr());
43  // Provide read-only access to the effect list:
44  typedef std::vector<individual_effect>::const_iterator iterator;
45  typedef std::vector<individual_effect>::const_iterator const_iterator;
46 
47  int get_composite_value() const
48  { return composite_value_; }
49  const_iterator begin() const
50  { return effect_list_.begin(); }
51  const_iterator end() const
52  { return effect_list_.end(); }
53  private:
54  std::vector<individual_effect> effect_list_;
56 };
57 
58 
59 }
std::vector< individual_effect > effect_list_
Definition: abilities.hpp:54
std::vector< individual_effect >::const_iterator iterator
Definition: abilities.hpp:44
const_iterator end() const
Definition: abilities.hpp:51
bool filter_base_matches(const config &cfg, int def)
Definition: abilities.cpp:1642
const_iterator begin() const
Definition: abilities.hpp:49
Encapsulates the map of the game.
Definition: location.hpp:38
int get_composite_value() const
Definition: abilities.hpp:47
double t
Definition: astarsearch.cpp:65
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:61
std::shared_ptr< const attack_type > const_attack_ptr
Definition: ptr.hpp:34
std::vector< individual_effect >::const_iterator const_iterator
Definition: abilities.hpp:45