Merge branch 'sam/durability-tweaks' into 'master'

Durability tweaks

See merge request veloren/veloren!3985
This commit is contained in:
Samuel Keiffer 2023-07-03 23:34:33 +00:00
commit 645d063dcd
2 changed files with 6 additions and 5 deletions

View File

@ -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)

View File

@ -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,
}
}