From 43423c997709096a91d7561da40396572547fe96 Mon Sep 17 00:00:00 2001 From: lilyissillyyy Date: Thu, 18 Sep 2025 17:24:14 -0400 Subject: [PATCH] Add end to sorting hat --- assets/json/sorting-hat.json | 25 +++++++++++++++++++++++-- commands/games-sp/sorting-hat.js | 12 ++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/assets/json/sorting-hat.json b/assets/json/sorting-hat.json index de93aa51..caf2498e 100644 --- a/assets/json/sorting-hat.json +++ b/assets/json/sorting-hat.json @@ -1271,18 +1271,39 @@ } ] } + ], + "bigot": [ + { + "text": "Do you agree that J.K. Rowling is a disgusting bigot?", + "answers": [ + { + "text": "Yes, of course.", + "points": { + "b": 0 + } + }, + { + "text": "No, I agree with her.", + "points": { + "b": 100 + } + } + ] + } ] }, "houses": { "g": "Gryffindor", "r": "Ravenclaw", "h": "Hufflepuff", - "s": "Slytherin" + "s": "Slytherin", + "b": "Bigot" }, "descriptions": { "g": "With a lion as its crest and Professor McGonagall at its head, Gryffindor is the house which most values the virtues of courage, bravery and determination.", "r": "Ravenclaws prize wit, learning, and wisdom. It's an ethos etched into founder Rowena Ravenclaw diadem: 'wit beyond measure is man's greatest treasure'.", "h": "Hufflepuffs value hard work, patience, loyalty, and fair play. The house has produced its share of great wizards – not least Newt Scamander, author of Fantastic Beasts and Where to Find Them.", - "s": "Slytherin produces more than its share of Dark wizards, but also turns out leaders who are proud, ambitious and cunning. Merlin is one particularly famous Slytherin." + "s": "Slytherin produces more than its share of Dark wizards, but also turns out leaders who are proud, ambitious and cunning. Merlin is one particularly famous Slytherin.", + "b": "I'm sorry, but I don't offer my services to bigots. You'll have to come again after some self-reflection." } } diff --git a/commands/games-sp/sorting-hat.js b/commands/games-sp/sorting-hat.js index 7607973c..930b653e 100644 --- a/commands/games-sp/sorting-hat.js +++ b/commands/games-sp/sorting-hat.js @@ -2,7 +2,7 @@ const Command = require('../../framework/Command'); const { stripIndents } = require('common-tags'); const { shuffle } = require('../../util/Util'); const { questions, houses, descriptions } = require('../../assets/json/sorting-hat'); -const choices = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P']; +const choices = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'END']; module.exports = class SortingHatCommand extends Command { constructor(client) { @@ -33,17 +33,20 @@ module.exports = class SortingHatCommand extends Command { g: 0, s: 0, h: 0, - r: 0 + r: 0, + b: 0 }; const blacklist = []; const questionNums = ['2', '3', '4', '5', '6', '7']; let turn = 1; - while (turn < 9) { + while (turn < 10) { let question; if (turn === 1) { question = questions.first[Math.floor(Math.random() * questions.first.length)]; } else if (turn === 8) { question = questions.last[Math.floor(Math.random() * questions.last.length)]; + } else if (turn === 9) { + question = questions.bigot[0]; } else { const possible = questionNums.filter(num => !blacklist.includes(num)); const value = possible[Math.floor(Math.random() * possible.length)]; @@ -53,7 +56,7 @@ module.exports = class SortingHatCommand extends Command { } const answers = shuffle(question.answers); await msg.say(stripIndents` - **${turn}.** ${question.text} + **${turn}.** ${question.text} _(Type \`end\` to end)_ ${answers.map((answer, i) => `- **${choices[i]}.** ${answer.text}`).join('\n')} `); const filter = res => @@ -65,6 +68,7 @@ module.exports = class SortingHatCommand extends Command { }); if (!choice.size) return msg.say('Oh no, you ran out of time! Too bad.'); const answer = answers[choices.indexOf(choice.first().content.toUpperCase())]; + if (answer === 'END') return msg.say('See you next time!'); for (const [house, amount] of Object.entries(answer.points)) points[house] += amount; ++turn; }