fire-emblem-heroes-calculator
v0.15.2
Published
Calculate the result of combat between one hero and another
Downloads
27
Readme
fire-emblem-heroes-calculator
Calculate the result of combat between one hero and another
Installation
You can load fire-emblem-heroes-calculator
via npm, or with a script tag.
You can also try fire-emblem-heroes-calculator
out without installing, using Runkit!
HTML (loaded via CDN)
<!-- Dev -->
<script src="https://proving-grounds-static.ajhyndman.com/<version>/fire-emblem-heroes-calculator.js"></script>
<!-- Production -->
<script src="https://proving-grounds-static.ajhyndman.com/<version>/fire-emblem-heroes-calculator.min.js"></script>
<script type="text/javascript">
// A new variable will be available here, named `calculator`.
alert(calculator.getDefaultInstance('Anna: Commander'));
</script>
Node (npm)
npm install --save fire-emblem-heroes-calculator
var calculator = require('fire-emblem-heroes-calculator');
Usage
var Anna = calculator.getDefaultInstance('Anna: Commander');
var Sharena = calculator.getDefaultInstance('Sharena: Princess of Askr');
calculator.calculateResult(Anna, Sharena);
// => {
// combatInfo: {
// "attackerDamage": 25,
// "attackerNumAttacks": 1,
// "attackerSpecialDamage": 0,
// "attackerHp": 24,
// "defenderSpecialDamage": 0,
// "defenderNumAttacks": 1,
// "defenderDamage": 17,
// "defenderHp": 18
// }
// attackerState: {
// hpMissing: 17
// specialCharge: 2,
// },
// defenderState: {
// hpMissing: 25
// specialCharge: 0,
// },
// }
calculator.getInheritableSkills('Anna: Commander', 'WEAPON');
// => [
// 'Brave Axe',
// 'Brave Axe+',
// 'Carrot Axe',
// 'Carrot Axe+',
// 'Emerald Axe',
// 'Emerald Axe+',
// 'Hammer',
// 'Hammer+',
// 'Iron Axe',
// 'Killer Axe',
// 'Killer Axe+',
// 'Nóatún',
// 'Silver Axe',
// 'Silver Axe+',
// 'Steel Axe'
// ]
calculator.getStat(
Anna, // hero instance
'atk', // stat key, one of: 'atk' | 'def' | 'hp' | 'res' | 'spd'
40, // level, one of: 1 | 40
{enemy: Sharena, isAttacker: true, allies: [], otherEnemies: []}, // Context (optional)
);
// => 45