The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
ability_tags.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 - 2025
3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY.
10 See the COPYING file for more details.
11*/
12
13#pragma once
14
15#include "enum_base.hpp"
16
17#include <set>
18
20{
21 // abilities
22 static constexpr const char* const heals = "heals";
23 static constexpr const char* const regenerate = "regenerate";
24 static constexpr const char* const resistance = "resistance";
25 static constexpr const char* const leadership = "leadership";
26 static constexpr const char* const skirmisher = "skirmisher";
27 static constexpr const char* const illuminates = "illuminates";
28 static constexpr const char* const teleport = "teleport";
29 static constexpr const char* const hides = "hides";
30 static constexpr const char* const dummy = "dummy";
31 // weapon specials
32 static constexpr const char* const attacks = "attacks";
33 static constexpr const char* const berserk = "berserk";
34 static constexpr const char* const chance_to_hit = "chance_to_hit";
35 static constexpr const char* const damage = "damage";
36 static constexpr const char* const damage_type = "damage_type";
37 static constexpr const char* const defense = "defense";
38 static constexpr const char* const disable = "disable";
39 static constexpr const char* const drains = "drains";
40 static constexpr const char* const firststrike = "firststrike";
41 static constexpr const char* const heal_on_hit = "heal_on_hit";
42 static constexpr const char* const petrifies = "petrifies";
43 static constexpr const char* const plague = "plague";
44 static constexpr const char* const poison = "poison";
45 static constexpr const char* const slow = "slow";
46 static constexpr const char* const swarm = "swarm";
47
49
50 /**
51 * Weapon specials that support add, sub, multiply and divide.
52 */
53 static const std::set<std::string>& weapon_math_tags()
54 {
55 static std::set<std::string> tags{attacks, damage, chance_to_hit, drains, heal_on_hit};
56 return tags;
57 }
58
59 /**
60 * Weapon specials that don't support add, sub, multiply and divide.
61 */
62 static const std::set<std::string>& no_weapon_math_tags()
63 {
64 static std::set<std::string> tags{berserk, disable, plague, slow, petrifies, firststrike, swarm, poison, damage_type};
65 return tags;
66 }
67
68 static const std::set<std::string>& ability_value_tags()
69 {
70 static std::set<std::string> tags{defense, resistance, leadership, heals, regenerate, illuminates};
71 return tags;
72 }
73
74 static const std::set<std::string>& ability_no_value_tags()
75 {
76 static std::set<std::string> tags{teleport, hides, skirmisher};
77 return tags;
78 }
79
80 static const std::set<std::string>& all_weapon_tags()
81 {
83 return tags;
84 }
85};
#define ENUM_AND_ARRAY(...)
Definition enum_base.hpp:96
STL namespace.
static constexpr const char *const regenerate
static constexpr const char *const drains
static constexpr const char *const firststrike
static constexpr const char *const resistance
static constexpr const char *const plague
static constexpr const char *const damage_type
static const std::set< std::string > & ability_no_value_tags()
static constexpr const char *const dummy
static constexpr const char *const disable
static constexpr const char *const swarm
static constexpr const char *const berserk
static constexpr const char *const heal_on_hit
static const std::set< std::string > & no_weapon_math_tags()
Weapon specials that don't support add, sub, multiply and divide.
static constexpr const char *const illuminates
static const std::set< std::string > & all_weapon_tags()
static constexpr const char *const poison
static const std::set< std::string > & weapon_math_tags()
Weapon specials that support add, sub, multiply and divide.
static constexpr const char *const slow
static constexpr const char *const teleport
static constexpr const char *const attacks
static constexpr const char *const chance_to_hit
static constexpr const char *const petrifies
static constexpr const char *const hides
static constexpr const char *const damage
static const std::set< std::string > & ability_value_tags()
static constexpr const char *const skirmisher
static constexpr const char *const heals
static constexpr const char *const defense
static constexpr const char *const leadership
The base template for associating string values with enum values.
Definition enum_base.hpp:33