Fixed dice excluding last face, increased max rolls to 20. Increased default number of Hunt guesses. Increased default Riddle timeout.

This commit is contained in:
Niels Simenon
2022-11-02 00:34:03 +01:00
parent 6adb443aff
commit 46c61e2a92
3 changed files with 11 additions and 11 deletions

View File

@@ -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

View File

@@ -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);