Calculator Tools Calculator Tools
Create

Pokémon Damage Calculator

Nov 18, 2023

About this app

A simple calculator to determine the damage of a Pokémon's move based on various battle factors.

[ { "search": "// Input values", "replace": "// Input values\n" + "var attackModifierLevel = parseFloat($('#attackModifierLevel').val());" }, { "search": "// Attack modifier", "replace": "// Attack modifier\n" + "var attackModifier = getAttackModifier(attackModifierLevel);" }, { "search": "// Function to calculate damage", "replace": "// Function to calculate damage\n" + "function getAttackModifier(level) {\n" + " var positiveModifiers = [1.2, 1.4, 1.6, 1.8, 2.0];\n" + " var negativeModifiers = [0.8, 0.6, 0.4, 0.2, 0.1];\n" + " var index = Math.abs(level) - 1;\n" + " var modifier = level >= 0 ? positiveModifiers[index] : negativeModifiers[index];\n" + " return modifier;\n" + "}\n" } ]

Related apps

Put this on your site

Source

                    [
{
"search": "// Input values",
"replace": "// Input values\n" +
"var attackModifierLevel = parseFloat($('#attackModifierLevel').val());"
},
{
"search": "// Attack modifier",
"replace": "// Attack modifier\n" +
"var attackModifier = getAttackModifier(attackModifierLevel);"
},
{
"search": "// Function to calculate damage",
"replace": "// Function to calculate damage\n" +
"function getAttackModifier(level) {\n" +
" var positiveModifiers = [1.2, 1.4, 1.6, 1.8, 2.0];\n" +
" var negativeModifiers = [0.8, 0.6, 0.4, 0.2, 0.1];\n" +
" var index = Math.abs(level) - 1;\n" +
" var modifier = level >= 0 ? positiveModifiers[index] : negativeModifiers[index];\n" +
" return modifier;\n" +
"}\n"
}
]