use crate::StringKey; #[doc(inline)] pub use growth_rates::*; #[doc(inline)] pub use items::*; #[doc(inline)] pub use libraries::*; #[doc(inline)] pub use moves::*; #[doc(inline)] pub use natures::*; #[doc(inline)] pub use species_data::*; #[doc(inline)] pub use statistic_set::*; #[doc(inline)] pub use statistics::*; use std::fmt::{Display, Formatter}; #[cfg(test)] pub(crate) mod tests { use super::*; #[doc(inline)] pub use growth_rates::tests::*; #[doc(inline)] pub use items::tests::*; #[doc(inline)] pub use libraries::tests::*; #[doc(inline)] pub use moves::tests::*; #[doc(inline)] pub use natures::tests::*; #[doc(inline)] pub use species_data::tests::*; } /// Growth rates define how fast a Pokemon can level up. mod growth_rates; /// Items are objects which the player can pick up, keep in their Bag, and use in some manner mod items; /// The libraries module holds all data storage types. pub(crate) mod libraries; /// Moves are actions Pokemon can take in battle. mod moves; /// Natures give stat boosts to specific stats. mod natures; /// Species data holds base data for species. mod species_data; /// Statistic sets are collection of different statistics that can be used by Pokemon in multiple ways. mod statistic_set; /// Statistics are numerical values on Pokemon that are used in battle. mod statistics; /// A parameter for an effect. This is basically a simple way to dynamically store multiple different /// primitives on data. #[derive(PartialEq, Debug, Clone)] pub enum EffectParameter { /// A boolean value. Bool(bool), /// An integer value. Stored as a 64 bit int to deal with potentially large numbers. Int(i64), /// A float value. Stored as a 32 bit float. Float(f32), /// A string value. String(StringKey), } impl From for EffectParameter { fn from(b: bool) -> Self { EffectParameter::Bool(b) } } impl From for EffectParameter { fn from(i: i64) -> Self { EffectParameter::Int(i) } } impl From for EffectParameter { fn from(f: f32) -> Self { EffectParameter::Float(f) } } impl From for EffectParameter { fn from(s: StringKey) -> Self { EffectParameter::String(s) } } impl Display for EffectParameter { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { EffectParameter::Bool(v) => f.write_fmt(format_args!("EffectParameter::Bool({v})")), EffectParameter::Int(v) => f.write_fmt(format_args!("EffectParameter::Int({v})")), EffectParameter::Float(v) => f.write_fmt(format_args!("EffectParameter::Float({v})")), EffectParameter::String(v) => f.write_fmt(format_args!("EffectParameter::String({v})")), } } }