Skip to main content

battler_data/moves/
move_flag.rs

1use serde_string_enum::{
2    DeserializeLabeledStringEnum,
3    SerializeLabeledStringEnum,
4};
5
6/// Move flags, which categorize moves for miscellaneous behavior (such as bans or side effects).
7#[derive(
8    Debug, Clone, PartialEq, Eq, Hash, SerializeLabeledStringEnum, DeserializeLabeledStringEnum,
9)]
10pub enum MoveFlag {
11    /// Lowers a target's accuracy.
12    #[string = "AccuracyLowering"]
13    AccuracyLowering,
14    /// Bypasses a target's substitute.
15    #[string = "BypassSubstitute"]
16    #[alias = "BypassSub"]
17    BypassSubstitute,
18    /// Bypasses a target's Max Guard.
19    #[string = "BypassMaxGuard"]
20    BypassMaxGuard,
21    /// A bite move.
22    #[string = "Bite"]
23    Bite,
24    /// A bullet move.
25    #[string = "Bullet"]
26    Bullet,
27    /// A move that calls another move.
28    #[string = "CallsMove"]
29    CallsMove,
30    /// A charge move, which causes a Mon to be unable to move between turns.
31    #[string = "Charge"]
32    Charge,
33    /// Makes contact.
34    #[string = "Contact"]
35    Contact,
36    /// A move with crash damage.
37    #[string = "CrashDamage"]
38    CrashDamage,
39    /// A dance move.
40    #[string = "Dance"]
41    Dance,
42    /// Can target a Mon no matter its distance from the user.
43    #[string = "Distance"]
44    Distance,
45    /// Raises the user's evasion.
46    #[string = "EvasionRaising"]
47    EvasionRaising,
48    /// Cannot be selected by Copycat.
49    #[string = "FailCopycat"]
50    FailCopycat,
51    /// Cannot be targeted by Encore.
52    #[string = "FailEncore"]
53    FailEncore,
54    /// Cannot be repeated by Instruct.
55    #[string = "FailInstruct"]
56    FailInstruct,
57    /// Cannot be selected by Me First.
58    #[string = "FailMeFirst"]
59    FailMeFirst,
60    /// Cannot be copied by Mimic.
61    #[string = "FailMimic"]
62    FailMimic,
63    /// Damages a target in the future.
64    #[string = "Future"]
65    Future,
66    /// Cannot be used during Gravity's effect.
67    #[string = "Gravity"]
68    Gravity,
69    /// Cannot be used during Heal Block's effect.
70    #[string = "Heal"]
71    Heal,
72    /// Can be used in Dynamax.
73    #[string = "Max"]
74    Max,
75    /// Can be copied by Mirror Move.
76    #[string = "Mirror"]
77    Mirror,
78    /// Additional PP is deducted due to Pressure when it ordinarily would not be.
79    #[string = "MustPressure"]
80    MustPressure,
81    /// Cannot be selected by Assist.
82    #[string = "NoAssist"]
83    NoAssist,
84    /// Cannot be used by Metronome.
85    #[string = "NoMetronome"]
86    NoMetronome,
87    /// Cannot be made to hit twice via Parental Bond.
88    #[string = "NoParentalBond"]
89    NoParentalBond,
90    /// Cannot be copied by Sketch.
91    #[string = "NoSketch"]
92    NoSketch,
93    /// Cannot be selected by sleep talk.
94    #[string = "NoSleepTalk"]
95    NoSleepTalk,
96    /// A one-hit KO move.
97    #[string = "OHKO"]
98    OHKO,
99    /// Gems will not activate, and cannot be redirected by Storm Drain or Lightning Rod.
100    #[string = "PledgeCombo"]
101    PledgeCombo,
102    /// A powder move.
103    #[string = "Powder"]
104    Powder,
105    /// Blocked by protection moves.
106    #[string = "Protect"]
107    Protect,
108    /// A pulse move.
109    #[string = "Pulse"]
110    Pulse,
111    /// A punch move.
112    #[string = "Punch"]
113    Punch,
114    /// A move requiring recharge if successful.
115    #[string = "Recharge"]
116    Recharge,
117    /// A reflectable move.
118    #[string = "Reflectable"]
119    Reflectable,
120    /// A sleep-inducing move.
121    #[string = "SleepInducing"]
122    SleepInducing,
123    /// A sleep-usable move.
124    #[string = "SleepUsable"]
125    SleepUsable,
126    /// A slicing move.
127    #[string = "Slicing"]
128    Slicing,
129    /// Can be stolen from the original user via Snatch.
130    #[string = "Snatch"]
131    Snatch,
132    /// A sound move.
133    #[string = "Sound"]
134    Sound,
135    /// A stalling move.
136    #[string = "Stalling"]
137    Stalling,
138    /// A thawing move.
139    #[string = "Thawing"]
140    Thawing,
141    /// Thaws the target when hit.
142    #[string = "ThawsTarget"]
143    ThawsTarget,
144    /// Move is weakened when hitting through protection.
145    #[string = "WeakenThroughProtection"]
146    WeakenThroughProtection,
147    /// A wind move.
148    #[string = "Wind"]
149    Wind,
150    /// A Z-Move.
151    #[string = "Z"]
152    Z,
153}
154
155#[cfg(test)]
156mod move_flags_test {
157    use crate::{
158        MoveFlag,
159        test_util::{
160            test_string_deserialization,
161            test_string_serialization,
162        },
163    };
164
165    #[test]
166    fn serializes_to_string() {
167        test_string_serialization(MoveFlag::BypassSubstitute, "BypassSubstitute");
168        test_string_serialization(MoveFlag::Bite, "Bite");
169        test_string_serialization(MoveFlag::Thawing, "Thawing");
170    }
171
172    #[test]
173    fn deserializes_lowercase() {
174        test_string_deserialization("charge", MoveFlag::Charge);
175        test_string_deserialization("noparentalbond", MoveFlag::NoParentalBond);
176        test_string_deserialization("reflectable", MoveFlag::Reflectable);
177    }
178}