Skip to content

Comments

Melron and Moregano#745

Open
Besjbo7 wants to merge 7 commits intovck3000:masterfrom
Besjbo7:master
Open

Melron and Moregano#745
Besjbo7 wants to merge 7 commits intovck3000:masterfrom
Besjbo7:master

Conversation

@Besjbo7
Copy link
Contributor

@Besjbo7 Besjbo7 commented Aug 9, 2025

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.

if (
index !== -1 &&
this.thisRoom.playersInGame[index].alliance === Alliance.Resistance &&
this.thisRoom.playersInGame[index].role !== Role.Moregano
Copy link
Owner

@vck3000 vck3000 Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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: {} };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting is a bit off.

Will need to confirm if .displayRole is the correct thing to be overriding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants