Changes for Statistic Sets, use a new way for Atomic traits.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use std::fmt::Debug;
|
||||
use std::sync::atomic::AtomicU32;
|
||||
|
||||
use crate::dynamic_data::Pokemon;
|
||||
use crate::static_data::Statistic;
|
||||
@@ -8,11 +7,11 @@ use crate::static_data::StatisticSet;
|
||||
/// A battle stat calculator is used to calculate stats for a Pokemon.
|
||||
pub trait BattleStatCalculator: Debug {
|
||||
/// Calculate all the flat stats of a Pokemon, disregarding stat boosts.
|
||||
fn calculate_flat_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<AtomicU32>);
|
||||
fn calculate_flat_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<u32>);
|
||||
/// Calculate a single flat stat of a Pokemon, disregarding stat boost
|
||||
fn calculate_flat_stat(&self, pokemon: &Pokemon, stat: Statistic) -> u32;
|
||||
/// Calculate all the boosted stats of a Pokemon, including stat boosts.
|
||||
fn calculate_boosted_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<AtomicU32>);
|
||||
fn calculate_boosted_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<u32>);
|
||||
/// Calculate a single boosted stat of a Pokemon, including stat boosts.
|
||||
fn calculate_boosted_stat(&self, pokemon: &Pokemon, stat: Statistic) -> u32;
|
||||
}
|
||||
@@ -64,7 +63,7 @@ impl Gen7BattleStatCalculator {
|
||||
}
|
||||
|
||||
impl BattleStatCalculator for Gen7BattleStatCalculator {
|
||||
fn calculate_flat_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<AtomicU32>) {
|
||||
fn calculate_flat_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<u32>) {
|
||||
stats.set_stat(Statistic::HP, self.calculate_health_stat(pokemon));
|
||||
stats.set_stat(Statistic::Attack, self.calculate_other_stat(pokemon, Statistic::Attack));
|
||||
stats.set_stat(
|
||||
@@ -90,7 +89,7 @@ impl BattleStatCalculator for Gen7BattleStatCalculator {
|
||||
}
|
||||
}
|
||||
|
||||
fn calculate_boosted_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<AtomicU32>) {
|
||||
fn calculate_boosted_stats(&self, pokemon: &Pokemon, stats: &StatisticSet<u32>) {
|
||||
stats.set_stat(Statistic::HP, self.calculate_boosted_stat(pokemon, Statistic::HP));
|
||||
stats.set_stat(
|
||||
Statistic::Attack,
|
||||
|
||||
Reference in New Issue
Block a user