Added letter generator to letters game.
This commit is contained in:
parent
809e79affe
commit
dc6df7c344
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
greeting: 'Hi, I am aisha, your game host!',
|
greeting: 'Hi, I am aisha, your game host!',
|
||||||
usernamePrefix: '@',
|
usernamePrefix: '@',
|
||||||
channels: ['GamesNight'],
|
channels: ['GamesNight'],
|
||||||
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
|
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'riddle', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
|
||||||
schatColors: {
|
schatColors: {
|
||||||
white: 'white',
|
white: 'white',
|
||||||
blue: 'var(--message-40)',
|
blue: 'var(--message-40)',
|
||||||
|
|
|
@ -122,7 +122,7 @@ function pickLetters(type, context) {
|
||||||
context.sendMessage(`${getBoard(context)} Would you like a consonant or a vowel?`, context.room.id);
|
context.sendMessage(`${getBoard(context)} Would you like a consonant or a vowel?`, context.room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function start(context) {
|
function start(context, letters) {
|
||||||
if (games.has(context.room.id)) {
|
if (games.has(context.room.id)) {
|
||||||
context.sendMessage(`${getBoard(context)} This is the current board. Use ${config.prefix}letters:stop to reset.`, context.room.id);
|
context.sendMessage(`${getBoard(context)} This is the current board. Use ${config.prefix}letters:stop to reset.`, context.room.id);
|
||||||
return;
|
return;
|
||||||
|
@ -136,6 +136,11 @@ function start(context) {
|
||||||
ac: new AbortController(), // eslint-disable-line no-undef
|
ac: new AbortController(), // eslint-disable-line no-undef
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (letters) {
|
||||||
|
pickLetters(letters.toLowerCase(), context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
context.sendMessage('Let\'s play the letters! Would you like a consonant or a vowel?', context.room.id);
|
context.sendMessage('Let\'s play the letters! Would you like a consonant or a vowel?', context.room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +150,11 @@ function onCommand(args, context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (['start', 'go', 'auto', 'random'].includes(context.subcommand)) {
|
||||||
|
start(context, Array.from({ length: config.letters.length }, () => (Math.random() < 0.55 ? 'c' : 'v')).join('')); // a slight bias towards consonants seems to give better boards
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!context.subcommand) {
|
if (!context.subcommand) {
|
||||||
start(context);
|
start(context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue