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_ITEM_H 13 #define LCF_RPG_ITEM_H 14 15 // Headers 16 #include <stdint.h> 17 #include <vector> 18 #include "lcf/dbbitarray.h" 19 #include "lcf/dbstring.h" 20 #include "lcf/enum_tags.h" 21 #include "lcf/rpg/battleranimationitemskill.h" 22 #include "lcf/context.h" 23 #include <ostream> 24 #include <type_traits> 25 26 /** 27 * rpg::Item class. 28 */ 29 namespace lcf { 30 namespace rpg { 31 class Item { 32 public: 33 // Sentinel name used to denote that the default item start message should be used. 34 static constexpr const char* kDefaultMessage = "default_message"; 35 36 enum Type { 37 Type_normal = 0, 38 Type_weapon = 1, 39 Type_shield = 2, 40 Type_armor = 3, 41 Type_helmet = 4, 42 Type_accessory = 5, 43 Type_medicine = 6, 44 Type_book = 7, 45 Type_material = 8, 46 Type_special = 9, 47 Type_switch = 10 48 }; 49 static constexpr auto kTypeTags = lcf::makeEnumTags<Type>( 50 "normal", 51 "weapon", 52 "shield", 53 "armor", 54 "helmet", 55 "accessory", 56 "medicine", 57 "book", 58 "material", 59 "special", 60 "switch" 61 ); 62 enum Trajectory { 63 Trajectory_straight = 0, 64 Trajectory_return = 1 65 }; 66 static constexpr auto kTrajectoryTags = lcf::makeEnumTags<Trajectory>( 67 "straight", 68 "return" 69 ); 70 enum Target { 71 Target_single = 0, 72 Target_center = 1, 73 Target_simultaneous = 2, 74 Target_sequential = 3 75 }; 76 static constexpr auto kTargetTags = lcf::makeEnumTags<Target>( 77 "single", 78 "center", 79 "simultaneous", 80 "sequential" 81 ); 82 83 int ID = 0; 84 DBString name; 85 DBString description; 86 int32_t type = 0; 87 int32_t price = 0; 88 int32_t uses = 1; 89 int32_t atk_points1 = 0; 90 int32_t def_points1 = 0; 91 int32_t spi_points1 = 0; 92 int32_t agi_points1 = 0; 93 bool two_handed = false; 94 int32_t sp_cost = 0; 95 int32_t hit = 90; 96 int32_t critical_hit = 0; 97 int32_t animation_id = 1; 98 bool preemptive = false; 99 bool dual_attack = false; 100 bool attack_all = false; 101 bool ignore_evasion = false; 102 bool prevent_critical = false; 103 bool raise_evasion = false; 104 bool half_sp_cost = false; 105 bool no_terrain_damage = false; 106 bool cursed = false; 107 bool entire_party = false; 108 int32_t recover_hp_rate = 0; 109 int32_t recover_hp = 0; 110 int32_t recover_sp_rate = 0; 111 int32_t recover_sp = 0; 112 bool occasion_field1 = false; 113 bool ko_only = false; 114 int32_t max_hp_points = 0; 115 int32_t max_sp_points = 0; 116 int32_t atk_points2 = 0; 117 int32_t def_points2 = 0; 118 int32_t spi_points2 = 0; 119 int32_t agi_points2 = 0; 120 int32_t using_message = 0; 121 int32_t skill_id = 1; 122 int32_t switch_id = 1; 123 bool occasion_field2 = true; 124 bool occasion_battle = false; 125 DBBitArray actor_set; 126 DBBitArray state_set; 127 DBBitArray attribute_set; 128 int32_t state_chance = 0; 129 bool reverse_state_effect = false; 130 int32_t weapon_animation = -1; 131 std::vector<BattlerAnimationItemSkill> animation_data; 132 bool use_skill = false; 133 DBBitArray class_set; 134 int32_t ranged_trajectory = 0; 135 int32_t ranged_target = 0; 136 DBString easyrpg_using_message = DBString(kDefaultMessage); 137 int32_t easyrpg_max_count = -1; 138 }; 139 inline std::ostream& operator<<(std::ostream& os, Item::Type code) { 140 os << static_cast<std::underlying_type_t<decltype(code)>>(code); 141 return os; 142 } 143 inline std::ostream& operator<<(std::ostream& os, Item::Trajectory code) { 144 os << static_cast<std::underlying_type_t<decltype(code)>>(code); 145 return os; 146 } 147 inline std::ostream& operator<<(std::ostream& os, Item::Target code) { 148 os << static_cast<std::underlying_type_t<decltype(code)>>(code); 149 return os; 150 } 151 152 inline bool operator==(const Item& l, const Item& r) { 153 return l.name == r.name 154 && l.description == r.description 155 && l.type == r.type 156 && l.price == r.price 157 && l.uses == r.uses 158 && l.atk_points1 == r.atk_points1 159 && l.def_points1 == r.def_points1 160 && l.spi_points1 == r.spi_points1 161 && l.agi_points1 == r.agi_points1 162 && l.two_handed == r.two_handed 163 && l.sp_cost == r.sp_cost 164 && l.hit == r.hit 165 && l.critical_hit == r.critical_hit 166 && l.animation_id == r.animation_id 167 && l.preemptive == r.preemptive 168 && l.dual_attack == r.dual_attack 169 && l.attack_all == r.attack_all 170 && l.ignore_evasion == r.ignore_evasion 171 && l.prevent_critical == r.prevent_critical 172 && l.raise_evasion == r.raise_evasion 173 && l.half_sp_cost == r.half_sp_cost 174 && l.no_terrain_damage == r.no_terrain_damage 175 && l.cursed == r.cursed 176 && l.entire_party == r.entire_party 177 && l.recover_hp_rate == r.recover_hp_rate 178 && l.recover_hp == r.recover_hp 179 && l.recover_sp_rate == r.recover_sp_rate 180 && l.recover_sp == r.recover_sp 181 && l.occasion_field1 == r.occasion_field1 182 && l.ko_only == r.ko_only 183 && l.max_hp_points == r.max_hp_points 184 && l.max_sp_points == r.max_sp_points 185 && l.atk_points2 == r.atk_points2 186 && l.def_points2 == r.def_points2 187 && l.spi_points2 == r.spi_points2 188 && l.agi_points2 == r.agi_points2 189 && l.using_message == r.using_message 190 && l.skill_id == r.skill_id 191 && l.switch_id == r.switch_id 192 && l.occasion_field2 == r.occasion_field2 193 && l.occasion_battle == r.occasion_battle 194 && l.actor_set == r.actor_set 195 && l.state_set == r.state_set 196 && l.attribute_set == r.attribute_set 197 && l.state_chance == r.state_chance 198 && l.reverse_state_effect == r.reverse_state_effect 199 && l.weapon_animation == r.weapon_animation 200 && l.animation_data == r.animation_data 201 && l.use_skill == r.use_skill 202 && l.class_set == r.class_set 203 && l.ranged_trajectory == r.ranged_trajectory 204 && l.ranged_target == r.ranged_target 205 && l.easyrpg_using_message == r.easyrpg_using_message 206 && l.easyrpg_max_count == r.easyrpg_max_count; 207 } 208 209 inline bool operator!=(const Item& l, const Item& r) { 210 return !(l == r); 211 } 212 213 std::ostream& operator<<(std::ostream& os, const Item& obj); 214 215 template <typename F, typename ParentCtx = Context<void,void>> 216 void ForEachString(Item& obj, const F& f, const ParentCtx* parent_ctx = nullptr) { 217 const auto ctx1 = Context<Item, ParentCtx>{ "name", -1, &obj, parent_ctx }; 218 f(obj.name, ctx1); 219 const auto ctx2 = Context<Item, ParentCtx>{ "description", -1, &obj, parent_ctx }; 220 f(obj.description, ctx2); 221 const auto ctx53 = Context<Item, ParentCtx>{ "easyrpg_using_message", -1, &obj, parent_ctx }; 222 f(obj.easyrpg_using_message, ctx53); 223 (void)obj; 224 (void)f; 225 (void)parent_ctx; 226 } 227 228 } // namespace rpg 229 } // namespace lcf 230 231 #endif 232