Created
October 15, 2015 06:24
-
-
Save Midiman/766db960dfa8baf6983b to your computer and use it in GitHub Desktop.
Skullgirls Damage Calc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("io") | |
local Moves = { | |
stLP = {cmd = "5LP", name = "Standing Jab", hits = 1, dmg = 300}, | |
stMP = {cmd = "5MP", name = "Standing Strong", hits = 1, dmg = 550}, | |
stHP = {cmd = "5HP", name = "Standing Fierce", hits = 1, dmg = 100}, | |
stLK = {cmd = "5LK", name = "Standing Short", hits = 1, dmg = 400}, | |
stMK = {cmd = "5MK", name = "Standing Forward", hits = 1, dmg = 450}, | |
stHK = {cmd = "5HK", name = "Standing Roundhouse", hits = 1, dmg = 1000}, | |
crLP = {cmd = "2LP", name = "Crouching Jab", hits = 1, dmg = 200}, | |
crMP = {cmd = "2MP", name = "Crouching Strong", hits = 1, dmg = 600}, | |
crHP = {cmd = "2HP", name = "Crouching Fierce", hits = 1, dmg = 900}, | |
crLK = {cmd = "2LK", name = "Crouching Short", hits = 1, dmg = 200}, | |
crMK = {cmd = "2MK", name = "Crouching Forward", hits = 5, dmg = {150,150,200,250,400}}, | |
crHK = {cmd = "2HK", name = "Crouching Roundhouse", hits = 1, dmg = 1100}, | |
jLP = {cmd = "j.LP", name = "Jumping Jab", hits = 1, dmg = 250}, | |
jMP = {cmd = "j.MP", name = "Jumping Strong", hits = 6, dmg = {150,150,150,150,150,250}}, | |
jHP = {cmd = "j.HP", name = "Jumping Fierce", hits = 1, dmg = 900}, | |
jLK = {cmd = "j.LK", name = "Jumping Short", hits = 1, dmg = 250}, | |
jMK = {cmd = "j.MK", name = "Jumping Forward", hits = 2, dmg = {200,350}}, | |
jHK = {cmd = "j.HK", name = "Jumping Roundhouse", hits = 1, dmg = 900}, | |
qcfLP = {cmd = "236LP", name = "Ringlet Spire (LP)", hits = 1, dmg = 600}, | |
qcfMP = {cmd = "236MP", name = "Ringlet Spire (MP)", hits = 1, dmg = 600}, | |
qcfHP = {cmd = "236HP", name = "Ringlet Spire (HP)", hits = 1, dmg = 600}, | |
dpLP = {cmd = "623LP", name = "Updo (LP)", hits = 1, dmg = 800}, | |
dpMP = {cmd = "623MP", name = "Updo (MP)", hits = 2, dmg = {600,400}}, | |
dpHP = {cmd = "623HP", name = "Updo (HP)", hits = 3, dmg = {900,300,300}}, | |
qcbLK = {cmd = "214LK", name = "Hairball (LK)", hits = 3, dmg = {300,300,400}}, | |
qcbMK = {cmd = "214MK", name = "Hairball (MK)", hits = 4, dmg = {300,300,300,400}}, | |
qcbHK = {cmd = "214HK", name = "Hairball (HK)", hits = 6, dmg = {300,300,300,300,300,400}}, | |
jqcbLK = {cmd = "j.214LK", name = "Airball (LK)", hits = 4, dmg = {300,300,300,400}}, | |
jqcbMK = {cmd = "j.214MK", name = "Airball (MK)", hits = 4, dmg = {300,300,300,400}}, | |
jqcbHK = {cmd = "j.214HK", name = "Airball (HK)", hits = 4, dmg = {300,300,300,400}}, | |
dpPP = {cmd = "623PP", name = "Fenrir Drive", hits = 10, dmg = {400,200,200,200,200,200,200,400,3500,500}}, | |
qcbKK = {cmd = "214KK", name = "Gregor Samson", hits = 5, dmg = {300,300,300,300,1750}}, | |
jqcbKK = {cmd = "j.214KK", name = "Gregor Samson", hits = 5, dmg = {300,300,300,300,1750}}, | |
qcbPP = {cmd = "214PP", name = "Trichobezoar", hits = 1, dmg = 4750, minscale = 0.45}, | |
throw360= {cmd = "6248TH", name = "Ultra Mega LV5", hits = 4, dmg = {1000,1000,2500,400}, minscale = 0.55} | |
} | |
function translateInput( input ) | |
if input == "5LP" then return "stLP" end | |
if input == "5MP" then return "stMP" end | |
if input == "5HP" then return "stHP" end | |
if input == "2LP" then return "crLP" end | |
if input == "2MP" then return "crMP" end | |
if input == "2HP" then return "crHP" end | |
if input == "5LK" then return "stLK" end | |
if input == "5MK" then return "stMK" end | |
if input == "5HK" then return "stHK" end | |
if input == "2LK" then return "crLK" end | |
if input == "2MK" then return "crMK" end | |
if input == "2HK" then return "crHK" end | |
if input == "j.LP" then return "jLP" end | |
if input == "j.MP" then return "jMP" end | |
if input == "j.HP" then return "jHP" end | |
if input == "j.LK" then return "jLK" end | |
if input == "j.MK" then return "jMK" end | |
if input == "j.HK" then return "jHK" end | |
if input == "j.2LP" then return "j2LP" end | |
if input == "j.2MP" then return "j2MP" end | |
if input == "j.2HP" then return "j2HP" end | |
if input == "j.2LK" then return "j2LK" end | |
if input == "j.2MK" then return "j2MK" end | |
if input == "j.2HK" then return "j2HK" end | |
if input == "236LP" then return "qcfLP" end | |
if input == "236MP" then return "qcfMP" end | |
if input == "236HP" then return "qcfHP" end | |
if input == "236PP" then return "qcfPP" end | |
if input == "236LK" then return "qcfLK" end | |
if input == "236MK" then return "qcfMK" end | |
if input == "236HK" then return "qcfHK" end | |
if input == "236KK" then return "qcfKK" end | |
if input == "214LP" then return "qcbLP" end | |
if input == "214MP" then return "qcbMP" end | |
if input == "214HP" then return "qcbHP" end | |
if input == "214PP" then return "qcbPP" end | |
if input == "214LK" then return "qcbLK" end | |
if input == "214MK" then return "qcbMK" end | |
if input == "214HK" then return "qcbHK" end | |
if input == "214KK" then return "qcbKK" end | |
if input == "j.236LP" then return "jqcfLP" end | |
if input == "j.236MP" then return "jqcfMP" end | |
if input == "j.236HP" then return "jqcfHP" end | |
if input == "j.236PP" then return "jqcfPP" end | |
if input == "j.236LK" then return "jqcfLK" end | |
if input == "j.236MK" then return "jqcfMK" end | |
if input == "j.236HK" then return "jqcfHK" end | |
if input == "j.236KK" then return "jqcfKK" end | |
if input == "j.214LP" then return "jqcbLP" end | |
if input == "j.214MP" then return "jqcbMP" end | |
if input == "j.214HP" then return "jqcbHP" end | |
if input == "j.214PP" then return "jqcbPP" end | |
if input == "j.214LK" then return "jqcbLK" end | |
if input == "j.214MK" then return "jqcbMK" end | |
if input == "j.214HK" then return "jqcbHK" end | |
if input == "j.214KK" then return "jqcbKK" end | |
if input == "63214789TH" or "6248TH" then return "throw360" end | |
end | |
local function round(num, idp) | |
if idp and idp > 0 then | |
local mult = 10 ^ idp; | |
return math.floor(num * mult + 0.5) / mult; | |
end; | |
return math.floor(num + 0.5); | |
end | |
function split(delimiter, text) | |
local list = {} | |
local pos = 1 | |
while 1 do | |
local first,last = string.find(text, delimiter, pos) | |
if first then | |
table.insert(list, string.sub(text, pos, first-1)) | |
pos = last+1 | |
else | |
table.insert(list, string.sub(text, pos)) | |
break | |
end | |
end | |
return list | |
end | |
hits = 0 | |
function damageScale( dmg, ... ) | |
_limit = ... | |
if hits <= 3 then | |
return dmg | |
else | |
local scalar = 1 | |
for i=1,hits-3 do | |
min = type(_limit) == "number" and _limit or 0.275 | |
scalar = math.max(scalar * 0.875, min) | |
end | |
return math.floor(dmg * scalar) | |
end | |
-- You messed up son | |
return 0 | |
end | |
function getMove( cmd ) | |
for i=1,#Moves do | |
if Moves[i].cmd == cmd then | |
return Moves[i] | |
end | |
end | |
return nil | |
end | |
function calcOneMove( input, iters ) | |
local input = input | |
local key = translateInput(input) | |
local name = "Unknown Move" | |
local dmg = 0 | |
local min = nil | |
-- the worst way to look up the move | |
if Moves[key] ~= nil then | |
name = Moves[key].name | |
dmg = Moves[key].dmg | |
min = Moves[key].minscale | |
else | |
return nil | |
end | |
if type(dmg) == "number" then | |
hits = hits + 1 | |
local dmg2 = damageScale(dmg, min) | |
local perc = damageScale(100, min) | |
print(string.format("%02i %2i %10s | %24s | %04i (%03i%%)", iters, hits, input, name, dmg2, perc)) | |
end | |
if type(dmg) == "table" then | |
local dmg2 = 0 | |
local perc = 100 | |
for i=1,#dmg do | |
hits = hits + 1 | |
dmg2 = dmg2 + damageScale(dmg[i], min) | |
perc = damageScale(100, min) | |
if i==1 then | |
print(string.format("%02i %2i %10s | %24s | %04i (%03i%%)", iters, hits, input, name, dmg2, perc)) | |
else | |
print(string.format("%02i %2i %10s | %24s | %04i (%03i%%)", iters, hits, "-", "-", dmg2, perc)) | |
end | |
end | |
end | |
end | |
local inputs = split(" ", io.read()); | |
print(string.format("%16s | %24s | %s", "# Hit Command", "Move Name", "Damage")) | |
print("---------------------------------------------------------") | |
for i=1,#inputs do | |
calcOneMove(inputs[i], i ) | |
end | |
-- 5LP 5MP 5HK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment