This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
/
randomonium.js
75 lines (70 loc) · 1.94 KB
/
randomonium.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const owHeroes = [
"Genji",
"McCree",
"Pharah",
"Reaper",
"Soldier: 76",
"Tracer",
"Bastion",
"Hanzo",
"Junkrat",
"Mei",
"Torbj\xf6rn",
"Widowmaker",
"D.Va",
"Reinhardt",
"Roadhog",
"Winston",
"Zarya",
"L\xfacio",
"Mercy",
"Symmetra",
"Zenyatta",
"Ana",
"Sombra",
"Orisa",
"Doomfist",
"Moira",
"Brigitte",
"Wrecking Ball",
"Ashe",
"Baptiste",
"Sigma"
];
// #### # #
// # # #
// # # ### # ## ## # ### ## # ### # ## ## # # ## #
// #### # ## # # ## # # # # # # # ## # # # # # # #
// # # #### # # # # # # # # # # # # # # # # # # #
// # # # # # # # ## # # # # # # # # # # # ## # # #
// # # #### # # ## # ### # # ### # # ### ## # # #
/**
* A class to handle the Overwatch randomonium character generator.
*/
class Randomonium {
// # # #
// # # #
// ### ## ### #### ## ### ## ## ###
// # # # ## # # # # ## # # # # # ## ##
// ## ## # # # ## # # # ## ##
// # ## ## # # ## # ## ## ###
// ###
/**
* Gets a list of heroes.
* @param {number} count The number of heroes to return.
* @param {boolean} dupes Whether to return duplicate heroes or not.
* @returns {string[]} The list of heroes.
*/
static getHeroes(count, dupes) {
const heroes = [];
owHeroes.sort(() => Math.random() - 0.5);
for (let index = 0; index < count; index++) {
heroes.push(owHeroes[index]);
if (dupes) {
owHeroes.sort(() => Math.random() - 0.5);
}
}
return heroes;
}
}
module.exports = Randomonium;