Skip to content

Commit

Permalink
Alien from One Night + Bug Fixes (#1744)
Browse files Browse the repository at this point in the history
Diviner now can learn not in play roles as the fake role.
Groundskeeper gets no info if no dead players.
Vampires now appear as random non-vampire evils.
Added Message for retired modifier if no one has the original role.
Rival can now Win.

Added Alien from One Night as Ringleader, If a Ringleader is possible in
Setup, Some Indepantant roles join the mafia meeting and Mafia won't
learn each other's roles", "The Ringleader grants the Mafia
team+Independents in meeting an Ability.", "If a Ringleader is possible
in Setup, Mafia cannot with any Independants that join the meeting."

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Oct 14, 2024
1 parent cd2ce2d commit 43e8762
Show file tree
Hide file tree
Showing 21 changed files with 600 additions and 28 deletions.
9 changes: 9 additions & 0 deletions Games/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,15 @@ module.exports = class Game {
}
}

this.players.map((p) => this.events.emit("ReplaceAlways", p));

this.rollQueue = [];

while (this.rollQueue.length < 0) {
this.events.emit("ReplaceAlways", rollQueue[0]);
this.rollQueue.shift();
}

this.players.map((p) => this.events.emit("SwitchRoleBefore", p));

this.rollQueue = [];
Expand Down
29 changes: 29 additions & 0 deletions Games/core/Meeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,35 @@ module.exports = class Meeting {
case "self":
if (player == self) includePlayer[player.id] = include;
break;
case "neighbors":
//this.game.alivePlayers().indexOf(self);
if (this.game.alivePlayers().indexOf(player) == (this.game.alivePlayers().indexOf(self)+ 1) % players.length
|| (this.game.alivePlayers().indexOf(player) == (this.game.alivePlayers().indexOf(self)- 1 + players.length) % players.length)){
includePlayer[player.id] = include;
}
else if (this.game.deadPlayers().indexOf(player) == (this.game.deadPlayers().indexOf(self)+ 1) % players.length
|| (this.game.deadPlayers().indexOf(player) == (this.game.deadPlayers().indexOf(self)- 1 + players.length) % players.length)){
includePlayer[player.id] = include;
}
break;
case "even":
//this.game.alivePlayers().indexOf(self);
if (this.game.alivePlayers().indexOf(player)%2 == 0){
includePlayer[player.id] = include;
}
else if (this.game.deadPlayers().indexOf(player)%2 == 0){
includePlayer[player.id] = include;
}
break;
case "odd":
//this.game.alivePlayers().indexOf(self);
if (this.game.alivePlayers().indexOf(player)%2 == 1){
includePlayer[player.id] = include;
}
else if(this.game.deadPlayers().indexOf(player)%2 == 1){
includePlayer[player.id] = include;
}
break;
case "members":
if (this.members[player.id]) includePlayer[player.id] = include;
break;
Expand Down
8 changes: 8 additions & 0 deletions Games/types/Mafia/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,12 @@ module.exports = class MafiaGame extends Game {
broadcastClosedRoles: this.broadcastClosedRoles,
};
}

formatRole(role){

var roleName = role.split(":")[0];
var modifiers = role.split(":")[1];
return `${roleName}${modifiers ? ` (${modifiers})` : ""}`;
}

};
9 changes: 9 additions & 0 deletions Games/types/Mafia/items/Retirement.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ module.exports = class Retirement extends Item {
return;
}

let players = this.game.players.filter((p) => p.role.name == this.currRole);

if(players.length <= 0){
this.holder.queueAlert(
`You are a retired ${this.currRole}. You know that no one in this town is a ${this.currRole}`
);
}
else{
this.holder.queueAlert(
`You are a retired ${this.currRole}. You remember a few people you worked with!`
);
}

