2,875
edits
Falterfire (talk | contribs) (added code to quickly find all lifesteal weapons. Not used anywhere, but I'm saving it in case it's useful later) |
(Add exception to prevent summoningMaxhit from being seen as a combat stat for Familiars) |
||
Line 167: | Line 167: | ||
function p.hasCombatStats(item) | function p.hasCombatStats(item) | ||
-- Checks if the combat stat is a valid, non-zero combat stat | |||
-- Ensure that, only in the case where the item is a Familar AND | |||
-- the checked stat is summoningMaxhit, the result is ignored. | |||
function isNonZeroStat(statName, statVal) | |||
if item.type == 'Familiar' and statName == 'summoningMaxhit' then | |||
return false | |||
end | |||
return statVal ~= 0 | |||
end | |||
if item.equipmentStats ~= nil then | if item.equipmentStats ~= nil then | ||
-- Ensure at least one stat has a non-zero value | -- Ensure at least one stat has a non-zero value | ||
for statName, statVal in pairs(item.equipmentStats) do | for statName, statVal in pairs(item.equipmentStats) do | ||
if statVal | if isNonZeroStat(statName, statVal) then | ||
return true | return true | ||
end | end | ||
end | end | ||
end | end | ||
return false | return false | ||
end | end |
edits