Skip to content

Commit

Permalink
Cop message fixed (Fully Tested (Should 100% work now (3rd times the …
Browse files Browse the repository at this point in the history
…charm))) + Janitor Jounralist Fixed + New* Mafia Role + Monuror fix + Caroler/Dreamer Info Changes (#1783)

Cop Message is fixed

Journalist can see Jan reports

Monuror now learns info

Caroler/Dreamer now show Hostiles as Evil

New* Mafia Role, Consigliere, Mafia version of philosopher.

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Dec 14, 2024
1 parent ca3f279 commit 72048ce
Show file tree
Hide file tree
Showing 51 changed files with 1,869 additions and 969 deletions.
78 changes: 45 additions & 33 deletions Games/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ module.exports = class Game {
i++;
}
}
this.SpecialInteractionRoles = [];
this.SpecialInteractionRoles = [];
let tempSInteraction;
for (let z = 0; z < this.PossibleRoles.length; z++) {
if (this.PossibleRoles[z].split(":")[0] == "Magus") {
Expand All @@ -1054,7 +1054,7 @@ this.SpecialInteractionRoles = [];
if (this.getRoleTags(this.PossibleRoles[z]).includes("Pregame Actions")) {
this.HaveDuskOrDawn = true;
}
if(this.getSpecialInteractions(this.PossibleRoles[z]) != null){
if (this.getSpecialInteractions(this.PossibleRoles[z]) != null) {
this.SpecialInteractionRoles.push(this.PossibleRoles[z]);
}
}
Expand Down Expand Up @@ -1236,34 +1236,36 @@ this.SpecialInteractionRoles = [];
}

getSpecialInteractions(role) {
if(roleData[this.type][role.split(":")[0]].SpecialInteractions){
return roleData[this.type][role.split(":")[0]].SpecialInteractions;
}
else{
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];
if(modifiers){
//this.sendAlert(`Modifiers ${modifiers}`,undefined);
modifiers = modifiers.split("/");
if(!Array.isArray(modifiers)){
modifiers = [modifiers];
}
//this.sendAlert(`Modifiers ${modifiers}`,undefined);
if (modifiers) {
//this.sendAlert(`Modifiers ${modifiers}`,undefined);
modifiers = modifiers.split("/");
if (!Array.isArray(modifiers)) {
modifiers = [modifiers];
}
//this.sendAlert(`Modifiers ${modifiers}`,undefined);
}
let modTags;
let roleTags = [];
for(let tag of roleData[this.type][roleFull.split(":")[0]].tags){
for (let tag of roleData[this.type][roleFull.split(":")[0]].tags) {
roleTags.push(tag);
}
if(modifiers && modifiers.length > 0){
if (modifiers && modifiers.length > 0) {
//this.sendAlert(`Modifiers Pre loop ${modifiers}`,undefined);
for(let modifier of modifiers){
if(modifierData[this.type][modifier] && modifierData[this.type][modifier].tags){
for (let modifier of modifiers) {
if (
modifierData[this.type][modifier] &&
modifierData[this.type][modifier].tags
) {
//this.sendAlert(`Modifiers Tags ${modifierData[this.type][modifier].tags}`,undefined);
roleTags = roleTags.concat(modifierData[this.type][modifier].tags);
//this.sendAlert(`Role Tags ${roleTags}`,undefined);
Expand Down Expand Up @@ -1441,28 +1443,38 @@ this.SpecialInteractionRoles = [];
),
];
}

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.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(
}
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
Expand Down
77 changes: 40 additions & 37 deletions Games/core/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,40 +487,41 @@ 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" });
}
case "special":
if (!this.game.started) {
this.sendAlert(`This command can only be used during the game`);
return;
}
else{
this.sendAlert(`:crystal: ${this.game.setup.name}: has No Special Role Interactions`);
if (this.specialCooldown == true) {
this.sendAlert(`This command has a 20 seconds cooldown, wait plz`);
return;
}
//this.sendAlert(`The Night Order is: ${this.game.NightOrder}`);

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 Expand Up @@ -717,10 +718,12 @@ module.exports = class Player {
for (let effect of this.effects) {
effect.hear(message);
if (message.cancel) return;
if(message.fiddled){
message.content = message.sender.name + " says something, but you cannot hear them!";
message.modified = true;
break; }
if (message.fiddled) {
message.content =
message.sender.name + " says something, but you cannot hear them!";
message.modified = true;
break;
}
}

if (!message.modified) message = originalMessage;
Expand Down Expand Up @@ -998,7 +1001,7 @@ module.exports = class Player {
getAppearance(type, noModifier) {
noModifier = noModifier || this.role.hideModifier[type];

if (this.tempAppearance[type] != null){
if (this.tempAppearance[type] != null) {
return `${this.tempAppearance[type]}${
noModifier ? "" : ":" + this.tempAppearanceMods[type]
}`;
Expand All @@ -1011,7 +1014,7 @@ module.exports = class Player {
setTempAppearance(type, appearance) {
if (appearance == "real") appearance = this.role.name;

this.tempAppearanceMods[type] = appearance.split(":")[1];
this.tempAppearanceMods[type] = appearance.split(":")[1];

this.tempAppearance[type] = appearance.split(":")[0];
}
Expand Down
3 changes: 2 additions & 1 deletion Games/core/Role.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ module.exports = class Role {
if (this.appearance[key] == "real") this.appearance[key] = this.name;
}
for (let key in this.appearanceMods) {
if (this.appearanceMods[key] == "real") this.appearanceMods[key] = this.modifier;
if (this.appearanceMods[key] == "real")
this.appearanceMods[key] = this.modifier;
}

// Bind role to winCheck
Expand Down
4 changes: 2 additions & 2 deletions Games/types/Mafia/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ module.exports = class MafiaGame extends Game {
}

formatRoleInternal(role, modifiers) {
if(modifiers == "" || modifiers == null){
if (modifiers == "" || modifiers == null) {
modifiers = null;
}
return `${role}${modifiers ? `:${modifiers}`: ""}`;
return `${role}${modifiers ? `:${modifiers}` : ""}`;
}

createInformation(infoType, ...args) {
Expand Down
82 changes: 46 additions & 36 deletions Games/types/Mafia/Information.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,42 @@ const {
FACTION_KILL,
} = require("./const/FactionList");

module.exports = class MafiaInformation{
module.exports = class MafiaInformation {
constructor(name, creator, game) {
this.name = name;
this.creator = creator;
this.game = game;
this.mainInfo = true;
}

processInfo(){
if(this.creator != null){
if(this.creator.hasEffect("TrueMode")){
if(!this.isTrue()){
processInfo() {
if (this.creator != null) {
if (this.creator.hasEffect("TrueMode")) {
if (!this.isTrue()) {
this.makeTrue();
}
}
else if(this.creator.hasEffect("FalseMode")){
if(!this.isFalse()){
} else if (this.creator.hasEffect("FalseMode")) {
if (!this.isFalse()) {
this.makeFalse();
}
}
else if(this.creator.hasEffect("UnfavorableMode")){
if(!this.isUnfavorable()){
} else if (this.creator.hasEffect("UnfavorableMode")) {
if (!this.isUnfavorable()) {
this.makeUnfavorable();
}
}
else if(this.creator.hasEffect("FavorableMode")){
if(!this.isFavorable()){
} else if (this.creator.hasEffect("FavorableMode")) {
if (!this.isFavorable()) {
this.makeFavorable();
}
}
}
}

getInfoRaw(){
this.game.events.emit("Information",this);
getInfoRaw() {
this.game.events.emit("Information", this);
}

getInfoFormated(){
this.game.events.emit("Information",this);
getInfoFormated() {
this.game.events.emit("Information", this);
}

isTrue() {
Expand All @@ -56,37 +53,50 @@ module.exports = class MafiaInformation{
isFalse() {
return false;
}
isFavorable(){
isFavorable() {
return false;
}
isUnfavorable(){
isUnfavorable() {
return true;
}

makeTrue() {
}
makeFalse() {
}
makeFavorable(){
}
makeUnfavorable(){
}

isAppearanceEvil(player){
makeTrue() {}
makeFalse() {}
makeFavorable() {}
makeUnfavorable() {}

if(player.getRoleAppearance() == this.game.formatRole(this.game.formatRoleInternal(player.role.name,player.role.modifier))){
isAppearanceEvil(player, type) {
let revealType = type || "investigate";
if (
player.getRoleAppearance(revealType) ==
this.game.formatRole(
this.game.formatRoleInternal(player.role.name, player.role.modifier)
)
) {
return this.isEvil(player);
}

if(this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) == "Cult" ||
this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) == "Mafia" ||
(this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) == "Independent" && (this.game.getRoleTags(player.getRoleAppearance().split(" (")[0]).includes("Hostile")))){
if (
this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) ==
"Cult" ||
this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) ==
"Mafia" ||
(this.game.getRoleAlignment(player.getRoleAppearance().split(" (")[0]) ==
"Independent" &&
this.game
.getRoleTags(player.getRoleAppearance().split(" (")[0])
.includes("Hostile"))
) {
return true;
}
return false;
}
isEvil(player){
if(EVIL_FACTIONS.includes(player.faction) || (player.faction == "Independent" && this.game.getRoleTags(player.role.name).includes("Hostile"))){
isEvil(player) {
if (
EVIL_FACTIONS.includes(player.faction) ||
(player.faction == "Independent" &&
this.game.getRoleTags(player.role.name).includes("Hostile"))
) {
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion Games/types/Mafia/events/BrainBlast.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class Brainblast extends Event {
`Event: Brain Blast! A player got a brainblast and can learn another player's role!`
);
}
let targetTypes = ["neighbors", "even", "odd"];
let targetTypes = ["alive"];
let targetType = Random.randArrayVal(targetTypes);
this.target.holdItem("WackyRoleLearner", targetType, "Day");
},
Expand Down
Loading

0 comments on commit 72048ce

Please sign in to comment.