Move Form and Species to traits, implement a bunch of mocks
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-28 21:34:28 +01:00
parent c1e09c654b
commit bce636b97e
25 changed files with 447 additions and 155 deletions

View File

@@ -40,3 +40,17 @@ impl GrowthRate for LookupGrowthRate {
}
}
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub GrowthRate {}
impl GrowthRate for GrowthRate {
fn calculate_level(&self, experience: u32) -> LevelInt;
fn calculate_experience(&self, level: LevelInt) -> u32;
}
}
}

View File

@@ -133,3 +133,26 @@ impl ValueIdentifiable for ItemImpl {
self.identifier
}
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub Item {}
impl Item for Item {
fn name(&self) -> &StringKey;
fn category(&self) -> ItemCategory;
fn battle_category(&self) -> BattleItemCategory;
fn price(&self) -> i32;
fn flags(&self) -> &HashSet<StringKey>;
fn has_flag(&self, key: &StringKey) -> bool;
}
impl ValueIdentifiable for Item {
fn value_identifier(&self) -> ValueIdentifier {
ValueIdentifier::new(0)
}
}
}
}

View File

@@ -19,6 +19,9 @@ pub use static_data::StaticData;
#[doc(inline)]
pub use type_library::*;
#[cfg(test)]
pub(crate) mod tests {}
/// The library data for abilities.
mod ability_library;
/// Basic helper trait for libraries.

View File

