Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assassin Interaction with Other Roles Imporovments #1766

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f53efc4
Prettified Code!
SawJester Nov 15, 2024
62088c9
Update ImportantMeetings.js
SawJester Nov 15, 2024
2ee8abd
Prettified Code!
SawJester Nov 15, 2024
d931cd8
Update ChoirOfRoles.js
SawJester Nov 15, 2024
d6c667d
Prettified Code!
SawJester Nov 15, 2024
e2fff4b
Update Ventriloquist.js
SawJester Nov 15, 2024
fda4c20
Update Spy.js
SawJester Nov 15, 2024
56c012c
Update Agent.js
SawJester Nov 15, 2024
710a11a
Update TownCrier.js
SawJester Nov 15, 2024
0df64e2
Update Judge.js
SawJester Nov 15, 2024
e2f1615
Update King.js
SawJester Nov 15, 2024
6ce8b68
Update Crowned.js
SawJester Nov 15, 2024
583233e
Prettified Code!
SawJester Nov 15, 2024
019d9e1
Update Player.js
SawJester Nov 15, 2024
6e0dd53
Prettified Code!
SawJester Nov 15, 2024
220f721
Update CursedVote.js
SawJester Nov 16, 2024
3baed03
Prettified Code!
SawJester Nov 16, 2024
5b44327
Update ParalyzeAll.js
SawJester Nov 16, 2024
96ffc7a
Prettified Code!
SawJester Nov 16, 2024
a0897da
Update Room.js
SawJester Nov 16, 2024
b152515
Update Whistleblown.js
SawJester Nov 16, 2024
1c7b01d
Prettified Code!
SawJester Nov 16, 2024
15f0b4a
Update Tree.js
SawJester Nov 16, 2024
e4a0921
Update ForceSplitDecision.js
SawJester Nov 16, 2024
ea05532
Prettified Code!
SawJester Nov 16, 2024
a71d286
Update Priority.js
SawJester Nov 16, 2024
da818dc
Prettified Code!
SawJester Nov 16, 2024
6efba55
Update Priority.js
SawJester Nov 16, 2024
cc128d2
Prettified Code!
SawJester Nov 16, 2024
eba4196
Update ForceSplitDecision.js
SawJester Nov 16, 2024
ce4e36a
Update RoomLeader.js
SawJester Nov 16, 2024
a90992f
Update CountEvilVotes.js
SawJester Nov 16, 2024
ae80762
Prettified Code!
SawJester Nov 16, 2024
69141d9
Update Room.js
SawJester Nov 16, 2024
2838f23
Prettified Code!
SawJester Nov 16, 2024
15c1644
Update BookieWager.js
SawJester Nov 16, 2024
4f3decc
Prettified Code!
SawJester Nov 16, 2024
6aa0336
Update MindRotEveryoneOnEvilCondemn.js
SawJester Nov 16, 2024
09b00e4
Update WinIfPrescientVote.js
SawJester Nov 16, 2024
235f2b6
Prettified Code!
SawJester Nov 16, 2024
81461c9
Pending changes exported from your codespace
SawJester Nov 16, 2024
f05822a
Update MagusGame.js
SawJester Nov 17, 2024
4cb8b1a
Update MagusGame.js
SawJester Nov 17, 2024
30b7ff4
Update WinIfRivalIsDead.js
SawJester Nov 17, 2024
1b02c41
Update roles.js
SawJester Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Games/core/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ module.exports = class Player {

if (message.cancel) return;

for (let item of this.items) {
item.hear(message);
if (message.cancel) return;
}

for (let effect of this.effects) {
effect.hear(message);
if (message.cancel) return;
Expand Down
6 changes: 6 additions & 0 deletions Games/types/Mafia/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ module.exports = class MafiaPlayer extends Player {
if (
!this.alive &&
(message.meeting.name == "Village" ||
message.meeting.name == "Room 1" ||
message.meeting.name == "Room 2" ||
message.meeting.name == "Leaders" ||
message.meeting.name == "Graveyard" ||
message.meeting.name == "Party!")
) {
Expand All @@ -125,6 +128,9 @@ module.exports = class MafiaPlayer extends Player {
if (
!this.alive &&
(quote.meeting.name == "Village" ||
quote.meeting.name == "Room 1" ||
quote.meeting.name == "Room 2" ||
quote.meeting.name == "Leaders" ||
quote.meeting.name == "Graveyard" ||
quote.meeting.name == "Party!")
) {
Expand Down
11 changes: 10 additions & 1 deletion Games/types/Mafia/const/ImportantMeetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const IMPORTANT_MEETINGS_NIGHT = [
"Red Mafia Kill",
"undefined",
"*",
"Leaders",
"Hostage Swap",
];
const INVITED_MEETINGS = ["Party!", "Hot Springs", "Banquet", "Superhero"];
const STARTS_WITH_MEETINGS = [
Expand All @@ -15,7 +17,14 @@ const STARTS_WITH_MEETINGS = [
"Sidekick with",
"Neighbors with",
];
const IMPORTANT_MEETINGS_DAY = ["Village", "Magus Game"];
const IMPORTANT_MEETINGS_DAY = [
"Village",
"Magus Game",
"Room 1",
"Room 2",
"Extra Condemn",
"Bonus Condemn",
];

module.exports = {
IMPORTANT_MEETINGS_NIGHT,
Expand Down
3 changes: 3 additions & 0 deletions Games/types/Mafia/const/Priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const PRIORITY_FULL_DISABLE = -200;
const PRIORITY_UNTARGETABLE = -180;
const PRIORITY_MODIFY_ACTION_LABELS = -120;

const PRIORITY_ROOM_SWAP = -115;

const PRIORITY_REDIRECT_ACTION = -110;
const PRIORITY_COPY_ACTIONS = -105;
const PRIORITY_SWAP_VISITORS = -104;
Expand Down Expand Up @@ -89,6 +91,7 @@ module.exports = {
PRIORITY_MODIFY_ACTION_LABELS,
PRIORITY_MODIFY_ACTION_DELAY,
PRIORITY_MODIFY_ACTION,
PRIORITY_ROOM_SWAP,

PRIORITY_REDIRECT_ACTION,
PRIORITY_COPY_ACTIONS,
Expand Down
15 changes: 14 additions & 1 deletion Games/types/Mafia/effects/Crowned.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,29 @@ module.exports = class Crowned extends Effect {
super.apply(player);

let villageMeeting;
let room1;
let room2;
for (const meeting of player.game.meetings) {
if (meeting.name === "Village") {
villageMeeting = meeting;
break;
}
if ((meeting.name = "Room 1")) {
room1 = meeting;
}
if ((meeting.name = "Room 2")) {
room2 = meeting;
}
}

if (villageMeeting) {
villageMeeting.members[player.id].voteWeight = Infinity;
}
if (room1) {
room1.members[player.id].voteWeight = Infinity;
}
if (room2) {
room2.members[player.id].voteWeight = Infinity;
}

/*
if (player.role.meetings[this.meetingName]) {
Expand Down
4 changes: 3 additions & 1 deletion Games/types/Mafia/effects/CursedVote.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module.exports = class CursedVote extends Effect {
this.listeners = {
vote: function (vote) {
if (
vote.meeting.name === "Village" &&
(vote.meeting.name === "Village" ||
vote.meeting.name === "Room 1" ||
vote.meeting.name === "Room 2") &&
vote.voter === this.player &&
vote.target === this.target.id
) {
Expand Down
13 changes: 13 additions & 0 deletions Games/types/Mafia/effects/Insanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ module.exports = class Insanity extends Effect {
this.remove();
}
},
state: function (stateInfo) {
for (let item of this.player.items){
if (item.name == "Room" && this.game.RoomOne.includes(this.player)) {
item.meetings["Room 1"].canVote = false;
item.meetings["Room 1"].canWhisper = false;
}
if (item.name == "Room" && this.game.RoomTwo.includes(this.player)) {
item.meetings["Room 2"].canVote = false;
item.meetings["Room 2"].canWhisper = false;
}
}

},
};
}

Expand Down
13 changes: 13 additions & 0 deletions Games/types/Mafia/effects/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ module.exports = class Tree extends Effect {
this.immunity["kill"] = 5;
this.cancelImmunity["ignite"] = Infinity;
this.cancelImmunity["bomb"] = Infinity;
this.listeners = {
state: function (stateInfo) {
for (let item of this.player.items){
if (item.name == "Room" && this.game.RoomOne.includes(this.player)) {
item.meetings["Room 1"].canVote = false;
}
if (item.name == "Room" && this.game.RoomTwo.includes(this.player)) {
item.meetings["Room 2"].canVote = false;
}
}

},
};
}
apply(player) {
super.apply(player);
Expand Down
21 changes: 21 additions & 0 deletions Games/types/Mafia/effects/Whistleblown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ module.exports = class Whistleblown extends Effect {

apply(player) {
super.apply(player);
if (this.game.RoomOne.length > 0 && this.game.RoomTwo.length > 0) {
for (let item of this.player.items){
if (item.name == "Room" && this.game.RoomOne.includes(this.player)) {
item.meetings["Room 1"].canVote = false;
}
if (item.name == "Room" && this.game.RoomTwo.includes(this.player)) {
item.meetings["Room 2"].canVote = false;
}
}
}

this.cannotVoteEffect = player.giveEffect("CannotVote", 1);

this.cannotBeVotedEffect = player.giveEffect("CannotBeVoted", 1);
}

Expand All @@ -18,5 +29,15 @@ module.exports = class Whistleblown extends Effect {
this.cannotBeVotedEffect.remove();

super.remove();
if (this.game.RoomOne.length > 0 && this.game.RoomTwo.length > 0) {
for (let item of this.player.items){
if (item.name == "Room" && this.game.RoomOne.includes(this.player)) {
item.meetings["Room 1"].canVote = true;
}
if (item.name == "Room" && this.game.RoomTwo.includes(this.player)) {
item.meetings["Room 2"].canVote = true;
}
}
}
}
};
1 change: 0 additions & 1 deletion Games/types/Mafia/items/JuryDuty.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = class JuryDuty extends Item {
this.cannotBeStolen = true;
this.meetings = {
Court: {
meetingName: "Court Session",
states: ["Dusk"],
flags: ["group", "speech", "voting", "anonymous", "mustAct"],
targets: { include: ["alive"], exclude: ["dead"] },
Expand Down
8 changes: 4 additions & 4 deletions Games/types/Mafia/items/NoVillageMeeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ module.exports = class NoVillageMeeting extends Item {

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]}`){
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`){
if (name == `${FACTION_WITH_MEETING[x]} Meeting`) {
return true;
}
if(name == `${FACTION_WITH_MEETING[x]} Kill`){
if (name == `${FACTION_WITH_MEETING[x]} Kill`) {
return true;
}
}
Expand Down
25 changes: 22 additions & 3 deletions Games/types/Mafia/items/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
FACTION_WITH_MEETING,
FACTION_KILL,
} = require("../const/FactionList");
const { PRIORITY_OVERTHROW_VOTE } = require("../const/Priority");
const { PRIORITY_ROOM_SWAP } = require("../const/Priority");

module.exports = class Room extends Item {
constructor(meetingName) {
Expand All @@ -21,17 +21,33 @@ module.exports = class Room extends Item {
this.meetings[meetingName] = {
actionName: "Elect Leader",
states: ["Day"],
targets: { include: ["members"], exclude: ["dead"] },
targets: { include: ["members"], exclude: [cannotBeVoted, "dead"] },
flags: ["group", "voting", "speech", "mustAct"],
whileDead: true,
passiveDead: true,
action: {
labels: ["hidden"],
priority: PRIORITY_OVERTHROW_VOTE,
priority: PRIORITY_ROOM_SWAP,
run: function () {
if (meetingName == "Room 1") {
if (
this.game.RoomOneLeader == null ||
this.game.RoomOneLeader == this.target
) {
this.game.events.emit("ElectedRoomLeader", this.target, 1, false);
} else {
this.game.events.emit("ElectedRoomLeader", this.target, 1, true);
}
this.game.RoomOneLeader = this.target;
} else if (meetingName == "Room 2") {
if (
this.game.RoomTwoLeader == null ||
this.game.RoomTwoLeader == this.target
) {
this.game.events.emit("ElectedRoomLeader", this.target, 2, false);
} else {
this.game.events.emit("ElectedRoomLeader", this.target, 2, true);
}
this.game.RoomTwoLeader = this.target;
} else {
this.game.RoomThreeLeader = this.target;
Expand All @@ -41,3 +57,6 @@ module.exports = class Room extends Item {
};
}
};
function cannotBeVoted(player) {
return player.hasEffect("CannotBeVoted");
}
52 changes: 30 additions & 22 deletions Games/types/Mafia/items/RoomLeader.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const Random = require("../../../../lib/Random");
const Item = require("../Item");
const { PRIORITY_SWAP_ROLES } = require("../const/Priority");
const { PRIORITY_ROOM_SWAP } = 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){
if (this.room == 1) {
this.targets = [isInRoom1];
}
else{
} else {
this.targets = [isInRoom2];
}
this.listeners = {
Expand All @@ -36,26 +35,35 @@ module.exports = class RoomLeader extends Item {
multiMax: game.currentSwapAmt,
action: {
item: this,
priority: PRIORITY_SWAP_ROLES,
priority: PRIORITY_ROOM_SWAP,
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);
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");
},
Expand All @@ -65,10 +73,10 @@ module.exports = class RoomLeader extends Item {
}
};
function isInRoom1(player) {
return player.game.RoomOne.includes(player);
// return this.room && player == this.role.data.prevTarget;
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;
}
// return this.room && player == this.role.data.prevTarget;
}
22 changes: 21 additions & 1 deletion Games/types/Mafia/roles/Independent/Judge.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,27 @@ module.exports = class Judge extends Role {
},
],
},
"Court Session": {
"Room 1": {
speechAbilities: [
{
name: "Cry",
targets: ["out"],
targetType: "out",
verb: "",
},
],
},
"Room 2": {
speechAbilities: [
{
name: "Cry",
targets: ["out"],
targetType: "out",
verb: "",
},
],
},
Court: {
speechAbilities: [
{
name: "Cry",
Expand Down
Loading
Loading