Miscellany
public text v1 · immutablefunction defenseCalc(item)
for i = 0, item.stats:size() -1 do
if item.stats[i].Stat.Stat == "armorclass" then
basedef = item.stats[i].Value
break
end
end
if basedef then
for i = 0, item.mods:size() -1 do
if item.mods[i].Stat.Stat == "item_armor_percent" then
edef = item.mods[i].Value
elseif item.mods[i].Stat.Stat == "armorclass" then
adef = item.mods[i].Value
end
end
else
return -1
end
return (basedef * (edef / 100 + 1) + adef)
end