Removes derive-getters, as it was incredibly annoying in IDEs, and couldn't figure out borrow lifetimes.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use super::statistics::Statistic;
|
||||
use derive_getters::Getters;
|
||||
use num_traits::PrimInt;
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Copy, Clone, Debug, Getters)]
|
||||
#[derive(Default, Eq, PartialEq, Copy, Clone, Debug)]
|
||||
pub struct StatisticSet<T>
|
||||
where
|
||||
T: PrimInt,
|
||||
@@ -37,6 +36,25 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hp(&self) -> T {
|
||||
self.hp
|
||||
}
|
||||
pub fn attack(&self) -> T {
|
||||
self.attack
|
||||
}
|
||||
pub fn defense(&self) -> T {
|
||||
self.defense
|
||||
}
|
||||
pub fn special_attack(&self) -> T {
|
||||
self.special_attack
|
||||
}
|
||||
pub fn special_defense(&self) -> T {
|
||||
self.special_defense
|
||||
}
|
||||
pub fn speed(&self) -> T {
|
||||
self.speed
|
||||
}
|
||||
|
||||
pub const fn get_stat(&self, stat: Statistic) -> T {
|
||||
match stat {
|
||||
Statistic::HP => self.hp,
|
||||
@@ -82,7 +100,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Copy, Clone, Debug, Getters)]
|
||||
#[derive(Default, Eq, PartialEq, Copy, Clone, Debug)]
|
||||
pub struct ClampedStatisticSet<T, const MIN: i64, const MAX: i64>
|
||||
where
|
||||
T: PrimInt,
|
||||
@@ -99,6 +117,25 @@ impl<T, const MIN: i64, const MAX: i64> ClampedStatisticSet<T, MIN, MAX>
|
||||
where
|
||||
T: PrimInt,
|
||||
{
|
||||
pub fn hp(&self) -> T {
|
||||
self.hp
|
||||
}
|
||||
pub fn attack(&self) -> T {
|
||||
self.attack
|
||||
}
|
||||
pub fn defense(&self) -> T {
|
||||
self.defense
|
||||
}
|
||||
pub fn special_attack(&self) -> T {
|
||||
self.special_attack
|
||||
}
|
||||
pub fn special_defense(&self) -> T {
|
||||
self.special_defense
|
||||
}
|
||||
pub fn speed(&self) -> T {
|
||||
self.speed
|
||||
}
|
||||
|
||||
pub const fn get_stat(&self, stat: Statistic) -> T {
|
||||
match stat {
|
||||
Statistic::HP => self.hp,
|
||||
|
||||
Reference in New Issue
Block a user