This commit is contained in:
@@ -6,6 +6,7 @@ use crate::StringKey;
|
||||
|
||||
/// A library to store all items.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct ItemLibrary {
|
||||
/// The underlying data structure.
|
||||
map: IndexMap<StringKey, Box<Item>>,
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::defines::LevelInt;
|
||||
|
||||
/// This library holds several misc settings for the library.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct LibrarySettings {
|
||||
/// The highest level a Pokemon can be.
|
||||
maximum_level: LevelInt,
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::StringKey;
|
||||
|
||||
/// A library to store all data for Pokemon species.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct SpeciesLibrary {
|
||||
/// The underlying map.
|
||||
map: IndexMap<StringKey, Box<Species>>,
|
||||
|
||||
@@ -17,8 +17,15 @@ impl From<u8> for TypeIdentifier {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u8> for TypeIdentifier {
|
||||
fn into(self) -> u8 {
|
||||
self.val
|
||||
}
|
||||
}
|
||||
|
||||
/// All data related to types and effectiveness.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct TypeLibrary {
|
||||
/// A list of types
|
||||
types: HashMap<StringKey, TypeIdentifier>,
|
||||
|
||||
@@ -153,6 +153,11 @@ impl MoveData {
|
||||
|
||||
/// Arbitrary flags that can be applied to the move.
|
||||
pub fn has_flag(&self, key: &StringKey) -> bool {
|
||||
self.flags.contains(key)
|
||||
self.flags.contains::<StringKey>(key)
|
||||
}
|
||||
|
||||
/// Arbitrary flags that can be applied to the move.
|
||||
pub fn has_flag_by_hash(&self, key_hash: u32) -> bool {
|
||||
self.flags.contains::<u32>(&key_hash)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::StringKey;
|
||||
/// 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),
|
||||
@@ -11,7 +12,7 @@ pub enum EffectParameter {
|
||||
/// A float value. Stored as a 32 bit float.
|
||||
Float(f32),
|
||||
/// A string value.
|
||||
String(String),
|
||||
String(StringKey),
|
||||
}
|
||||
|
||||
/// A secondary effect is an effect on a move that happens after it hits.
|
||||
|
||||
@@ -39,6 +39,7 @@ impl Ability {
|
||||
/// An ability index allows us to find an ability on a form. It combines a bool for whether the
|
||||
/// ability is hidden or not, and then an index of the ability.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct AbilityIndex {
|
||||
/// Whether or not the ability we're referring to is a hidden ability.
|
||||
pub hidden: bool,
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::StringKey;
|
||||
|
||||
/// The data belonging to a Pokemon with certain characteristics.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct Species {
|
||||
/// The national dex identifier of the Pokemon.
|
||||
id: u16,
|
||||
|
||||
@@ -11,6 +11,7 @@ use super::statistics::Statistic;
|
||||
///
|
||||
/// As all data in this type is atomic, threaded access to this struct is completely legal.
|
||||
#[derive(Default, Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct StatisticSet<T>
|
||||
where
|
||||
T: PrimitiveAtom,
|
||||
@@ -206,6 +207,7 @@ where
|
||||
/// A clamped statistic set holds the 6 normal stats for a Pokemon, but ensures it always remains
|
||||
/// between two values (inclusive on the two values).
|
||||
#[derive(Default, Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct ClampedStatisticSet<T, const MIN: i64, const MAX: i64>
|
||||
where
|
||||
T: PrimitiveAtom,
|
||||
|
||||
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||
/// Stats are numerical values on Pokemon that are used in battle.
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[repr(u8)]
|
||||
pub enum Statistic {
|
||||
/// Health Points determine how much damage a Pokemon can receive before fainting.
|
||||
HP,
|
||||
|
||||
Reference in New Issue
Block a user