From c4b316af1997059ba9f553c0d1a7680810d9a0e0 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 13 Jun 2023 20:49:27 -0400 Subject: [PATCH] Durability tweaks --- common/src/comp/inventory/item/mod.rs | 7 ++++--- common/src/comp/inventory/item/tool.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 2716aac923..2520c426c6 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -787,7 +787,7 @@ impl assets::Asset for RawItemDef { pub struct OperationFailure; impl Item { - pub const MAX_DURABILITY: u32 = 8; + pub const MAX_DURABILITY: u32 = 12; // TODO: consider alternatives such as default abilities that can be added to a // loadout when no weapon is present @@ -1279,8 +1279,9 @@ impl Item { pub fn stats_durability_multiplier(&self) -> DurabilityMultiplier { let durability_lost = self.durability_lost.unwrap_or(0); debug_assert!(durability_lost <= Self::MAX_DURABILITY); - const DURABILITY_THRESHOLD: u32 = 4; - const MIN_FRAC: f32 = 0.2; + // How much durability must be lost before stats start to decay + const DURABILITY_THRESHOLD: u32 = 9; + const MIN_FRAC: f32 = 0.25; let mult = (1.0 - durability_lost.saturating_sub(DURABILITY_THRESHOLD) as f32 / (Self::MAX_DURABILITY - DURABILITY_THRESHOLD) as f32) diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index bf36c9a104..3127da559e 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -162,8 +162,8 @@ impl Stats { effect_power: self.effect_power * dur_mult.0, speed: self.speed * less_scaled, crit_chance: self.crit_chance * dur_mult.0, - range: self.range * dur_mult.0, - energy_efficiency: self.energy_efficiency * dur_mult.0, + range: self.range * less_scaled, + energy_efficiency: self.energy_efficiency * less_scaled, buff_strength: self.buff_strength * dur_mult.0, } }