Differences From
Artifact [0187673a26]:
- File
metallurgy-cold.lua
— part of check-in
[3f6a913e4e]
at
2020-09-29 12:40:28
on branch trunk
— * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior
* initial documentation commit
* initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes
(user:
lexi,
size: 12204)
[annotate]
[blame]
[check-ins using]
129 129 mp.torque = constants.grind_torque_factor * mp.hardness
130 130 mp.grindvalue = mp.grindvalue or constants.default_grindvalue
131 131 mp.grindcost = mp.grindcost or constants.default_grindcost
132 132
133 133 if item:get_wear() ~= 0 then
134 134 -- prevent cheating by recovering metal from items before they
135 135 -- are destroyed
136 - local wearfac = (item:get_wear() / 65535)
136 + local wearfac = 1-(item:get_wear() / 65535)
137 137 mp.grindvalue = math.max(1,math.ceil(mp.grindvalue * wearfac))
138 138 mp.hardness = math.max(1,math.ceil(mp.grindcost * wearfac))
139 139 mp.torque = math.max(1,math.ceil(mp.torque * wearfac))
140 140 end
141 141
142 142 return mp
143 143 end