12345678910111213141516171819202122232425262728 |
- export const initHeroesFromJson = function(allHeroesJson) {
- let abilitiesMap = new Map();
- allHeroesJson.abilities.forEach(ability => {
- abilitiesMap.set(ability.abilityName, {
- name: ability.abilityName,
- hook: ability.abilityHook,
- isOptionnal: ability.optionnal,
- desc: ability['abilityDesc-FR']
- });
- });
- let heroesSet = new Set();
- allHeroesJson.heroes.forEach(hero => {
- let i = 0;
- while (i < hero.nbInDeck) {
- heroesSet.add({
- name: hero.name,
- cost: hero.cost,
- power: hero.power,
- faction: hero.faction,
- ability: abilitiesMap.get(hero.ability),
- isDraftable: hero.draftMode,
- popularity: hero.popularity
- });
- i++;
- }
- });
- return heroesSet;
- };
|