This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::StringKey;
|
||||
#[doc(inline)]
|
||||
pub use growth_rates::*;
|
||||
#[doc(inline)]
|
||||
@@ -14,6 +15,7 @@ pub use species_data::*;
|
||||
pub use statistic_set::*;
|
||||
#[doc(inline)]
|
||||
pub use statistics::*;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
/// Growth rates define how fast a Pokemon can level up.
|
||||
mod growth_rates;
|
||||
@@ -31,3 +33,29 @@ mod species_data;
|
||||
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)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
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 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)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user