Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Damage: Difference between revisions

From Gallowpedia, the MediEvil Wiki. You'll be dying to read!
No edit summary
No edit summary
 
Line 21: Line 21:
     local result = bit32.rshift(all, 4)
     local result = bit32.rshift(all, 4)
     return result
     return result
end
function p.calcRes( frame )
  local damage = frame.args[1]
  local multiplier = frame.args[2]
  local result = (damage * multiplier) * multiplier
  return result
end
end


return p
return p

Latest revision as of 21:25, 19 March 2025

This is a collection of functions for calculating damage in MediEvil games.


local p = {} --p stands for package

local bit32 = require( 'bit32' )

function p.calcRD( frame )
    local sharpness = frame.args[1] * frame.args[5]
    local weight = frame.args[2] * frame.args[6]
    local fire = frame.args[3] * frame.args[7]
    local magic = frame.args[4] * frame.args[8]
    local all = sharpness + weight + fire + magic
    local result = bit32.rshift(all, 2) * 25
    return result
end

function p.calc( frame )
    local sharpness = frame.args[1] * frame.args[5]
    local weight = frame.args[2] * frame.args[6]
    local fire = frame.args[3] * frame.args[7]
    local magic = frame.args[4] * frame.args[8]
    local all = sharpness + weight + fire + magic
    local result = bit32.rshift(all, 4)
    return result
end

function p.calcRes( frame )
   local damage = frame.args[1]
   local multiplier = frame.args[2]
   local result = (damage * multiplier) * multiplier
   return result
end

return p