Skip to content

Commit

Permalink
/special + revert cop/detective message + Warlock One Night Mode Inte…
Browse files Browse the repository at this point in the history
…raction (#1778)

/special lists Hardcoded special role Interactions from the Setup.

Warlock wins if they get One correct guess in One Night Mode
  • Loading branch information
SawJester authored Dec 9, 2024
1 parent 32a1ebf commit c8efd7c
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 11 deletions.
38 changes: 37 additions & 1 deletion Games/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,8 @@ module.exports = class Game {
i++;
}
}

this.SpecialInteractionRoles = [];
let tempSInteraction;
for (let z = 0; z < this.PossibleRoles.length; z++) {
if (this.PossibleRoles[z].split(":")[0] == "Magus") {
this.MagusPossible = true;
Expand All @@ -1053,6 +1054,9 @@ module.exports = class Game {
if (this.getRoleTags(this.PossibleRoles[z]).includes("Pregame Actions")) {
this.HaveDuskOrDawn = true;
}
if(this.getSpecialInteractions(this.PossibleRoles[z]) != null){
this.SpecialInteractionRoles.push(this.PossibleRoles[z]);
}
}
if (this.setup.closed && this.setup.banished > 0) {
var banishedRoles = this.banishedRoles;
Expand Down Expand Up @@ -1231,6 +1235,15 @@ module.exports = class Game {
return roleData[this.type][role.split(":")[0]].alignment;
}

getSpecialInteractions(role) {
if(roleData[this.type][role.split(":")[0]].SpecialInteractions){
return roleData[this.type][role.split(":")[0]].SpecialInteractions;
}
else{
return null;
}
}

getRoleTags(role) {
let roleFull = role;
let modifiers = roleFull.split(":")[1];
Expand Down Expand Up @@ -1428,6 +1441,29 @@ module.exports = class Game {
),
];
}

if (this.SpecialInteractionRoles.length > 0 && this.currentState == 0) {
this.SpecialInteractionText = [];
let special;
for(let role of this.SpecialInteractionRoles){
special = this.getSpecialInteractions(role);
if(this.isOneNightMode() && special["OneNightMode"]){
this.SpecialInteractionText.push(`:journ: ${role.split(":")[0]} has a Special Interaction With One Night Mode, ${special["OneNightMode"]}`);
}
for(let r of this.PossibleRoles){
if(special[r.split(":")[0]]){
this.SpecialInteractionText.push(`:journ: ${role.split(":")[0]} has a Special Interaction With ${r.split(":")[0]}, ${special[r.split(":")[0]]}`);
}
}
}
if(this.SpecialInteractionText.length > 0){
this.sendAlert(
`:crystal: ${this.setup.name}: This Setup has Special Role Interactions do /special to see them.`,
undefined,
{ color: " #eb347a" }
);
}
}

// Check for inactivity
this.inactivityCheck();
Expand Down
34 changes: 34 additions & 0 deletions Games/core/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,40 @@ module.exports = class Player {
this.sendAlert(`The Night Order is: ${this.game.NightOrder}`);

return;
case "special":
if (!this.game.started) {
this.sendAlert(`This command can only be used during the game`);
return;
}
if (this.specialCooldown == true) {
this.sendAlert(`This command has a 20 seconds cooldown, wait plz`);
return;
}
if (this.game.type != "Mafia") {
this.sendAlert(`This command is only supported in Mafia games`);
return;
}
this.specialCooldown = true;
setTimeout(() => {
this.specialCooldown = false;
}, 20000);

if(this.game.SpecialInteractionText.length > 0){
this.sendAlert(
`:crystal: ${this.game.setup.name} has the Following Special Interactions.`,
undefined,
{ color: " #eb347a" }
);
for(let text of this.game.SpecialInteractionText){
this.sendAlert(text,undefined,{ color: " #eb347a" });
}
}
else{
this.sendAlert(`:crystal: ${this.game.setup.name}: has No Special Role Interactions`);
}
//this.sendAlert(`The Night Order is: ${this.game.NightOrder}`);

return;
}

return cmd;
Expand Down
4 changes: 1 addition & 3 deletions Games/types/Mafia/information/AlignmentInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ module.exports = class AlignmentInfo extends Information{

getInfoFormated(){
super.getInfoRaw();
if(this.randomTarget == true){
return `You Learn that your ${this.target.name}'s Alignment is ${this.mainInfo}`
}
return `You Learn that your Target's Alignment is ${this.mainInfo}`
//return `You Learn that your Target's Alignment is ${this.mainInfo}`
}

isTrue() {
Expand Down
4 changes: 1 addition & 3 deletions Games/types/Mafia/information/RoleInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ module.exports = class RoleInfo extends Information{

getInfoFormated(){
super.getInfoRaw();
if(this.randomTarget == true){
return `You Learn that your ${this.target.name}'s Role is ${this.mainInfo}`
}
return `You Learn that your Target's Role is ${this.mainInfo}`
//return `You Learn that your Target's Role is ${this.mainInfo}`
}

isTrue() {
Expand Down
3 changes: 3 additions & 0 deletions Games/types/Mafia/roles/cards/WinIfPrescientVote.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module.exports = class WinIfPrescientVote extends Card {
this.player.alive
) {
this.predictedCorrect += 1;
if(this.game.isOneNightMode()){
this.predictedCorrect += 1;
}
this.player.giveEffect("ExtraLife");
this.player.queueAlert(
`The Village has condemned ${this.predictedVote.name} to death, strengthening your bond with the spirit world. You gain an extra life.`
Expand Down
46 changes: 42 additions & 4 deletions data/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,11 @@ const roleData = {
description: [
"If an Evil player is condemned, All players are inflicted with Mind Rot that night.",
],
SpecialInteractions: {
Assassin: [
"If an Assassin is Present, All players are inflicted with Mind Rot if an Evil Player is Elected as Room Leader.",
],
},
},
Princess: {
alignment: "Village",
Expand Down Expand Up @@ -1281,6 +1286,11 @@ const roleData = {
"Cannot be killed or converted at night.",
"Can only be killed by village condemnation.",
],
SpecialInteractions: {
Hellhound: [
"A Hellhound can kill a Granny at Night.",
],
},
},
Jailer: {
alignment: "Village",
Expand Down Expand Up @@ -1399,9 +1409,14 @@ const roleData = {
category: "Essential",
tags: ["Essential", "Selective Revealing","Exposed"],
description: [
"All villagers will know who the President is, unless an Assassin is present.",
"All villagers will know who the President is.",
"When the President dies, the Mafia will win.",
],
SpecialInteractions: {
Assassin: [
"If an Assassin is Present, Village Aligned Players will not learn who the President is.",
],
},
},
Saint: {
alignment: "Village",
Expand Down Expand Up @@ -1990,6 +2005,11 @@ const roleData = {
"Each night, predicts the village vote.",
"If they successfully predict the village vote, they gain a bonus kill.",
],
SpecialInteractions: {
Assassin: [
"If an Assassin is Present, Bookie will gain a bonus kill if they can guess a player who is Elected as Room Leader.",
],
},
},
Ape: {
alignment: "Mafia",
Expand Down Expand Up @@ -3099,8 +3119,12 @@ const roleData = {
tags: ["Neighbors", "Death"],
description: [
"Wins if both of their starting neighbors are dead.",
"In One Night Mode, Wins if one of their neighbors is killed.",
],
SpecialInteractions: {
OneNightMode: [
"In One Night Mode, Fumigator Wins if one of their neighbors is killed.",
],
},
},
Doppelgänger: {
alignment: "Independent",
Expand Down Expand Up @@ -3254,6 +3278,14 @@ const roleData = {
"If that person is condemned the next day, the Warlock has predicted correctly. They gain an extra life.",
"The Warlock wins if they predict the condemnation correctly twice.",
],
SpecialInteractions: {
Assassin: [
"If an Assassin is Present, The Warlock wins if they can guess a player who is Elected as Room Leader Twice.",
],
OneNightMode: [
"In One Night Mode, The Warlock wins if they predict the condemnation correctly Once.",
],
},
},
Rival: {
alignment: "Independent",
Expand Down Expand Up @@ -3326,9 +3358,15 @@ const roleData = {
"Meets with All Independents",
"Grants All Independents a random Infomation or Role Swapping ability.",
"Wins if Independents have majority.",
"In One Night mode, Wins if no Independents die.",
"In One Night mode, Village must kill an Independent to win.",
],
SpecialInteractions: {
OneNightMode: [
"In One Night Mode, Superheros Wins if no Independents die.",
"In One Night Mode, Village must kill an Independent to win in addition to other evil Factions.",
"In One Night Mode, Mafia/Cult must kill an Independent to win in addition to competing evil Factions.",
"In One Night Mode, Independents with the (Lone) Modifier are not counted as Independents for any of these Win Con",
],
},
},
Ghost: {
alignment: "Independent",
Expand Down
5 changes: 5 additions & 0 deletions react_main/src/constants/commandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ export const commandList = {
description:
"Lists the Night Order for the Setup (Ties are resloved by Player Order).",
},
"/special": {
input: "N/A",
description:
"Lists Any Special Role Interactions for the Setup.",
},
};
5 changes: 5 additions & 0 deletions react_main/src/pages/Learn/LearnWackyWords.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export default function LearnWackyWords(props) {
convincing another person to guess their answer, and the true answerer
gets 2 points when players guess their answer!
</Typography>
<Typography variant="body1" paragraph>
Acrotopia: In Acrotopia, All players are given an acronym and tasked to create a backronym based on it! All players then vote for their
favorites, with the winners of each round getting points. The person with the most points at the end of the game is
declared the winner
</Typography>
<Accordion>
<AccordionSummary>
<Typography variant="h4">Roles</Typography>
Expand Down

0 comments on commit c8efd7c

Please sign in to comment.