Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions assets/laserDiskCategories.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Something normally found in a kitchen
One word of 5 letters or less
A weapon
A tourist attraction
A fantastic or mythologic creature or monster
A governmental or public ministry or organisation
One word of at least 8 letters
Something normally found in a bathroom
Something related to the Far West
A vehicle or means of transportation
An animal
One word starting with the letter P
A possible cause of death
A company or enterprise existing currently or in the past
A color
A curse word or an insult
A fictional character
A date, a time period, or a historical event
A drug or medicine
A movie title
A music band or a musician
A hobby or pastime
Exclusively one or several words that don't exist
An insect
A song title
The title of a game (of any kind)
A school subject
An onomatopoeia
A part of the human body or an internal organ
A country
A meteorological phenomenon or natural disaster
A plant
A job or profession
Something normally found in a hospital
A web or TV series
A sport
A book title
A type of alcohol, cocktail, or a brand associated to alcohol
A person that is well-known and alive (celebrity)
One word starting with A
A recipe or type of cooked food
A unit of measurement
The infinitive form of one verb
A form of clothing
The name of a sickness
A quality or a flaw
A city
A geometric shape
A historical person (deceased)
A food or nutrient
A musical instrument
A tiny drawing
A single adjective
2 changes: 1 addition & 1 deletion commands/decrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
msg.reply("There must be one team named black and one team named white to play this game");
return;
}
table.game = new Decrypto(table);
table.game = new Decrypto(table, args.includes('laser'));
const userCache = msg.client.users.cache;
let messages = table.game.startGame();
messages.forEach(message => {
Expand Down
28 changes: 23 additions & 5 deletions games/decrypto.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
const fs = require('fs');
const { shuffle } = require("../utility.js");

const numWords = 4;
const wordsInCode = 3;

const wordlist = fs.readFileSync('./assets/wordlist.txt',{'encoding':'utf8'})
const wordlist = fs.readFileSync('./assets/wordlist.txt',{ 'encoding':'utf8'})
.split('\n')
.map((word) => {
return word.slice(0, -1)
});
//maybe this^ should be async? probably lazily instantiated, maybe static?
//maybe only when we need a new board

const categories = fs.readFileSync('./assets/laserDiskCategories.txt',{'encoding':'utf8'})
.split('\n')
.map((word) => {
return word.slice(0, -1)
});


class Decrypto {
constructor(table){
constructor(table, expansion){
this.expansion = expansion;
console.log(expansion);
this.roundCount = 0;
this.teams = [];
this.teams.push(table.teams.get('black'));
this.teams.push(table.teams.get('white'));
this.board = [];
let localwordlist = [...wordlist];
for (let i = 0; i < numWords*2; i++) {
this.board.push(wordlist.splice(parseInt(Math.random()*wordlist.length), 1));
this.board.push(localwordlist.splice(parseInt(Math.random()*wordlist.length), 1));
}
localwordlist = null;
this.categories = shuffle([...categories]);
}

getType(){return "decrypto"}
Expand Down Expand Up @@ -61,7 +73,12 @@ class Decrypto {

startRound(){
if(this.roundCount++ >= 6) return "Game's over! Time to score";
let messages = [{"id": "channel", "content":`Starting round:${this.roundCount}`}];
let curCategory = this.categories.pop();
let messages = [{
"id": "channel",
"content":`Starting round:${this.roundCount}` +
(this.expansion?` with the category: ${curCategory}`:'')
}];
let encryptors = [];
for (let i = 0; i < 2; i++) {
let encryptor = this.teams[i].shift();
Expand All @@ -75,7 +92,8 @@ class Decrypto {
messages.push({
"id":encryptors[i].id,
"content":`you have been chosen as an encryptor`+
` this round, your code is ${this.codes[i]}`
` this round, your code is ${this.codes[i]}` +
(this.expansion?` with the category: ${curCategory}`:'')
});
}
return messages;
Expand Down
2 changes: 1 addition & 1 deletion test/decryptoTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = [
}
},
{
"content":"!decrypto",
"content":"!decrypto laser",
"channel":{
"id" : 0
},
Expand Down