Some updates
Build Failed The build failed
Gitea/epoch_forge/pipeline/head There was a failure building this commit
Details
Build Failed The build failed
Gitea/epoch_forge/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
fa4f6dff00
commit
c07f554b38
|
|
@ -240,34 +240,54 @@ pub struct OverallStats {
|
|||
}
|
||||
impl OverallStats {
|
||||
/// Create Stats with a given rng distribution
|
||||
// TODO[6]: Use an iterator over the stat enum
|
||||
pub(crate) fn create_rng(
|
||||
rng: &RngLevel,
|
||||
mut rng_t: &mut ThreadRng,
|
||||
) -> Result<OverallStats, EpochError> {
|
||||
let r = rng.to_rng()?;
|
||||
Ok(Self {
|
||||
demographics: (r.sample(&mut rng_t) as isize).into(),
|
||||
let mut overall_stats = Self {
|
||||
demographics: 0.into(),
|
||||
population: (r.sample(&mut rng_t) as isize).into(),
|
||||
growth_rate: (r.sample(&mut rng_t) as isize).into(),
|
||||
crime: (r.sample(&mut rng_t) as isize).into(),
|
||||
happiness: (r.sample(&mut rng_t) as isize).into(),
|
||||
economy: (r.sample(&mut rng_t) as isize).into(),
|
||||
economy: 0.into(),
|
||||
food: (r.sample(&mut rng_t) as isize).into(),
|
||||
industry: (r.sample(&mut rng_t) as isize).into(),
|
||||
science: (r.sample(&mut rng_t) as isize).into(),
|
||||
trade: (r.sample(&mut rng_t) as isize).into(),
|
||||
military: (r.sample(&mut rng_t) as isize).into(),
|
||||
military: 0.into(),
|
||||
army: (r.sample(&mut rng_t) as isize).into(),
|
||||
strength: (r.sample(&mut rng_t) as isize).into(),
|
||||
fortification: (r.sample(&mut rng_t) as isize).into(),
|
||||
threat: (r.sample(&mut rng_t) as isize).into(),
|
||||
infrastructure: (r.sample(&mut rng_t) as isize).into(),
|
||||
infrastructure: 0.into(),
|
||||
bureaucracy: (r.sample(&mut rng_t) as isize).into(),
|
||||
transportation: (r.sample(&mut rng_t) as isize).into(),
|
||||
sprawl: (r.sample(&mut rng_t) as isize).into(),
|
||||
health: (r.sample(&mut rng_t) as isize).into(),
|
||||
})
|
||||
};
|
||||
overall_stats.update();
|
||||
Ok(overall_stats)
|
||||
}
|
||||
|
||||
/// Updates the inner meta values
|
||||
fn update(&mut self) {
|
||||
self.demographics =
|
||||
(*(self.population + self.growth_rate + self.happiness - self.crime) / 4).into();
|
||||
self.economy = (*(self.food + self.industry + self.trade + self.science) / 4).into();
|
||||
self.military =
|
||||
(*(self.army + self.strength + self.fortification + self.threat) / 4).into();
|
||||
self.infrastructure =
|
||||
(*(self.bureaucracy + self.transportation + self.sprawl + self.health) / 4).into();
|
||||
}
|
||||
|
||||
/// Updates with events
|
||||
/// Updates with leader
|
||||
/// etc.
|
||||
// TODO: Fill this
|
||||
fn apply_exteriors(&mut self) {}
|
||||
}
|
||||
|
||||
/// Strategic context and meta-data for an entity.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ macro_rules! thin_newtype {
|
|||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
Copy,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
|
|
|
|||
Loading…
Reference in New Issue