Module:Damage: Difference between revisions

no edit summary
(for weird skills - fixed version)
No edit summary
Line 128: Line 128:


         -- Define total/average damage calculation based on damage per hit and hit amount.
         -- Define total/average damage calculation based on damage per hit and hit amount.
         function getTotal(dmg, hits, fval)
         function getTotal(dmg, hits, fval, count)
             local i = 1
             local i = 1
             fvals[fval] = 0
             fvals[fval] = 0
Line 135: Line 135:
                 fvals[fval] = fvals[fval] + data[dmg .. i] * data[hits .. i]
                 fvals[fval] = fvals[fval] + data[dmg .. i] * data[hits .. i]
                 i = i + 1
                 i = i + 1
            end
            -- For skills with multiple same parts, ex. Clementine, Silent Abyss, Enough Mineral
            if count == true then
                fvals[fval] = fvals[fval] * args.count
             end
             end
             -- Apply Useful modifier.
             -- Apply Useful modifier.
Line 145: Line 149:
         -- TODO: Change how this works once the old input method is removed.
         -- TODO: Change how this works once the old input method is removed.
         if inArgs(pr .. 'dmg') then
         if inArgs(pr .. 'dmg') then
             getTotal(pr .. 'dmg', 'hits', 'total_damage' .. su)
             if (inArgs('count')) then
                getTotal(pr .. 'dmg', 'hits', 'each_damage' .. su)
                getTotal(pr .. 'dmg', 'hits', 'total_damage' .. su, true)
            else
                getTotal(pr .. 'dmg', 'hits', 'total_damage' .. su)
            end
           


             if inArgs('avg_hits') then
             if inArgs('avg_hits') then