PkmnLib_rs/src/static_data/libraries/library_settings.rs

34 lines
902 B
Rust
Executable File

use crate::defines::LevelInt;
use crate::{ValueIdentifiable, ValueIdentifier};
/// This library holds several misc settings for the library.
#[derive(Debug)]
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
pub struct LibrarySettings {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The highest level a Pokemon can be.
maximum_level: LevelInt,
}
impl LibrarySettings {
/// Creates a new settings library.
pub fn new(maximum_level: LevelInt) -> Self {
Self {
identifier: Default::default(),
maximum_level,
}
}
/// The highest level a Pokemon can be.
pub fn maximum_level(&self) -> LevelInt {
self.maximum_level
}
}
impl ValueIdentifiable for LibrarySettings {
fn value_identifier(&self) -> ValueIdentifier {
self.identifier
}
}