1use alloc::string::String;
2
3use hashbrown::HashSet;
4use serde::{
5 Deserialize,
6 Serialize,
7};
8
9use crate::{
10 HitEffect,
11 ItemFlag,
12 ItemInput,
13 ItemTarget,
14 Type,
15};
16
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
19pub struct FlingData {
20 pub power: u32,
21 #[serde(default)]
22 pub use_item: bool,
23 pub hit_effect: Option<HitEffect>,
24}
25
26#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
28pub struct NaturalGiftData {
29 pub power: u32,
30 #[serde(rename = "type")]
31 pub typ: Type,
32}
33
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36pub struct JudgmentData {
37 #[serde(rename = "type")]
38 pub typ: Type,
39}
40
41#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43pub struct TechnoBlastData {
44 #[serde(rename = "type")]
45 pub typ: Type,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
50pub struct MultiAttackData {
51 #[serde(rename = "type")]
52 pub typ: Type,
53}
54
55#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
57pub struct MegaEvolutionData {
58 pub from: String,
59 pub into: String,
60}
61
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
64pub enum ZCrystalSource {
65 #[serde(rename = "from")]
66 Move(String),
67 #[serde(rename = "type")]
68 Type(Type),
69}
70
71#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
73pub struct UltraBurstData {
74 pub from: HashSet<String>,
75 pub into: String,
76}
77
78#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
80pub struct ZCrystalData {
81 #[serde(flatten)]
82 pub source: Option<ZCrystalSource>,
83 pub into: String,
84 #[serde(default)]
85 pub users: HashSet<String>,
86}
87
88#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
90pub struct SpecialItemData {
91 pub mega_evolution: Option<MegaEvolutionData>,
92 pub z_crystal: Option<ZCrystalData>,
93 pub ultra_burst: Option<UltraBurstData>,
94
95 pub fling: Option<FlingData>,
96 pub natural_gift: Option<NaturalGiftData>,
97 pub judgment: Option<JudgmentData>,
98 pub techno_blast: Option<TechnoBlastData>,
99 pub multi_attack: Option<MultiAttackData>,
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
107pub struct ItemData {
108 pub name: String,
110 pub target: Option<ItemTarget>,
112 pub input: Option<ItemInput>,
114 #[serde(default)]
116 pub special_data: SpecialItemData,
117 pub force_forme: Option<String>,
119 pub flags: HashSet<ItemFlag>,
121
122 #[serde(default)]
124 pub effect: serde_json::Value,
125 #[serde(default)]
127 pub condition: serde_json::Value,
128}