From 180d97f9d7f1f963af2003b9ca6ba5debde96e7e Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Sat, 31 Dec 2016 16:44:07 -0500 Subject: [PATCH] fix #176 off by one when calculating evolves --- app/actions/trainer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/actions/trainer.js b/app/actions/trainer.js index 68b033d..f37ec4b 100644 --- a/app/actions/trainer.js +++ b/app/actions/trainer.js @@ -211,7 +211,8 @@ function parseInventory(inventory) { // TODO use map speciesList.forEach((s) => { - const candyToEvolve = pokemonSettings[s.pokemon_id] ? pokemonSettings[s.pokemon_id].candy_to_evolve : 0 + const pokemonSetting = pokemonSettings[s.pokemon_id - 1] + const candyToEvolve = pokemonSetting ? pokemonSetting.candy_to_evolve : 0 s.evolves = utils.getEvolvesCount(candyToEvolve, s) })