Skip to content

Commit

Permalink
Bomber from 2R1B and Lich Icon (#1765)
Browse files Browse the repository at this point in the history
Bomber makes Everyone play 2R1B.

Lich buff, Lich now has an Icon.

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Nov 13, 2024
1 parent 9f2a000 commit 0f3e923
Show file tree
Hide file tree
Showing 24 changed files with 529 additions and 100 deletions.
24 changes: 10 additions & 14 deletions Games/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,7 @@ module.exports = class Game {
) {
this.ExorciseVillageMeeting = true;
}
if (
this.getRoleTags(this.PossibleRoles[z]).includes(
"Pregame Actions"
)
) {
if (this.getRoleTags(this.PossibleRoles[z]).includes("Pregame Actions")) {
this.HaveDuskOrDawn = true;
}
}
Expand Down Expand Up @@ -1239,20 +1235,20 @@ module.exports = class Game {
let roleFull = `${role}`;
let modTags;
let roleTags = roleData[this.type][roleFull.split(":")[0]].tags;
if(roleFull.split(":")[1] != null && roleFull.split(":")[1].length > 0){
let modifiersArray = roleFull.split(":")[1].split("/");
/*this.sendAlert(
if (roleFull.split(":")[1] != null && roleFull.split(":")[1].length > 0) {
let modifiersArray = roleFull.split(":")[1].split("/");
/*this.sendAlert(
`Stuff ${roleFull}: ${roleFull.split(":")[1]}: ${modifiersArray[0]}`,
undefined,
{ color: "#F1F1F1" }
);*/
for(let w = 0; w < modifiersArray.length; w++){
modTags = modifierData[this.type][modifiersArray[w]].tags;
for(let u = 0; u < modTags.length; u++){
roleTags.push(modTags[u]);
}
for (let w = 0; w < modifiersArray.length; w++) {
modTags = modifierData[this.type][modifiersArray[w]].tags;
for (let u = 0; u < modTags.length; u++) {
roleTags.push(modTags[u]);
}
}
}
}
return roleTags;
}

Expand Down
5 changes: 2 additions & 3 deletions Games/core/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,8 @@ module.exports = class Player {
//
(options.shouldMeetMod != null &&
!options.shouldMeetMod.bind(this.role)(meetingName, options)) ||

(options.shouldMeetOneShot != null &&
!options.shouldMeetOneShot.bind(this.role)(meetingName, options)) ||
(options.shouldMeetOneShot != null &&
!options.shouldMeetOneShot.bind(this.role)(meetingName, options)) ||
//
(this.alive && options.whileAlive == false) ||
(!this.alive && !options.whileDead) ||
Expand Down
5 changes: 5 additions & 0 deletions Games/types/Mafia/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ module.exports = class MafiaGame extends Game {
this.extensions = 0;
this.extensionVotes = 0;
this.hasBeenDay = false;
this.currentSwapAmt = 1;
this.RoomOne = [];
this.RoomTwo = [];
this.FinalRound = 3;
this.CurrentRound = 0;
}

rebroadcastSetup() {
Expand Down
81 changes: 81 additions & 0 deletions Games/types/Mafia/items/NoVillageMeeting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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");

// TODO this should semantically be an effect "SnowedIn" not item
module.exports = class NoVillageMeeting extends Item {
constructor() {
super("NoVillageMeeting");

this.cannotBeStolen = true;
this.cannotBeSnooped = true;
this.lifespan = 1;
/*
this.meetings = {
NoVillageMeeting: {
actionName: "Done Waiting?",
states: ["Day"],
//flags: ["group", "speech", "voting", "mustAct", "noVeg"],
//inputType: "boolean",
passiveDead: true,
whileDead: true,
speakDead: true,
},
};
*/
/*
this.listeners = {
state: function () {
const state = this.game.getStateName();
if (state == "Day") {
this.drop();
return;
}
if (state != "Night") {
return;
}
if (this.holder.role.alignment != "Cult") {
this.holder.queueAlert(
":snowball: You're snowed in for the night… you cannot take any action!"
);
}
},
};
*/
}

shouldDisableMeeting(name) {
// do not disable jailing, gov actions
for(let x = 0; x < FACTION_WITH_MEETING.length; x++){
if(name == `Fake ${FACTION_WITH_MEETING[x]}`){
return true;
}
if(name == `${FACTION_WITH_MEETING[x]} Meeting`){
return true;
}
if(name == `${FACTION_WITH_MEETING[x]} Kill`){
return true;
}
}

if (name == "Village") {
return true;
}

if (name == "Magus Game") {
return true;
}

return false;
}
};
43 changes: 43 additions & 0 deletions Games/types/Mafia/items/Room.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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_OVERTHROW_VOTE } = require("../const/Priority");

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

//this.reveal = reveal;
this.lifespan = 1;
this.cannotBeStolen = true;
this.meetings[meetingName] = {
actionName: "Elect Leader",
states: ["Day"],
targets: { include: ["members"], exclude: ["dead"] },
flags: ["group", "voting", "speech", "mustAct"],
whileDead: true,
passiveDead: true,
action: {
labels: ["hidden"],
priority: PRIORITY_OVERTHROW_VOTE,
run: function () {
if (meetingName == "Room 1") {
this.game.RoomOneLeader = this.target;
} else if (meetingName == "Room 2") {
this.game.RoomTwoLeader = this.target;
} else {
this.game.RoomThreeLeader = this.target;
}
},
},
};
}
};
74 changes: 74 additions & 0 deletions Games/types/Mafia/items/RoomLeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const Random = require("../../../../lib/Random");
const Item = require("../Item");
const { PRIORITY_SWAP_ROLES } = require("../const/Priority");

