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_ACTOR_H
13 #define LCF_RPG_ACTOR_H
14 
15 // Headers
16 #include <stdint.h>
17 #include <vector>
18 #include "lcf/dbstring.h"
19 #include "lcf/rpg/equipment.h"
20 #include "lcf/rpg/learning.h"
21 #include "lcf/rpg/parameters.h"
22 #include "lcf/context.h"
23 #include <ostream>
24 #include <type_traits>
25 
26 /**
27  * rpg::Actor class.
28  */
29 namespace lcf {
30 namespace rpg {
31 	class Actor {
32 	public:
33 		void Setup(bool is2k3);
34 		int ID = 0;
35 		DBString name;
36 		DBString title;
37 		DBString character_name;
38 		int32_t character_index = 0;
39 		bool transparent = false;
40 		int32_t initial_level = 1;
41 		int32_t final_level = -1;
42 		bool critical_hit = true;
43 		int32_t critical_hit_chance = 30;
44 		DBString face_name;
45 		int32_t face_index = 0;
46 		bool two_weapon = false;
47 		bool lock_equipment = false;
48 		bool auto_battle = false;
49 		bool super_guard = false;
50 		Parameters parameters;
51 		int32_t exp_base = -1;
52 		int32_t exp_inflation = -1;
53 		int32_t exp_correction = 0;
54 		Equipment initial_equipment;
55 		int32_t unarmed_animation = 1;
56 		int32_t class_id = 0;
57 		int32_t battle_x = 220;
58 		int32_t battle_y = 120;
59 		int32_t battler_animation = 1;
60 		std::vector<Learning> skills;
61 		bool rename_skill = false;
62 		DBString skill_name;
63 		std::vector<uint8_t> state_ranks;
64 		std::vector<uint8_t> attribute_ranks;
65 		std::vector<int32_t> battle_commands;
66 	};
67 
68 	inline bool operator==(const Actor& l, const Actor& r) {
69 		return l.name == r.name
70 		&& l.title == r.title
71 		&& l.character_name == r.character_name
72 		&& l.character_index == r.character_index
73 		&& l.transparent == r.transparent
74 		&& l.initial_level == r.initial_level
75 		&& l.final_level == r.final_level
76 		&& l.critical_hit == r.critical_hit
77 		&& l.critical_hit_chance == r.critical_hit_chance
78 		&& l.face_name == r.face_name
79 		&& l.face_index == r.face_index
80 		&& l.two_weapon == r.two_weapon
81 		&& l.lock_equipment == r.lock_equipment
82 		&& l.auto_battle == r.auto_battle
83 		&& l.super_guard == r.super_guard
84 		&& l.parameters == r.parameters
85 		&& l.exp_base == r.exp_base
86 		&& l.exp_inflation == r.exp_inflation
87 		&& l.exp_correction == r.exp_correction
88 		&& l.initial_equipment == r.initial_equipment
89 		&& l.unarmed_animation == r.unarmed_animation
90 		&& l.class_id == r.class_id
91 		&& l.battle_x == r.battle_x
92 		&& l.battle_y == r.battle_y
93 		&& l.battler_animation == r.battler_animation
94 		&& l.skills == r.skills
95 		&& l.rename_skill == r.rename_skill
96 		&& l.skill_name == r.skill_name
97 		&& l.state_ranks == r.state_ranks
98 		&& l.attribute_ranks == r.attribute_ranks
99 		&& l.battle_commands == r.battle_commands;
100 	}
101 
102 	inline bool operator!=(const Actor& l, const Actor& r) {
103 		return !(l == r);
104 	}
105 
106 	std::ostream& operator<<(std::ostream& os, const Actor& obj);
107 
108 	template <typename F, typename ParentCtx = Context<void,void>>
109 	void ForEachString(Actor& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
110 		const auto ctx1 = Context<Actor, ParentCtx>{ "name", -1, &obj, parent_ctx };
111 		f(obj.name, ctx1);
112 		const auto ctx2 = Context<Actor, ParentCtx>{ "title", -1, &obj, parent_ctx };
113 		f(obj.title, ctx2);
114 		const auto ctx3 = Context<Actor, ParentCtx>{ "character_name", -1, &obj, parent_ctx };
115 		f(obj.character_name, ctx3);
116 		const auto ctx10 = Context<Actor, ParentCtx>{ "face_name", -1, &obj, parent_ctx };
117 		f(obj.face_name, ctx10);
118 		const auto ctx16 = Context<Actor, ParentCtx>{ "parameters", -1, &obj, parent_ctx };
119 		ForEachString(obj.parameters, f, &ctx16);
120 		const auto ctx20 = Context<Actor, ParentCtx>{ "initial_equipment", -1, &obj, parent_ctx };
121 		ForEachString(obj.initial_equipment, f, &ctx20);
122 		for (int i = 0; i < static_cast<int>(obj.skills.size()); ++i) {
123 			const auto ctx26 = Context<Actor, ParentCtx>{ "skills", i, &obj, parent_ctx };
124 			ForEachString(obj.skills[i], f, &ctx26);
125 		}
126 		const auto ctx28 = Context<Actor, ParentCtx>{ "skill_name", -1, &obj, parent_ctx };
127 		f(obj.skill_name, ctx28);
128 		(void)obj;
129 		(void)f;
130 		(void)parent_ctx;
131 	}
132 
133 } // namespace rpg
134 } // namespace lcf
135 
136 #endif
137