Skip to content

Instantly share code, notes, and snippets.

@ftvs
Created September 15, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftvs/10226685d7162f3cfb4434f16428a6e8 to your computer and use it in GitHub Desktop.
Save ftvs/10226685d7162f3cfb4434f16428a6e8 to your computer and use it in GitHub Desktop.
Final Fantasy XV damage calculator for jscalc.io
'use strict';
function calc(inputs)
{
var output = {};
var str = inputs.str;
var pwr = inputs.pwr;
var lvl = inputs.lvl;
var vit = inputs.vit;
/*
https://www.reddit.com/r/FFXV/comments/74yozy/guide_damage_and_defense_calculation/
Damage = A × B × C × D × E
A = Base Damage
B = Target Defense
C = Affinity Modifier
D = Conditional Modifier(s)
E = Random Modifier
*/
// A = [Strength + Weapon Power + (Level × 3)] × (Attack Damage Modifier × 2)
// B = 1 ÷ [1 + (Vitality ÷ 100)] against physical attacks
output.dmg = str + pwr + lvl * 3 *
(1 / (1 + vit/100));
// A = (Magic + 100) × (Spell Power + 20) × (Level + 20) × (1 ÷ 200)
// B = 1 ÷ [1 + (Spirit ÷ 100)] against magic
output.magdmg = (str + 100) * (pwr + 20) * (lvl + 20) * .005 *
(1 / (1 + (vit / 100)));
return output;
}
return calc(inputs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment