Further massive amounts of work

This commit is contained in:
2022-06-06 13:54:59 +02:00
parent df662ce6b5
commit ce33ec0649
33 changed files with 848 additions and 80 deletions

View File

@@ -4,7 +4,7 @@ use crate::static_data::statistic_set::StatisticSet;
use crate::static_data::statistics::Statistic;
use crate::utils::random::Random;
use derive_getters::Getters;
use std::collections::HashSet;
use hashbrown::HashSet;
#[derive(Getters, Debug)]
pub struct Form<'a> {

View File

@@ -1,7 +1,7 @@
use crate::defines::LevelInt;
use crate::static_data::moves::move_data::MoveData;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::HashMap;
use hashbrown::hash_map::Entry::{Occupied, Vacant};
use hashbrown::HashMap;
#[derive(Default, PartialEq, Debug)]
pub struct LearnableMoves<'a> {
@@ -45,7 +45,6 @@ mod tests {
#[test]
fn adds_level_moves() {
let mut moves = LearnableMoves::new();
let move1 = MoveData::new(
"foo",
0,
@@ -70,6 +69,8 @@ mod tests {
SecondaryEffect::empty(),
Default::default(),
);
let mut moves = LearnableMoves::new();
moves.add_level_move(1, &move1);
moves.add_level_move(1, &move2);
@@ -81,7 +82,6 @@ mod tests {
#[test]
fn adds_two_same_moves_at_different_level() {
let mut moves = LearnableMoves::new();
let move1 = MoveData::new(
"foo",
0,
@@ -94,6 +94,8 @@ mod tests {
SecondaryEffect::empty(),
Default::default(),
);
let mut moves = LearnableMoves::new();
moves.add_level_move(1, &move1);
moves.add_level_move(5, &move1);

View File

@@ -2,7 +2,7 @@ use self::super::form::Form;
use crate::static_data::species_data::gender::Gender;
use crate::utils::random::Random;
use derive_getters::Getters;
use std::collections::{HashMap, HashSet};
use hashbrown::{HashMap, HashSet};
#[derive(Debug, Getters)]
pub struct Species<'a> {
@@ -25,15 +25,15 @@ impl<'a> Species<'a> {
default_form: Form<'a>,
flags: HashSet<String>,
) -> Species<'a> {
let mut forms = HashMap::with_capacity(1);
forms.insert("default".to_string(), default_form);
Species {
id,
name: name.to_string(),
gender_rate,
growth_rate: growth_rate.to_string(),
capture_rate,
forms: hashmap! {
"default".to_string() => default_form,
},
forms,
flags,
}
}