From b08aff096c5d01fadabad61ba6fdf72c9c9eb49d Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Fri, 9 May 2025 17:05:51 +0200 Subject: [PATCH] Round max durability and move durability clamping after modifiers. fixes #1370 --- src/items.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/items.zig b/src/items.zig index ccb8dc23..41b2c3d1 100644 --- a/src/items.zig +++ b/src/items.zig @@ -358,7 +358,6 @@ const ToolPhysics = struct { // MARK: ToolPhysics sum *= property.resultScale; tool.getProperty(property.destination orelse continue).* += sum; } - if(tool.maxDurability < 1) tool.maxDurability = 1; if(tool.damage < 1) tool.damage = 1/(2 - tool.damage); if(tool.swingTime < 1) tool.swingTime = 1/(2 - tool.swingTime); for(0..25) |i| { @@ -384,7 +383,9 @@ const ToolPhysics = struct { // MARK: ToolPhysics mod.changeToolParameters(tool); } - tool.durability = @max(1, std.math.lossyCast(u32, tool.maxDurability)); + tool.maxDurability = @round(tool.maxDurability); + if(tool.maxDurability < 1) tool.maxDurability = 1; + tool.durability = std.math.lossyCast(u32, tool.maxDurability); } };