Round max durability and move durability clamping after modifiers.

fixes #1370
This commit is contained in:
IntegratedQuantum 2025-05-09 17:05:51 +02:00
parent c7d938e965
commit b08aff096c

View File

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