module.exports = class RoomLeader extends Item {
constructor(game, room) {
super("RoomLeader");
this.room = room;
this.lifespan = 1;
this.cannotBeStolen = true;
if(this.room == 1){
this.targets = [isInRoom1];
}
else{
this.targets = [isInRoom2];
}
this.listeners = {
meetingsMade: function () {
this.holder.sendAlert(
`Choose ${this.game.currentSwapAmt} hostage${
this.game.currentSwapAmt > 1 ? "s" : ""
} to swap.`
);
},
};
this.meetings = {
Leaders: {
states: ["Night"],
flags: ["group", "speech"],
},
"Hostage Swap": {
states: ["Night"],
flags: ["voting", "multi", "mustAct"],
targets: { include: this.targets, exclude: ["members"] },
multiMin: game.currentSwapAmt,
multiMax: game.currentSwapAmt,
action: {
item: this,
priority: PRIORITY_SWAP_ROLES,
run: function () {
//var fromRoom = this.room;
if (!Array.isArray(this.target)) {
this.target = [this.target];
}
if(this.item.room == 1){
for (let player of this.target) {
this.game.RoomOne.splice(this.game.RoomOne.indexOf(player),1);
this.game.RoomTwo.push(player);
this.game.events.emit("RoonSwitch",player,this.actor,this.room);
}
}
else if(this.item.room == 2){
for (let player of this.target) {
this.game.RoomTwo.splice(this.game.RoomTwo.indexOf(player),1);
this.game.RoomOne.push(player);
this.game.events.emit("RoonSwitch",player,this.actor,this.room);
}
}

this.actor.dropItem("Leader");
},
},
},
};
}
};
function isInRoom1(player) {
return player.game.RoomOne.includes(player);
// return this.room && player == this.role.data.prevTarget;
}
function isInRoom2(player) {
return player.game.RoomTwo.includes(player);
// return this.room && player == this.role.data.prevTarget;
}
17 changes: 17 additions & 0 deletions Games/types/Mafia/roles/Mafia/Bomber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const Role = require("../../Role");

module.exports = class Bomber extends Role {
constructor(player, data) {
super("Bomber", player, data);

this.alignment = "Mafia";
this.cards = [
"VillageCore",
"WinWithFaction",
"MeetingFaction",
"ForceSplitDecision",
"KillAllInRoom",
"AddCopyOfRole",
];
}
};
4 changes: 3 additions & 1 deletion Games/types/Mafia/roles/Village/President.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module.exports = class President extends Role {
if (player !== this.player) {
return;
}

const bomberInGame = this.game.players.filter((p) => p.role.name === "Bomber");
if(bomberInGame.length <= 0){
this.game.queueAlert(
`President ${this.player.name}'s motorcade has broken down on the outskirts of town… the Villagers must protect them from assassination by the Mafia!`,
0,
Expand All @@ -21,6 +22,7 @@ module.exports = class President extends Role {
p != this.player
)
);
}
},
],
};
Expand Down
2 changes: 1 addition & 1 deletion Games/types/Mafia/roles/cards/AddCopyOfRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = class AddCopyOfRole extends Card {
shuffledPlayers[0].setRole("Templar", undefined, false, true);
shuffledPlayers[0].role.data.reroll = true;
shuffledPlayers[0].role.data.hasCopied = true;
} else if (this.player.role.name == "Vice President") {
} else if (this.player.role.name == "Vice President" || this.player.role.name == "Bomber") {
let players = this.game.players.filter(
(p) =>
p.role.alignment == "Village" || p.role.alignment == "Independent"
Expand Down
2 changes: 1 addition & 1 deletion Games/types/Mafia/roles/cards/ChangeRandomAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = class ChangeRandomAlignment extends Card {
) {
this.player.faction = factions[x];
}
this.player.queueAlert(`${factions[x]}`);
//this.player.queueAlert(`${factions[x]}`);
}
/*
const alignment = {
Expand Down
Loading

0 comments on commit 0f3e923

Please sign in to comment.