Open
Conversation
added Melron/Moregano enum Role
vck3000
reviewed
Sep 23, 2025
| if ( | ||
| index !== -1 && | ||
| this.thisRoom.playersInGame[index].alliance === Alliance.Resistance && | ||
| this.thisRoom.playersInGame[index].role !== Role.Moregano |
Owner
There was a problem hiding this comment.
Hmmm, will need to check whether this will subtly break the timer. This code path is actually now dead and should never happen, as the buttonsAvailable should never show fail as an option if you're res.
I'll have a think about how to handle this.
Edit: This won't be an issue if
vck3000
reviewed
Sep 23, 2025
Comment on lines
+48
to
+63
| // Build pool of all non-self usernames | ||
| const self = this.getSelfUsername(); | ||
| const pool = this.room.playersInGame | ||
| .map((p: any) => p.username) | ||
| .filter((u: string) => u !== self); | ||
|
|
||
| // Shuffle pool (Fisher–Yates) and pick k | ||
| for (let i = pool.length - 1; i > 0; i--) { | ||
| const j = Math.floor(Math.random() * (i + 1)); | ||
| [pool[i], pool[j]] = [pool[j], pool[i]]; | ||
| } | ||
| const picks = pool.slice(0, k); | ||
|
|
||
| for (const u of picks) spies.push(this.room.anonymizer.anon(u)); | ||
|
|
||
| return { spies, roleTags: {} }; |
Owner
There was a problem hiding this comment.
I believe we'll need to do this on game start and remember the spies we've built up.
See() (if I recall correctly) is called on every game move, so we wouldn't want these to be shuffling mid-game.
vck3000
reviewed
Sep 23, 2025
Comment on lines
+506
to
+514
| // After roles are assigned, set displayRole for deceptive roles (Melron/Moregano). | ||
| for (let i = 0; i < this.playersInGame.length; i++) { | ||
| const p = this.playersInGame[i]; | ||
| if (p.role === Role.Melron) { | ||
| p.displayRole = Role.Merlin; // Melron thinks they are Merlin | ||
| } else if (p.role === Role.Moregano) { | ||
| p.displayRole = Role.Morgana; // Moregano thinks they are Morgana | ||
| } | ||
| } |
Owner
There was a problem hiding this comment.
Indenting is a bit off.
Will need to confirm if .displayRole is the correct thing to be overriding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds in two Resistance roles that deceive the player about their identity: Melron, who thinks they are Merlin, and Moregano, who thinks they are Morgana. Moregano is unique in that they are a Resistance who is allowed to click Fail, but the game engine silently counts this as a Success.