forked from alfficcadenti/splinterlands-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.js
26 lines (16 loc) · 1016 Bytes
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const cardsDetails = require("./data/cardsDetails.json");
const card = require("./cards")
// const teamIdsArray = [167, 192, 160, 161, 163, 196, '', 'fire'];
//cardColor = (id) => cardsDetails.find(o => o.id === id) ? cardsDetails.find(o => o.id === id).color : '';
const validDecks = ['Red', 'Blue', 'White', 'Black', 'Green']
const colorToDeck = { 'Red': 'Fire', 'Blue': 'Water', 'White': 'Life', 'Black': 'Death', 'Green': 'Earth' }
// const tes = teamIdsArray.forEach(id => {
// console.log('DEBUG', id, cardColor(id))
// if (validDecks.includes(cardColor(id))) {
// return colorToDeck[cardColor(id)];
// }
// })
const deckValidColor = (accumulator, currentValue) => validDecks.includes(card.color(currentValue)) ? colorToDeck[card.color(currentValue)] : accumulator;
//console.log(teamIdsArray.reduce(deckValidColor, ''));
const teamActualSplinterToPlay = (teamIdsArray) => teamIdsArray.reduce(deckValidColor, '')
module.exports.teamActualSplinterToPlay = teamActualSplinterToPlay;