2023-06-24 12:44:23 +00:00
|
|
|
use crate::StringKey;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use growth_rates::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use items::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use libraries::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use moves::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use natures::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use species_data::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use statistic_set::*;
|
2022-06-19 19:34:08 +00:00
|
|
|
#[doc(inline)]
|
2022-06-11 18:51:37 +00:00
|
|
|
pub use statistics::*;
|
2022-09-18 16:02:13 +00:00
|
|
|
use std::fmt::{Display, Formatter};
|
2022-06-19 19:34:08 +00:00
|
|
|
|
2022-11-28 20:34:28 +00:00
|
|
|
#[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::*;
|
|
|
|
}
|
|
|
|
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Growth rates define how fast a Pokemon can level up.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod growth_rates;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Items are objects which the player can pick up, keep in their Bag, and use in some manner
|
2022-06-19 19:34:08 +00:00
|
|
|
mod items;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// The libraries module holds all data storage types.
|
2022-06-19 19:34:08 +00:00
|
|
|
pub(crate) mod libraries;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Moves are actions Pokemon can take in battle.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod moves;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Natures give stat boosts to specific stats.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod natures;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Species data holds base data for species.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod species_data;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Statistic sets are collection of different statistics that can be used by Pokemon in multiple ways.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod statistic_set;
|
2022-07-01 16:20:16 +00:00
|
|
|
/// Statistics are numerical values on Pokemon that are used in battle.
|
2022-06-19 19:34:08 +00:00
|
|
|
mod statistics;
|
2022-09-18 16:02:13 +00:00
|
|
|
|
|
|
|
/// A parameter for an effect. This is basically a simple way to dynamically store multiple different
|
|
|
|
/// primitives on data.
|
2022-11-27 16:29:29 +00:00
|
|
|
#[derive(PartialEq, Debug, Clone)]
|
2022-09-18 16:02:13 +00:00
|
|
|
pub enum EffectParameter {
|
|
|
|
/// A boolean value.
|
2023-06-24 12:44:23 +00:00
|
|
|
Bool(bool),
|
2022-09-18 16:02:13 +00:00
|
|
|
/// An integer value. Stored as a 64 bit int to deal with potentially large numbers.
|
2023-06-24 12:44:23 +00:00
|
|
|
Int(i64),
|
2022-09-18 16:02:13 +00:00
|
|
|
/// A float value. Stored as a 32 bit float.
|
2023-06-24 12:44:23 +00:00
|
|
|
Float(f32),
|
2022-09-18 16:02:13 +00:00
|
|
|
/// A string value.
|
2023-06-24 12:44:23 +00:00
|
|
|
String(StringKey),
|
2022-10-08 11:15:04 +00:00
|
|
|
}
|
|
|
|
|
2022-10-14 14:53:30 +00:00
|
|
|
impl From<bool> for EffectParameter {
|
|
|
|
fn from(b: bool) -> Self {
|
2023-06-24 12:44:23 +00:00
|
|
|
EffectParameter::Bool(b)
|
2022-10-08 11:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 14:53:30 +00:00
|
|
|
impl From<i64> for EffectParameter {
|
|
|
|
fn from(i: i64) -> Self {
|
2023-06-24 12:44:23 +00:00
|
|
|
EffectParameter::Int(i)
|
2022-10-08 11:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 14:53:30 +00:00
|
|
|
impl From<f32> for EffectParameter {
|
|
|
|
fn from(f: f32) -> Self {
|
2023-06-24 12:44:23 +00:00
|
|
|
EffectParameter::Float(f)
|
2022-10-08 11:15:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 14:53:30 +00:00
|
|
|
impl From<StringKey> for EffectParameter {
|
|
|
|
fn from(s: StringKey) -> Self {
|
2023-06-24 12:44:23 +00:00
|
|
|
EffectParameter::String(s)
|
2022-10-08 11:15:04 +00:00
|
|
|
}
|
2022-09-18 16:02:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Display for EffectParameter {
|
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
|
|
match self {
|
2023-06-24 12:44:23 +00:00
|
|
|
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})")),
|
2022-09-18 16:02:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|