Module:AttackSpell

From CrawlWiki
Revision as of 20:34, 22 May 2014 by CommanderC (talk | contribs) (Created page with "local p = {} function p.calc_hit(frame) local hit_adder = tonumber(frame.args[1]) local hit_num = tonumber(frame.args[2]) local hit_denom = tonumber(frame.args[3]) l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Documentation for this module may be created at Module:AttackSpell/doc

local p = {}
 
function p.calc_hit(frame)
  local hit_adder = tonumber(frame.args[1])
  local hit_num = tonumber(frame.args[2])
  local hit_denom = tonumber(frame.args[3])
  local power = tonumber(frame.args[4])
  local powercap = tonumber(frame.args[5])
  if power > powercap then
    power = powercap
  end
  return tostring(hit_adder + power * hit_num / hit_denom)
end

return p