Module:CalculatedStats: Difference between revisions

m
Users shouldn't be inputting stats manually so it should be fine
m (Fix)
m (Users shouldn't be inputting stats manually so it should be fine)
Line 2: Line 2:
--To do:
--To do:
--Mega-CD SMT1
--Mega-CD SMT1
--Make PSP Devil Summoner functional
--Make PSP Devil Summoner functional; probably add additional argument for platform for this and MCD SMT1
--Find out Soul Hackers formulas
--Find out Soul Hackers formulas
--Add MT1, MT2, KMT support
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs
local p = {}
local p = {}
Line 18: Line 20:
local intelligence = args[4] --Intelligence
local intelligence = args[4] --Intelligence
local magic = args[5] --Magic
local magic = args[5] --Magic
local vitality = args[6] --Vitality/Endurance
local vitality = args[6] --Vitality
local agility = args[7] --Agility
local agility = args[7] --Agility
local luck = args[8] --Luck
local luck = args[8] --Luck
Line 33: Line 35:
mefc = intelligence + round(magic/8)
mefc = intelligence + round(magic/8)
}
}
if statTable[stat] then
return statTable[stat]
return statTable[stat]
else
error("No such stat as \"" .. stat .. "\"")
end
end
end


Line 47: Line 45:
local intelligence = args[4] --Intelligence
local intelligence = args[4] --Intelligence
local magic = args[5] --Magic
local magic = args[5] --Magic
local vitality = args[6] --Vitality/Endurance
local vitality = args[6] --Vitality
local agility = args[7] --Agility
local agility = args[7] --Agility
local luck = args[8] --Luck
local luck = args[8] --Luck
Line 58: Line 56:
mefc = intelligence + math.floor(magic/4)
mefc = intelligence + math.floor(magic/4)
}
}
if statTable[stat] then
return statTable[stat]
return statTable[stat]
else
error("No such stat as \"" .. stat .. "\"")
end
end
end


Line 72: Line 66:
local intelligence = args[4] --Intelligence
local intelligence = args[4] --Intelligence
local magic = args[5] --Magic
local magic = args[5] --Magic
local vitality = args[6] --Vitality/Endurance
local vitality = args[6] --Vitality
local agility = args[7] --Agility
local agility = args[7] --Agility
local luck = args[8] --Luck
local luck = args[8] --Luck
Line 83: Line 77:
mefc = intelligence + math.floor(magic/4)
mefc = intelligence + math.floor(magic/4)
}
}
if statTable[stat] then
return statTable[stat]
return statTable[stat]
else
error("No such stat as \"" .. stat .. "\"")
end
end
end


Line 97: Line 87:
local intelligence = args[4] --Intelligence
local intelligence = args[4] --Intelligence
local magic = args[5] --Magic
local magic = args[5] --Magic
local vitality = args[6] --Vitality/Endurance
local endurance = args[6] --Endurance
local agility = args[7] --Agility
local agility = args[7] --Agility
local luck = args[8] --Luck
local luck = args[8] --Luck
if args[9] then
local platform = string.lower(args[9]) --game platform
else
local platform = ""
end
local statTable = {
local statTable = {
atk = (level + strength) * 2,
atk = (level + strength) * 2,
Line 106: Line 101:
eva = math.floor(level * 1.5) + agility + math.floor((intelligence + luck)/4),
eva = math.floor(level * 1.5) + agility + math.floor((intelligence + luck)/4),
matk = math.floor(intelligence/2) + (magic*2),
matk = math.floor(intelligence/2) + (magic*2),
mdef = intelligence + math.floor(level/2) + math.floor(magic/4) + math.floor(vitality/2)
mdef = intelligence + math.floor(level/2) + math.floor(magic/4) + math.floor(vitality/2),
}
atkpsp = (level + strength) * 2,
local statTablePSP = {
accpsp = math.floor((level * 1.5) + agility + (strength + luck)/4),
atk = (level + strength) * 2,
defpsp = (level + vitality) * 2,
acc = math.floor((level * 1.5) + agility + (strength + luck)/4),
evapsp = math.floor((level * 1.5) + agility + (intelligence + luck)/4),
def = (level + vitality) * 2,
matkpsp = math.floor((intelligence/2) + (magic*2)),
eva = math.floor((level * 1.5) + agility + (intelligence + luck)/4),
mdefpsp = math.floor(intelligence + (level/2) + (magic/4) + (vitality/2))
matk = math.floor((intelligence/2) + (magic*2)),
mdef = math.floor(intelligence + (level/2) + (magic/4) + (vitality/2))
}
}
if statTable[stat] then
if platform == "sat" then
return statTable[stat]
return statTable[stat]
elseif platform == "psp" then
return statTable[stat..platform]
else
else
error("No such stat as \"" .. stat .. "\"")
if statTable[stat] == statTable[stat.."psp"] then
return statTable[stat]
else
return frame:expandTemplate{ title = "tt", args = { statTable[stat], "Sega Saturn" } } .. "/" .. frame:expandTemplate{ title = "tt", args = { statTable[statpsp], "PlayStation Portable" } }
end
end
end
end
end


return p
return p