@@ -13,7 +13,7 @@ pub struct SpeciesLibrary {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The underlying map.
map: IndexMap<StringKey, Arc<Species>>,
map: IndexMap<StringKey, Arc<dyn Species>>,
}
impl SpeciesLibrary {
@@ -26,11 +26,11 @@ impl SpeciesLibrary {
}
}
impl DataLibrary<Species> for SpeciesLibrary {
fn map(&self) -> &IndexMap<StringKey, Arc<Species>> {
impl DataLibrary<dyn Species> for SpeciesLibrary {
fn map(&self) -> &IndexMap<StringKey, Arc<dyn Species>> {
&self.map
}
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Arc<Species>> {
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Arc<dyn Species>> {
&mut self.map
}
}
@@ -48,18 +48,18 @@ pub mod tests {
use crate::static_data::libraries::data_library::DataLibrary;
use crate::static_data::libraries::species_library::SpeciesLibrary;
use crate::static_data::Species;
use crate::static_data::StaticStatisticSet;
use crate::static_data::{Form, LearnableMovesImpl};
use crate::static_data::LearnableMovesImpl;
use crate::static_data::{FormImpl, StaticStatisticSet};
use crate::static_data::{Species, SpeciesImpl};
fn build_species() -> Species {
Species::new(
fn build_species() -> Arc<dyn Species> {
Arc::new(SpeciesImpl::new(
0,
&"foo".into(),
0.5,
&"test_growthrate".into(),
0,
Arc::new(Form::new(
Arc::new(FormImpl::new(
&"default".into(),
0.0,
0.0,
@@ -72,7 +72,7 @@ pub mod tests {
HashSet::new(),
)),
HashSet::new(),
)
))
}
pub fn build() -> SpeciesLibrary {
@@ -80,7 +80,7 @@ pub mod tests {
let species = build_species();
// Borrow as mut so we can insert
let w = &mut lib;
w.add(&"foo".into(), Arc::new(species));
w.add(&"foo".into(), species);
// Drops borrow as mut
lib

View File

@@ -17,6 +17,23 @@ pub use statistic_set::*;
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

View File

@@ -3,6 +3,16 @@ pub use move_data::*;
#[doc(inline)]
pub use secondary_effect::*;
#[cfg(test)]
pub(crate) mod tests {
use super::*;
#[doc(inline)]
pub use move_data::tests::*;
#[doc(inline)]
pub use secondary_effect::tests::*;
}
/// The data belonging to a certain move.
mod move_data;
/// A secondary effect is an effect on a move that happens after it hits.

View File

@@ -208,25 +208,29 @@ impl ValueIdentifiable for MoveDataImpl {
}
#[cfg(test)]
mockall::mock! {
#[derive(Debug)]
pub MoveData{}
impl MoveData for MoveData {
fn name(&self) -> &StringKey;
fn move_type(&self) -> TypeIdentifier;
fn category(&self) -> MoveCategory;
fn base_power(&self) -> u8;
fn accuracy(&self) -> u8;
fn base_usages(&self) -> u8;
fn target(&self) -> MoveTarget;
fn priority(&self) -> i8;
fn secondary_effect(&self) -> &Option<Box<dyn SecondaryEffect>>;
fn has_flag(&self, key: &StringKey) -> bool;
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
}
impl ValueIdentifiable for MoveData{
fn value_identifier(&self) -> ValueIdentifier{
ValueIdentifier::new(0)
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub MoveData{}
impl MoveData for MoveData {
fn name(&self) -> &StringKey;
fn move_type(&self) -> TypeIdentifier;
fn category(&self) -> MoveCategory;
fn base_power(&self) -> u8;
fn accuracy(&self) -> u8;
fn base_usages(&self) -> u8;
fn target(&self) -> MoveTarget;
fn priority(&self) -> i8;
fn secondary_effect(&self) -> &Option<Box<dyn SecondaryEffect>>;
fn has_flag(&self, key: &StringKey) -> bool;
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
}
impl ValueIdentifiable for MoveData{
fn value_identifier(&self) -> ValueIdentifier{
ValueIdentifier::new(0)
}
}
}
}

View File

@@ -59,12 +59,28 @@ impl ValueIdentifiable for SecondaryEffectImpl {
}
#[cfg(test)]
mod tests {
pub(crate) mod tests {
use super::*;
use assert_approx_eq::assert_approx_eq;
use crate::static_data::moves::secondary_effect::SecondaryEffect;
use crate::static_data::SecondaryEffectImpl;
mockall::mock! {
#[derive(Debug)]
pub SecondaryEffect{}
impl SecondaryEffect for SecondaryEffect {
fn chance(&self) -> f32;
fn effect_name(&self) -> &StringKey;
fn parameters(&self) -> &Vec<EffectParameter>;
}
impl ValueIdentifiable for SecondaryEffect{
fn value_identifier(&self) -> ValueIdentifier{
ValueIdentifier::new(0)
}
}
}
#[test]
fn create_secondary_effect() {
let empty = SecondaryEffectImpl::new(0.0, "".into(), vec![]);

View File

@@ -80,3 +80,23 @@ impl ValueIdentifiable for NatureImpl {
self.identifier
}
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub Nature {}
impl Nature for Nature {
fn increased_stat(&self) -> Statistic;
fn decreased_stat(&self) -> Statistic;
fn get_stat_modifier(&self, stat: Statistic) -> f32;
}
impl ValueIdentifiable for Nature {
fn value_identifier(&self) -> ValueIdentifier {
ValueIdentifier::new(0)
}
}
}
}

View File

@@ -68,3 +68,23 @@ pub struct AbilityIndex {
/// The index of the ability.
pub index: u8,
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub Ability{}
impl Ability for Ability {
fn name(&self) -> &StringKey;
fn effect(&self) -> &StringKey;
fn parameters(&self) -> &Vec<EffectParameter>;
}
impl ValueIdentifiable for Ability {
fn value_identifier(&self) -> ValueIdentifier {
ValueIdentifier::new(0)
}
}
}
}

View File

@@ -1,4 +1,5 @@
use hashbrown::HashSet;
use std::fmt::Debug;
use crate::static_data::Statistic;
use crate::static_data::TypeIdentifier;
@@ -7,10 +8,56 @@ use crate::static_data::{AbilityIndex, LearnableMoves};
use crate::StringKey;
use crate::{Random, ValueIdentifiable, ValueIdentifier};
/// A form is a variant of a specific species. A species always has at least one form, but can have
/// many more.
pub trait Form: ValueIdentifiable + Debug {
/// The name of the form.
fn name(&self) -> &StringKey;
/// The height of the form in meters.
fn height(&self) -> f32;
/// The weight of the form in kilograms.
fn weight(&self) -> f32;
/// The base amount of experience that is gained when beating a Pokemon with this form.
fn base_experience(&self) -> u32;
/// The normal types a Pokemon with this form has.
fn types(&self) -> &Vec<TypeIdentifier>;
/// The inherent values of a form of species that are used for the stats of a Pokemon.
fn base_stats(&self) -> &StaticStatisticSet<u16>;
/// The possible abilities a Pokemon with this form can have.
fn abilities(&self) -> &Vec<StringKey>;
/// The possible hidden abilities a Pokemon with this form can have.
fn hidden_abilities(&self) -> &Vec<StringKey>;
#[allow(clippy::borrowed_box)]
/// The moves a Pokemon with this form can learn.
fn moves(&self) -> &Box<dyn LearnableMoves>;
/// Arbitrary flags can be set on a form for scripting use.
fn flags(&self) -> &HashSet<StringKey>;
/// Get a type of the move at a certain index.
fn get_type(&self, index: usize) -> TypeIdentifier;
/// Gets a single base stat value.
fn get_base_stat(&self, stat: Statistic) -> u16;
/// Find the index of an ability that can be on this form.
fn find_ability_index(&self, ability: &dyn Ability) -> Option<AbilityIndex>;
/// Gets an ability from the form.
fn get_ability(&self, index: AbilityIndex) -> &StringKey;
/// Gets a random ability from the form.
fn get_random_ability(&self, rand: &mut Random) -> &StringKey;
/// Gets a random hidden ability from the form.
fn get_random_hidden_ability(&self, rand: &mut Random) -> &StringKey;
/// Check if the form has a specific flag set.
fn has_flag(&self, key: &StringKey) -> bool;
}
/// A form is a variant of a specific species. A species always has at least one form, but can have
/// many more.
#[derive(Debug)]
pub struct Form {
pub struct FormImpl {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The name of the form.
@@ -35,7 +82,7 @@ pub struct Form {
flags: HashSet<StringKey>,
}
impl Form {
impl FormImpl {
/// Instantiates a new form.
pub fn new(
name: &StringKey,
@@ -48,8 +95,8 @@ impl Form {
hidden_abilities: Vec<StringKey>,
moves: Box<dyn LearnableMoves>,
flags: HashSet<StringKey>,
) -> Form {
Form {
) -> Self {
Self {
identifier: Default::default(),
name: name.clone(),
height,
@@ -63,62 +110,64 @@ impl Form {
flags,
}
}
}
impl Form for FormImpl {
/// The name of the form.
pub fn name(&self) -> &StringKey {
fn name(&self) -> &StringKey {
&self.name
}
/// The height of the form in meters.
pub fn height(&self) -> f32 {
fn height(&self) -> f32 {
self.height
}
/// The weight of the form in kilograms.
pub fn weight(&self) -> f32 {
fn weight(&self) -> f32 {
self.weight
}
/// The base amount of experience that is gained when beating a Pokemon with this form.
pub fn base_experience(&self) -> u32 {
fn base_experience(&self) -> u32 {
self.base_experience
}
/// The normal types a Pokemon with this form has.
pub fn types(&self) -> &Vec<TypeIdentifier> {
fn types(&self) -> &Vec<TypeIdentifier> {
&self.types
}
/// The inherent values of a form of species that are used for the stats of a Pokemon.
pub fn base_stats(&self) -> &StaticStatisticSet<u16> {
fn base_stats(&self) -> &StaticStatisticSet<u16> {
&self.base_stats
}
/// The possible abilities a Pokemon with this form can have.
pub fn abilities(&self) -> &Vec<StringKey> {
fn abilities(&self) -> &Vec<StringKey> {
&self.abilities
}
/// The possible hidden abilities a Pokemon with this form can have.
pub fn hidden_abilities(&self) -> &Vec<StringKey> {
fn hidden_abilities(&self) -> &Vec<StringKey> {
&self.hidden_abilities
}
#[allow(clippy::borrowed_box)]
/// The moves a Pokemon with this form can learn.
pub fn moves(&self) -> &Box<dyn LearnableMoves> {
fn moves(&self) -> &Box<dyn LearnableMoves> {
&self.moves
}
/// Arbitrary flags can be set on a form for scripting use.
pub fn flags(&self) -> &HashSet<StringKey> {
fn flags(&self) -> &HashSet<StringKey> {
&self.flags
}
/// Get a type of the move at a certain index.
pub fn get_type(&self, index: usize) -> TypeIdentifier {
fn get_type(&self, index: usize) -> TypeIdentifier {
self.types[index]
}
/// Gets a single base stat value.
pub fn get_base_stat(&self, stat: Statistic) -> u16 {
fn get_base_stat(&self, stat: Statistic) -> u16 {
self.base_stats.get_stat(stat)
}
/// Find the index of an ability that can be on this form.
pub fn find_ability_index(&self, ability: &dyn Ability) -> Option<AbilityIndex> {
fn find_ability_index(&self, ability: &dyn Ability) -> Option<AbilityIndex> {
for (index, a) in self.abilities.iter().enumerate() {
if a == ability.name() {
return Some(AbilityIndex {
@@ -139,7 +188,7 @@ impl Form {
}
/// Gets an ability from the form.
pub fn get_ability(&self, index: AbilityIndex) -> &StringKey {
fn get_ability(&self, index: AbilityIndex) -> &StringKey {
if index.hidden {
&self.hidden_abilities[index.index as usize]
} else {
@@ -148,22 +197,57 @@ impl Form {
}
/// Gets a random ability from the form.
pub fn get_random_ability(&self, rand: &mut Random) -> &StringKey {
fn get_random_ability(&self, rand: &mut Random) -> &StringKey {
&self.abilities[rand.get_between_unsigned(0, self.abilities.len() as u32) as usize]
}
/// Gets a random hidden ability from the form.
pub fn get_random_hidden_ability(&self, rand: &mut Random) -> &StringKey {
fn get_random_hidden_ability(&self, rand: &mut Random) -> &StringKey {
&self.hidden_abilities[rand.get_between_unsigned(0, self.hidden_abilities.len() as u32) as usize]
}
/// Check if the form has a specific flag set.
pub fn has_flag(&self, key: &StringKey) -> bool {
fn has_flag(&self, key: &StringKey) -> bool {
self.flags.contains(key)
}
}
impl ValueIdentifiable for Form {
impl ValueIdentifiable for FormImpl {
fn value_identifier(&self) -> ValueIdentifier {
self.identifier
}
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub Form {}
impl Form for Form {
fn name(&self) -> &StringKey;
fn height(&self) -> f32;
fn weight(&self) -> f32;
fn base_experience(&self) -> u32;
fn types(&self) -> &Vec<TypeIdentifier>;
fn base_stats(&self) -> &StaticStatisticSet<u16>;
fn abilities(&self) -> &Vec<StringKey>;
fn hidden_abilities(&self) -> &Vec<StringKey>;
#[allow(clippy::borrowed_box)]
fn moves(&self) -> &Box<dyn LearnableMoves>;
fn flags(&self) -> &HashSet<StringKey>;
fn get_type(&self, index: usize) -> TypeIdentifier;
fn get_base_stat(&self, stat: Statistic) -> u16;
fn find_ability_index(&self, ability: &dyn Ability) -> Option<AbilityIndex>;
fn get_ability(&self, index: AbilityIndex) -> &StringKey;
fn get_random_ability(&self, rand: &mut Random) -> &StringKey;
fn get_random_hidden_ability(&self, rand: &mut Random) -> &StringKey;
fn has_flag(&self, key: &StringKey) -> bool;
}
impl ValueIdentifiable for Form {
fn value_identifier(&self) -> ValueIdentifier {
ValueIdentifier::new(0)
}
}
}
}

View File

@@ -59,9 +59,8 @@ impl LearnableMoves for LearnableMovesImpl {
}
#[cfg(test)]
mod tests {
use crate::static_data::species_data::learnable_moves::LearnableMoves;
use crate::static_data::LearnableMovesImpl;
pub(crate) mod tests {
use super::*;
#[test]
fn adds_level_moves() {
@@ -92,4 +91,12 @@ mod tests {
assert_eq!(distinct.len(), 1);
assert_eq!(distinct[0], "foo".into());
}
mockall::mock! {
pub LearnableMoves {
fn add_level_move(&mut self, level: LevelInt, m: &StringKey);
fn get_learned_by_level<'a>(&'a self, level: LevelInt) -> Option<&'a Vec<StringKey>>;
fn get_distinct_level_moves(&self) -> &Vec<StringKey>;
}
}
}

View File

@@ -9,6 +9,14 @@ pub use learnable_moves::*;
#[doc(inline)]
pub use species::*;
#[cfg(test)]
pub(crate) mod tests {
pub use super::ability::tests::*;
pub use super::form::tests::*;
pub use super::learnable_moves::tests::*;
pub use super::species::tests::*;
}
/// An ability is a passive effect in battle that is attached to a Pokemon.
mod ability;
/// A form is a variant of a specific species. A species always has at least one form, but can have

View File

@@ -1,3 +1,4 @@
use std::fmt::Debug;
use std::sync::{Arc, LazyLock};
use hashbrown::{HashMap, HashSet};
@@ -9,9 +10,38 @@ use crate::static_data::Gender;
use crate::StringKey;
use crate::{Random, ValueIdentifiable, ValueIdentifier};
/// The data belonging to a Pokemon with certain characteristics.
pub trait Species: ValueIdentifiable + Debug {
/// The national dex identifier of the Pokemon.
fn id(&self) -> u16;
/// The name of the Pokemon.
fn name(&self) -> &StringKey;
/// The chance between 0.0 and 1.0 that a Pokemon is female.
fn gender_rate(&self) -> f32;
/// How much experience is required for a level.
fn growth_rate(&self) -> &StringKey;
/// How hard it is to capture a Pokemon. 255 means this will be always caught, 0 means this is
/// uncatchable.
fn capture_rate(&self) -> u8;
/// The forms that belong to this Pokemon.
fn forms(&self) -> RwLockReadGuard<'_, RawRwLock, HashMap<StringKey, Arc<dyn Form>>>;
/// The arbitrary flags that can be set on a Pokemon for script use.
fn flags(&self) -> &HashSet<StringKey>;
/// Adds a new form to the species.
fn add_form(&self, id: StringKey, form: Arc<dyn Form>);
/// Gets a form by name.
fn get_form(&self, id: &StringKey) -> Option<Arc<dyn Form>>;
/// Gets the form the Pokemon will have by default, if no other form is specified.
fn get_default_form(&self) -> Arc<dyn Form>;
/// Gets a random gender.
fn get_random_gender(&self, rand: &mut Random) -> Gender;
/// Check whether the Pokemon has a specific flag set.
fn has_flag(&self, key: &StringKey) -> bool;
}
/// The data belonging to a Pokemon with certain characteristics.
#[derive(Debug)]
pub struct Species {
pub struct SpeciesImpl {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The national dex identifier of the Pokemon.
@@ -26,7 +56,7 @@ pub struct Species {
/// uncatchable.
capture_rate: u8,
/// The forms that belong to this Pokemon.
forms: RwLock<HashMap<StringKey, Arc<Form>>>,
forms: RwLock<HashMap<StringKey, Arc<dyn Form>>>,
/// The arbitrary flags that can be set on a Pokemon for script use.
flags: HashSet<StringKey>,
}
@@ -39,7 +69,7 @@ fn get_default_key() -> StringKey {
DEFAULT_KEY.clone()
}
impl Species {
impl SpeciesImpl {
/// Creates a new species.
pub fn new(
id: u16,
@@ -47,12 +77,12 @@ impl Species {
gender_rate: f32,
growth_rate: &StringKey,
capture_rate: u8,
default_form: Arc<Form>,
default_form: Arc<dyn Form>,
flags: HashSet<StringKey>,
) -> Species {
) -> Self {
let mut forms = HashMap::with_capacity(1);
forms.insert_unique_unchecked(get_default_key(), default_form);
Species {
Self {
identifier: Default::default(),
id,
name: name.clone(),
@@ -63,54 +93,56 @@ impl Species {
flags,
}
}
}
impl Species for SpeciesImpl {
/// The national dex identifier of the Pokemon.
pub fn id(&self) -> u16 {
fn id(&self) -> u16 {
self.id
}
/// The name of the Pokemon.
pub fn name(&self) -> &StringKey {
fn name(&self) -> &StringKey {
&self.name
}
/// The chance between 0.0 and 1.0 that a Pokemon is female.
pub fn gender_rate(&self) -> f32 {
fn gender_rate(&self) -> f32 {
self.gender_rate
}
/// How much experience is required for a level.
pub fn growth_rate(&self) -> &StringKey {
fn growth_rate(&self) -> &StringKey {
&self.growth_rate
}
/// How hard it is to capture a Pokemon. 255 means this will be always caught, 0 means this is
/// uncatchable.
pub fn capture_rate(&self) -> u8 {
fn capture_rate(&self) -> u8 {
self.capture_rate
}
/// The forms that belong to this Pokemon.
pub fn forms(&self) -> RwLockReadGuard<'_, RawRwLock, HashMap<StringKey, Arc<Form>>> {
fn forms(&self) -> RwLockReadGuard<'_, RawRwLock, HashMap<StringKey, Arc<dyn Form>>> {
self.forms.read()
}
/// The arbitrary flags that can be set on a Pokemon for script use.
pub fn flags(&self) -> &HashSet<StringKey> {
fn flags(&self) -> &HashSet<StringKey> {
&self.flags
}
/// Adds a new form to the species.
pub fn add_form(&self, id: StringKey, form: Arc<Form>) {
fn add_form(&self, id: StringKey, form: Arc<dyn Form>) {
self.forms.write().insert(id, form);
}
/// Gets a form by name.
pub fn get_form(&self, id: &StringKey) -> Option<Arc<Form>> {
fn get_form(&self, id: &StringKey) -> Option<Arc<dyn Form>> {
self.forms.read().get(id).cloned()
}
/// Gets the form the Pokemon will have by default, if no other form is specified.
pub fn get_default_form(&self) -> Arc<Form> {
fn get_default_form(&self) -> Arc<dyn Form> {
self.forms.read().get(&get_default_key()).unwrap().clone()
}
/// Gets a random gender.
pub fn get_random_gender(&self, rand: &mut Random) -> Gender {
fn get_random_gender(&self, rand: &mut Random) -> Gender {
if self.gender_rate < 0.0 {
Gender::Genderless
} else if rand.get_float() >= self.gender_rate {
@@ -121,13 +153,42 @@ impl Species {
}
/// Check whether the Pokemon has a specific flag set.
pub fn has_flag(&self, key: &StringKey) -> bool {
fn has_flag(&self, key: &StringKey) -> bool {
self.flags.contains(key)
}
}
impl ValueIdentifiable for Species {
impl ValueIdentifiable for SpeciesImpl {
fn value_identifier(&self) -> ValueIdentifier {
self.identifier
}
}
#[cfg(test)]
pub(crate) mod tests {
use super::*;
mockall::mock! {
#[derive(Debug)]
pub Species {}
impl Species for Species {
fn id(&self) -> u16;
fn name(&self) -> &StringKey;
fn gender_rate(&self) -> f32;
fn growth_rate(&self) -> &StringKey;
fn capture_rate(&self) -> u8;
fn forms(&self) -> RwLockReadGuard<'_, RawRwLock, HashMap<StringKey, Arc<dyn Form>>>;
fn flags(&self) -> &HashSet<StringKey>;
fn add_form(&self, id: StringKey, form: Arc<dyn Form>);
fn get_form(&self, id: &StringKey) -> Option<Arc<dyn Form>>;
fn get_default_form(&self) -> Arc<dyn Form>;
fn get_random_gender(&self, rand: &mut Random) -> Gender;
fn has_flag(&self, key: &StringKey) -> bool;
}
impl ValueIdentifiable for Species {
fn value_identifier(&self) -> ValueIdentifier {
ValueIdentifier::new(0)
}
}
}
}