PkmnLib_rs/src/dynamic_data/models/battle_random.rs

31 lines
618 B
Rust
Raw Normal View History

2022-06-03 14:35:18 +00:00
use crate::utils::random::Random;
use std::fmt::{Debug, Formatter};
pub struct BattleRandom {
random: Random,
}
impl Debug for BattleRandom {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
f.debug_struct("BattleRandom").finish()
}
}
impl BattleRandom {
pub fn new() -> Self {
return BattleRandom {
random: Default::default(),
};
}
pub fn new_with_seed(seed: u128) -> Self {
return BattleRandom {
random: Random::new(seed),
};
}
pub fn get_rng(&mut self) -> &mut Random {
&mut self.random
}
}