Module:CalculatedStats: Difference between revisions
(Created page with "--For calculated stats in SMT1, SMT2, SMTif, SMT Devil Summoner --To do: --Mega-CD SMT1 --Make PSP Devil Summoner functional --Find out Soul Hackers formulas local getArgs = require('Module:Arguments').getArgs local p = {} local args = getArgs(frame) local stat = args[1]:lower() local level = args[2] --Level local strength = args[3] --Strength local intelligence = args[4] --Intelligence local magic = args[5] --Magic local vitality = args[6] --Vitality/Endurance local...") |
mNo edit summary |
||
Line 7: | Line 7: | ||
local p = {} | local p = {} | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local stat = args[1] | local stat = string.lower(args[1]) | ||
local level = args[2] --Level | local level = args[2] --Level | ||
local strength = args[3] --Strength | local strength = args[3] --Strength |
Revision as of 23:48, 19 September 2024
Documentation
Basic use
To use this module, do as follows for most games:
{{#invoke:CalculatedStats|<function>|<level>|<strength>|<intelligence>|<magic>|<vitality/endurance>|<agility>|<luck>}}
For Persona 2: Innocent Sin, do as follows for basic use:
{{#invoke:CalculatedStats|<function>|<level>|<strength>|<vitality>|<dexterity>|<agility>|<luck>}}
This module should not be invoked directly in the mainspace and should be part of a template, with the values filled with template parameters.
Valid values for function (case sensitive):
smt1
for Shin Megami Tenseismt2
for Shin Megami Tensei IIsmtif
for Shin Megami Tensei if... (alias forsmt2
)smtn
for Shin Megami Tensei: Ninedesum
for Shin Megami Tensei: Devil Summonersh1
for Devil Summoner: Soul Hackersp2is
for Persona 2: Innocent Sin
Platform
Shin Megami Tensei has different formulas for the Mega-CD version. Set the named parameter platform
to MCD
(case insensitive) to output the Mega-CD stats.
Shin Megami Tensei: Devil Summoner by default shows both the Sega Saturn and PlayStation Portable values for Magic Defense. Set the named parameter platform
to either SAT
or PSP
(case insensitive) to display only one of them.
Persona 2: Innocent Sin is similar to Devil Summoner but it applies for all stats. Set the named parameter platform
to PS
or PSP
to show only one platform's set of stats.
Boss
Shin Megami Tensei (Mega-CD) uses different stat calculations for bosses than it does for regular demons. Set the named parameter boss
to something (recommended: y
) to use the boss calculations.
Manual stat inputting
Devil Summoner: Soul Hackers and Shin Megami Tensei: Nine support manual input of stats through named arguments (see the code to know what to use). This is because some of the calculations for Devil Summoner: Soul Hackers and Shin Megami Tensei: Nine are not yet perfect.
Sources
All sources were verified and, if they were wrong, corrected formulas are used in this module.
- Shin Megami Tensei
- Shin Megami Tensei (Mega-CD)
- Shin Megami Tensei II and if...
- Shin Megami Tensei: Devil Summoner
- Devil Summoner: Soul Hackers
--For calculated stats in SMT1, SMT2, SMTif, SMT Devil Summoner --To do: --Mega-CD SMT1 --Make PSP Devil Summoner functional --Find out Soul Hackers formulas local getArgs = require('Module:Arguments').getArgs local p = {} local args = getArgs(frame) local stat = string.lower(args[1]) local level = args[2] --Level local strength = args[3] --Strength local intelligence = args[4] --Intelligence local magic = args[5] --Magic local vitality = args[6] --Vitality/Endurance local agility = args[7] --Agility local luck = args[8] --Luck function p.smt1(frame) local levelMinus19 = level - 19 if levelMinus19 < 0 then levelMinus19 = 0 end local statTable = { atk = levelMinus19 + (strength * 3) + math.floor(vitality/4), acc = math.floor(strength/4) + agility, def = math.floor(levelMinus19/2) + math.floor(strength/4) + (vitality * 2), eva = math.floor(intelligence/8) + agility, matk = math.floor(intelligence/8) + magic, mefc = intelligence + math.floor(magic/8) } if statTable[stat] then return statTable[stat] else error("No such stat as \"" .. stat .. "\"") end end function p.smt2(frame) local statTable = { atk = (level + strength) * 2, acc = math.floor(level * 1.5) + agility + math.floor((strength + luck)/4), def = (level + vitality) * 2, eva = math.floor(level * 1.5) + agility + math.floor((intelligence + luck)/4), matk = math.floor(intelligence/4) + magic, mefc = intelligence + math.floor(magic/4) } if statTable[stat] then return statTable[stat] else error("No such stat as \"" .. stat .. "\"") end end function p.smtif(frame) local statTable = { atk = (level + strength) * 2, acc = math.floor(level * 1.5) + agility + math.floor((strength + luck)/4), def = (level + vitality) * 2, eva = math.floor(level * 1.5) + agility + math.floor((intelligence + luck)/4), matk = math.floor(intelligence/4) + magic, mefc = intelligence + math.floor(magic/4) } if statTable[stat] then return statTable[stat] else error("No such stat as \"" .. stat .. "\"") end end function p.desum(frame) local statTable = { atk = (level + strength) * 2, acc = math.floor(level * 1.5) + agility + math.floor((strength + luck)/4), def = (level + vitality) * 2, eva = math.floor(level * 1.5) + agility + math.floor((intelligence + luck)/4), matk = math.floor(intelligence/2) + (magic*2), mdef = intelligence + math.floor(level/2) + math.floor(magic/4) + math.floor(vitality/2) } local statTablePSP = { atk = (level + strength) * 2, acc = math.floor((level * 1.5) + agility + (strength + luck)/4), def = (level + vitality) * 2, eva = math.floor((level * 1.5) + agility + (intelligence + luck)/4), matk = math.floor((intelligence/2) + (magic*2)), mdef = math.floor(intelligence + (level/2) + (magic/4) + (vitality/2)) } if statTable[stat] then return statTable[stat] else error("No such stat as \"" .. stat .. "\"") end end return p