for (const player of this.game.players) {
if (player.role.name == this.currRole) {
Expand Down
34 changes: 34 additions & 0 deletions Games/types/Mafia/items/WackyFactionRoleReveal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Item = require("../Item");
const Action = require("../Action");
const { PRIORITY_EFFECT_GIVER_DEFAULT } = require("../const/Priority");
const { PRIORITY_REVEAL_DEFAULT } = require("../const/Priority");
const { MEETING_PRIORITY_HOT_SPRINGS } = require("../const/MeetingPriority");

module.exports = class WackyFactionRoleReveal extends Item {
constructor(meetingName) {
super("WackyFactionRoleReveal");

//this.reveal = reveal;
this.lifespan = 1;
this.meetingName = meetingName;
this.meetings[this.meetingName] = {
states: ["Night"],
flags: ["group", "anonymous", "voting"],
targets: { include: ["alive"]},
action: {
labels: ["hidden", "absolute","reveal","group", "multiActor"],
priority: PRIORITY_REVEAL_DEFAULT,
item: this,
run: function () {
//this.target.role.revealToPlayer(this.actor);
for(let p of this.game.players){
if (this.actor.faction == p.faction){
this.target.role.revealToPlayer(p);
}
}
this.item.drop();
},
},
};
}
};
58 changes: 58 additions & 0 deletions Games/types/Mafia/items/WackyJoinFactionMeeting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const Item = require("../Item");
const {
EVIL_FACTIONS,
NOT_EVIL_FACTIONS,
CULT_FACTIONS,
MAFIA_FACTIONS,
FACTION_LEARN_TEAM,
FACTION_WIN_WITH_MAJORITY,
FACTION_WITH_MEETING,
FACTION_KILL,
} = require("../const/FactionList");
const { PRIORITY_MAFIA_KILL } = require("../const/Priority");

module.exports = class WackyJoinFactionMeeting extends Item {
constructor(reveal) {
super("WackyJoinFactionMeeting");

//this.reveal = reveal;
this.lifespan = 1;
this.cannotBeStolen = true;
this.meetings = {
"Faction Kill": {
meetingName: "Mafia",
states: ["Night"],
flags: ["group", "speech", "voting", "multiActor", "Important"],
targets: {
include: ["alive"],
exclude: [excludeMafiaOnlyIfNotAnonymous],
},
action: {
labels: ["kill", "mafia"],
priority: PRIORITY_MAFIA_KILL,
run: function () {
if (this.dominates()) {
this.target.kill("basic", this.actor);
}
},
},

},
};
}
};

function excludeMafiaOnlyIfNotAnonymous(player) {
let mafiaMeeting = player.game.getMeetingByName("Faction Kill");
if (
mafiaMeeting &&
mafiaMeeting.anonymous &&
FACTION_KILL.includes(player.faction)
) {
return false;
}

if (player.faction && FACTION_KILL.includes(player.faction)) {
return true;
}
}
34 changes: 34 additions & 0 deletions Games/types/Mafia/items/WackyRoleLearner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Item = require("../Item");
const Random = require("../../../../lib/Random");
const { PRIORITY_INVESTIGATIVE_DEFAULT } = require("../const/Priority");

module.exports = class WackyRoleLearner extends Item {
constructor(targetType) {
super("WackyRoleLearner");

this.targetType = targetType;
this.cannotBeStolen = true;
this.cannotBeSnooped = true;

this.meetings = {
"Wacky Learn Role": {
states: ["Night"],
flags: ["voting", "mustAct"],
targets: { include: [this.targetType], exclude: ["self"] },
action: {
labels: ["hidden", "absolute"],
priority: PRIORITY_INVESTIGATIVE_DEFAULT,
item: this,
run: function () {
var role = this.target.getRoleAppearance();
var alert = `:invest: You learn that ${this.target.name}'s role is ${role}.`;
this.actor.queueAlert(alert);
this.item.drop();
},
},
},
};
}
};


1 change: 1 addition & 0 deletions Games/types/Mafia/roles/Cult/Vampire.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = class Vampire extends Role {
"VampireKill",
"VampireSetup",
"VampireVotes",
"VampireAppearAsRoles",
];
this.meetingMods = {
Village: {
Expand Down
14 changes: 14 additions & 0 deletions Games/types/Mafia/roles/Mafia/Ringleader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const Role = require("../../Role");

module.exports = class Ringleader extends Role {
constructor(player, data) {
super("Ringleader", player, data);
this.alignment = "Mafia";
this.cards = [
"VillageCore",
"WinWithFaction",
"MeetingFaction",
"GiveFactionAbility",
];
}
};
14 changes: 14 additions & 0 deletions Games/types/Mafia/roles/cards/ChoirOfRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = class ChoirOfRoles extends Card {
);
victim.giveEffect("ChoirSong", this.actor, role, 1); //,this.actor,role,1
this.actor.role.data.singer = victim;
this.actor.role.data.singAbout = role;
},
},
];
Expand All @@ -40,10 +41,12 @@ module.exports = class ChoirOfRoles extends Card {
actionName: "Guess",
states: ["Day"],
flags: ["voting"],
targets: { include: ["alive"], exclude: ["self", isPrevTarget] },
labels: ["hidden", "absolute", "condemn", "overthrow"],
action: {
priority: PRIORITY_OVERTHROW_VOTE - 2,
run: function () {
this.actor.role.data.prevTarget = this.target;
if (this.target.hasEffect("ChoirSong")) {
for (let action of this.game.actions[0]) {
if (
Expand All @@ -60,9 +63,20 @@ module.exports = class ChoirOfRoles extends Card {
this.target.kill("condemn", this.actor);
}
} //End if
else{
if(this.actor.role.data.singer){
this.actor.queueAlert(
`${this.actor.role.data.singer.name} was singing about ${this.actor.role.data.singAbout}, Your guess was Incorrect. You cannot Guess ${this.target.name} tomorrow!`);
}
}

},
},
},
};
}
};

function isPrevTarget(player) {
return this.role && player == this.role.data.prevTarget;
}
2 changes: 1 addition & 1 deletion Games/types/Mafia/roles/cards/CountEvilVotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = class CountEvilVotes extends Card {
}

if (this.actor.role.data.evilVoted == true) {
alert = `:invest: You learn that at least 1 Evil Player voted with the Majority yesterday!`;
alert = `:invest: You learn that Evil Players voted with the Majority yesterday!`;
} else {
alert = `:invest: You learn that no evil players voted with the Majority yesterday!`;
}
Expand Down
Loading

0 comments on commit 43e8762

Please sign in to comment.