luminol_data/rmxp/
armor.rs

1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol.  If not, see <http://www.gnu.org/licenses/>.
17use crate::{
18    id_alox, id_serde, id_vec_alox, id_vec_serde, optional_id_alox, optional_id_serde,
19    optional_path_alox, optional_path_serde, Path,
20};
21
22#[derive(Default, Debug, serde::Deserialize, serde::Serialize)]
23#[derive(alox_48::Deserialize, alox_48::Serialize)]
24#[marshal(class = "RPG::Armor")]
25pub struct Armor {
26    #[serde(with = "id_serde")]
27    #[marshal(with = "id_alox")]
28    pub id: usize,
29    pub name: String,
30    #[serde(with = "optional_path_serde")]
31    #[marshal(with = "optional_path_alox")]
32    pub icon_name: Path,
33    pub description: String,
34    pub kind: Kind,
35    #[serde(with = "optional_id_serde")]
36    #[marshal(with = "optional_id_alox")]
37    pub auto_state_id: Option<usize>,
38    pub price: i32,
39    pub pdef: i32,
40    pub mdef: i32,
41    pub eva: i32,
42    pub str_plus: i32,
43    pub dex_plus: i32,
44    pub agi_plus: i32,
45    pub int_plus: i32,
46    #[serde(with = "id_vec_serde")]
47    #[marshal(with = "id_vec_alox")]
48    pub guard_element_set: Vec<usize>,
49    #[serde(with = "id_vec_serde")]
50    #[marshal(with = "id_vec_alox")]
51    pub guard_state_set: Vec<usize>,
52}
53
54#[derive(Clone, Copy, Debug, Eq, PartialEq, Default)]
55#[derive(
56    num_enum::TryFromPrimitive,
57    num_enum::IntoPrimitive,
58    strum::Display,
59    strum::EnumIter
60)]
61#[derive(serde::Deserialize, serde::Serialize)]
62#[derive(alox_48::Deserialize, alox_48::Serialize)]
63#[repr(u8)]
64#[serde(into = "u8")]
65#[serde(try_from = "u8")]
66#[marshal(into = "u8")]
67#[marshal(try_from = "u8")]
68pub enum Kind {
69    #[default]
70    Shield = 0,
71    Helmet = 1,
72    #[strum(to_string = "Body Armor")]
73    BodyArmor = 2,
74    Accessory = 3,
75}