From 46c61e2a92940bb8ee893560d7de6cd5352e29c2 Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Wed, 2 Nov 2022 00:34:03 +0100 Subject: [PATCH] Fixed dice excluding last face, increased max rolls to 20. Increased default number of Hunt guesses. Increased default Riddle timeout. --- config/default.js | 10 +++++----- src/games/dice.js | 2 +- src/games/hunt.js | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/default.js b/config/default.js index 10836f5..1a3b545 100755 --- a/config/default.js +++ b/config/default.js @@ -79,17 +79,17 @@ module.exports = { timeout: 60, }, riddle: { - timeout: 20, + timeout: 30, score: false, }, dice: { - maxRolls: 10, + maxRolls: 20, maxFaces: 1000, }, - hangman: { + hunt: { minLength: 5, maxLength: 9, - guesses: [2, 3, 4, 5, 6, 7], // by word length, last number repeats for longer words - // guesses: 6, // fixed + guesses: [4, 4, 6, 7, 9], + // guesses: [2, 3, 4, 5, 6, 7], // by word length, last number repeats for longer words }, }; diff --git a/src/games/dice.js b/src/games/dice.js index f241fc5..130a5e2 100755 --- a/src/games/dice.js +++ b/src/games/dice.js @@ -29,7 +29,7 @@ function onCommand(args, context) { } const results = Array.from({ length: rolls }, () => { - const result = crypto.randomInt(1, faces); + const result = crypto.randomInt(1, faces + 1); // using U+2003 Em Space after dice to create double space that doesn't get filtered in SChat return `${style.grey(dieFaces[result - 1] || '☐')} ${style.bold(result)}`; // eslint-disable-line no-irregular-whitespace diff --git a/src/games/hunt.js b/src/games/hunt.js index 088efb8..278cbc9 100644 --- a/src/games/hunt.js +++ b/src/games/hunt.js @@ -14,11 +14,11 @@ const trees = ['🌴', '🌳', '🌲', '🌵']; const flowers = ['🌹', '🌻', '🌷', '🌱', '🍄', '🪨']; function getGuesses(word) { - if (Array.isArray(config.hangman.guesses)) { - return config.hangman.guesses[word.length - 1] || config.hangman.guesses.at(-1); + if (Array.isArray(config.hunt.guesses)) { + return config.hunt.guesses[word.length - 1] || config.hunt.guesses.at(-1); } - return config.hangman.guesses; + return config.hunt.guesses; } function renderBoard(context) { @@ -117,8 +117,8 @@ function onCommand(args, context) { return; } - const minLength = Number(args[0]) || config.hangman.minLength; - const maxLength = Number(args[0]) || config.hangman.maxLength; + const minLength = Number(args[0]) || config.hunt.minLength; + const maxLength = Number(args[0]) || config.hunt.maxLength; const playableWords = Array.from({ length: (maxLength - minLength) + 1 }, (value, index) => Object.values(words[index + minLength] || {})).flat(2); const word = pickRandom(playableWords);