Module:Damage: Difference between revisions

    From Gallowpedia, the MediEvil Wiki. You'll be dying to read!
    No edit summary
    Tag: Reverted
    No edit summary
    Tag: Reverted
    Line 10: Line 10:
         local all = sharpness + weight + fire + magic
         local all = sharpness + weight + fire + magic
         local result = bit32.rshift(all, 4)
         local result = bit32.rshift(all, 4)
         if result > 0 then return result + " HP" else return "Immune" end
         if result > 0 then return result .. " HP" else return "Immune" end
    end
    end


    return p
    return p

    Revision as of 08:01, 20 November 2023

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

    local p = {} --p stands for package
    
    local bit32 = require( 'bit32' )
    
    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)
        if result > 0 then return result .. " HP" else return "Immune" end
    end
    
    return p