Module:Items: Difference between revisions

Added support for stab/slash/block bonuses
(better debugging)
(Added support for stab/slash/block bonuses)
Line 26: Line 26:
   if item ~= nil then
   if item ~= nil then
     local result = item[StatName]
     local result = item[StatName]
    --Special Overrides:
    if StatName == 'stabBonus' then
      if item.attackBonus == nil then
        result = nil
      else
        result = item.attackBonus[1]
      end
    elseif StatName == 'slashBonus' then
      if item.attackBonus == nil then
        result = nil
      else
        result = item.attackBonus[2]
      end
    elseif StatName == 'blockBonus' then
      if item.attackBonus == nil then
        result = nil
      else
        result = item.attackBonus[3]
      end
    end
     if result == nil and ZeroIfNil then result = 0 end
     if result == nil and ZeroIfNil then result = 0 end
     return result
     return result