mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
base in AttributeInstance
This commit is contained in:
parent
d31aeb9abc
commit
d672a9c89f
1 changed files with 5 additions and 4 deletions
|
@ -11,17 +11,18 @@ pub struct AttributeModifiers {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AttributeInstance<const BASE: f64> {
|
||||
pub struct AttributeInstance {
|
||||
pub base: f64,
|
||||
pub modifiers: Vec<AttributeModifier>,
|
||||
}
|
||||
|
||||
impl<const BASE: f64> AttributeInstance {
|
||||
impl AttributeInstance {
|
||||
pub fn calculate(&self) -> f64 {
|
||||
let mut total = BASE;
|
||||
let mut total = self.base;
|
||||
for modifier in self.modifiers {
|
||||
match modifier.operation {
|
||||
AttributeModifierOperation::Addition => total += modifier.amount,
|
||||
AttributeModifierOperation::MultiplyBase => total += BASE * modifier.amount,
|
||||
AttributeModifierOperation::MultiplyBase => total += self.base * modifier.amount,
|
||||
_ => {}
|
||||
}
|
||||
match modifier.operation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue