1 /* !!!! GENERATED FILE - DO NOT EDIT !!!!
2  * --------------------------------------
3  *
4  * This file is part of liblcf. Copyright (c) 2021 liblcf authors.
5  * https://github.com/EasyRPG/liblcf - https://easyrpg.org
6  *
7  * liblcf is Free/Libre Open Source Software, released under the MIT License.
8  * For the full copyright and license information, please view the COPYING
9  * file that was distributed with this source code.
10  */
11 
12 #ifndef LCF_RPG_CLASS_H
13 #define LCF_RPG_CLASS_H
14 
15 // Headers
16 #include <stdint.h>
17 #include <vector>
18 #include "lcf/dbstring.h"
19 #include "lcf/rpg/learning.h"
20 #include "lcf/rpg/parameters.h"
21 #include "lcf/context.h"
22 #include <ostream>
23 #include <type_traits>
24 
25 /**
26  * rpg::Class class.
27  */
28 namespace lcf {
29 namespace rpg {
30 	class Class {
31 	public:
32 		int ID = 0;
33 		DBString name;
34 		bool two_weapon = false;
35 		bool lock_equipment = false;
36 		bool auto_battle = false;
37 		bool super_guard = false;
38 		Parameters parameters;
39 		int32_t exp_base = 300;
40 		int32_t exp_inflation = 300;
41 		int32_t exp_correction = 0;
42 		int32_t battler_animation = 0;
43 		std::vector<Learning> skills;
44 		std::vector<uint8_t> state_ranks;
45 		std::vector<uint8_t> attribute_ranks;
46 		std::vector<int32_t> battle_commands;
47 	};
48 
49 	inline bool operator==(const Class& l, const Class& r) {
50 		return l.name == r.name
51 		&& l.two_weapon == r.two_weapon
52 		&& l.lock_equipment == r.lock_equipment
53 		&& l.auto_battle == r.auto_battle
54 		&& l.super_guard == r.super_guard
55 		&& l.parameters == r.parameters
56 		&& l.exp_base == r.exp_base
57 		&& l.exp_inflation == r.exp_inflation
58 		&& l.exp_correction == r.exp_correction
59 		&& l.battler_animation == r.battler_animation
60 		&& l.skills == r.skills
61 		&& l.state_ranks == r.state_ranks
62 		&& l.attribute_ranks == r.attribute_ranks
63 		&& l.battle_commands == r.battle_commands;
64 	}
65 
66 	inline bool operator!=(const Class& l, const Class& r) {
67 		return !(l == r);
68 	}
69 
70 	std::ostream& operator<<(std::ostream& os, const Class& obj);
71 
72 	template <typename F, typename ParentCtx = Context<void,void>>
73 	void ForEachString(Class& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
74 		const auto ctx1 = Context<Class, ParentCtx>{ "name", -1, &obj, parent_ctx };
75 		f(obj.name, ctx1);
76 		const auto ctx6 = Context<Class, ParentCtx>{ "parameters", -1, &obj, parent_ctx };
77 		ForEachString(obj.parameters, f, &ctx6);
78 		for (int i = 0; i < static_cast<int>(obj.skills.size()); ++i) {
79 			const auto ctx11 = Context<Class, ParentCtx>{ "skills", i, &obj, parent_ctx };
80 			ForEachString(obj.skills[i], f, &ctx11);
81 		}
82 		(void)obj;
83 		(void)f;
84 		(void)parent_ctx;
85 	}
86 
87 } // namespace rpg
88 } // namespace lcf
89 
90 #endif
91