-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonopoke.js
111 lines (109 loc) · 4.97 KB
/
monopoke.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
let canMakeTour = function (room, user) {
return false;
// I'm gonna use this a lot so why not make a function for it
if (!user.can(room, "%")) return false;
if (room.tournament) {
room.send("A tournament is already going on.");
return false;
}
return true;
}
let chooseMonopoke = function (gen) {
let mons = [];
for (let i in PokeDex) {
if (PokeDex[i].baseSpecies) continue;
if (gen === "gen7" && PokeDex[i].num > 809) continue;
if (gen === "gen8" && fdata[i].isNonstandard === "Past") continue;
mons.push(i);
}
let mon = Math.floor(Math.random() * mons.length);
mon = mons[mon];
mon = PokeDex[mon];
if (mon.baseSpecies) mon = chooseMonopoke(gen);
return mon.name;
}
module.exports = {
monopoke: {
'': function (room, user, args) {
if (!canMakeTour(room, user)) return;
console.log(args)
if (!args[0]) args[0] = chooseMonopoke(false);
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (fdt.isNonstandard === "Past") return Commands['monopoke']['gen7'](room, user, args);
else return Commands['monopoke']['gen8'](room, user, args);
},
gen8: function (room, user, args) {
if (!canMakeTour(room, user)) return;
if (!args[0]) args[0] = chooseMonopoke('gen8');
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (fdt.isNonstandard === "Past") return room.send(`${dex.name} is only available in past gens`);
let mon = dex.name;
let ruleset = `/tour rules !Team Preview, -All Pokemon, +${mon}`;
Commands['1v1']['gen8'](room, user, args);
room.startTour("monopoke");
room.send(ruleset);
room.send("/tour name [Gen 8] Monopoke " + mon);
room.send(`/wall Monopoke ${mon}! Use only ${mon}`);
},
gen7: function (room, user, args) {
if (!canMakeTour(room, user)) return;
if (!args[0]) args[0] = chooseMonopoke('gen7');
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (dex.num > 809) return room.send(`${dex.name} is not available in gen 7.`);
let mon = dex.name;
let ruleset = `/tour rules !Team Preview, -All Pokemon, +${mon}`;
Commands['1v1']['gen7'](room, user, args);
room.startTour("monopoke");
room.send(ruleset);
room.send("/tour name [Gen 7] Monopoke " + mon);
room.send(`/wall Monopoke ${mon}! Use only ${mon}`);
}
},
camonopoke: {
'': function (room, user, args) {
if (!canMakeTour(room, user)) return;
if (!args[0]) args[0] = chooseMonopoke(false);
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (fdt.isNonstandard === "Past") return Commands['camonopoke']['gen7'](room, user, args);
else return Commands['camonopoke']['gen8'](room, user, args);
},
gen8: function (room, user, args) {
if (!canMakeTour(room, user)) return;
if (!args[0]) args[0] = chooseMonopoke('gen8');
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (fdt.isNonstandard === "Past") return room.send(`${dex.name} is only available in past gens`);
let mon = dex.name;
let ruleset = `/tour rules !Team Preview, -All Pokemon, +${mon}, [Gen 8] Camomons`;
Commands['1v1']['gen8'](room, user, args);
room.startTour("monopoke");
room.send(ruleset);
room.send("/tour name [Gen 8] Camonopoke " + mon);
room.send(`/wall Camomons Monopoke ${mon}! Use only ${mon}`);
},
gen7: function (room, user, args) {
if (!canMakeTour(room, user)) return;
if (!args[0]) args[0] = chooseMonopoke('gen7');
let dex = PokeDex[toId(args[0])];
let fdt = fdata[toId(args[0])];
if (!dex) return room.send(`${args[0]} is not a Pokémon`);
if (dex.num > 809) return room.send(`${dex.name} is not available in gen 7.`);
let mon = dex.name;
let ruleset = `/tour rules !Team Preview, -All Pokemon, +${mon}, [Gen 8] Camomons`;
Commands['1v1']['gen7'](room, user, args);
room.startTour("monopoke");
room.send(ruleset);
room.send("/tour name [Gen 7] Camonopoke " + mon);
room.send(`/wall Camomons Monopoke ${mon}! Use only ${mon}`);
}
}
}