Skip to content

Commit

Permalink
Bug Fixes + Insightful rework + Added Host to Wacky Words and Liars D…
Browse files Browse the repository at this point in the history
…ice, + Added Governor to Wacky Words (#1771)

Fixed some roles not working if dawn/dusk occurs.

Paparazzo only reveals to mafia

Insightful now learns instantly.

Host in Wacky Words can choose the Prompts.
Governor turns Wacky Words into Acrotopia

Host in Liars Dice does nothing but It can watch the game while being
able to chat.

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Nov 30, 2024
1 parent 9cd354e commit afafcbe
Show file tree
Hide file tree
Showing 106 changed files with 4,758 additions and 431 deletions.
13 changes: 11 additions & 2 deletions Games/types/LiarsDice/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,22 @@ module.exports = class LiarsDiceGame extends Game {
this.sendAlert(`Good luck... You'll probably need it.`);

//start of game - randomizes player order, and gives dice to everyone.
this.randomizedPlayers = Random.randomizeArray(this.players.array());
this.hasHost = this.setup.roles[0]["Host:"];
if (this.hasHost) {
let hostPlayer = this.players.array()[0];
this.randomizedPlayers = Random.randomizeArray(
this.players.array()
).filter((p) => p != hostPlayer);
} else {
this.randomizedPlayers = Random.randomizeArray(this.players.array());
}
this.randomizedPlayersCopy = this.randomizedPlayers;

this.randomizedPlayers.forEach((player) => {
player.diceNum = this.startingDice;
});

// super.start();
this.rollDice();
this.startRoundRobin();

Expand Down Expand Up @@ -923,7 +932,7 @@ module.exports = class LiarsDiceGame extends Game {
},
});

if (player.alive) {
if (player.alive && player != this.hostPlayer) {
this.sendAlert(
`${player.name} left, but their ${player.rolledDice.length} dice will still count towards this round's total.`
);
Expand Down
10 changes: 10 additions & 0 deletions Games/types/LiarsDice/roles/Host/Host.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const Role = require("../../Role");

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

this.alignment = "Host";
this.cards = ["TownCore"];
}
};
6 changes: 5 additions & 1 deletion Games/types/LiarsDice/roles/cards/WinIfLastAlive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ module.exports = class WinIfLastAlive extends Card {
this.winCheck = {
priority: 0,
check: function (counts, winners, aliveCount) {
if (aliveCount <= 1 && this.player.alive)
let nonHostAlive = this.game
.alivePlayers()
.filter((p) => p.role.name != "Host");

if (nonHostAlive.length <= 1 && this.player.alive)
winners.addPlayer(this.player, this.name);
},
};
Expand Down
24 changes: 23 additions & 1 deletion Games/types/Mafia/roles/cards/Ascetic.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const Card = require("../../Card");
const Action = require("../../Action");
const { PRIORITY_UNTARGETABLE } = require("../../const/Priority");

module.exports = class Ascetic extends Card {
constructor(role) {
super(role);

/*
this.actions = [
{
priority: PRIORITY_UNTARGETABLE,
Expand All @@ -16,5 +17,26 @@ module.exports = class Ascetic extends Card {
},
},
];
*/
this.listeners = {
state: function (stateInfo) {
if (!this.player.alive) {
return;
}
if (!stateInfo.name.match(/Night/)) {
return;
}
var action = new Action({
actor: this.player,
priority: PRIORITY_UNTARGETABLE,
game: this.player.game,
labels: ["stop", "hidden"],
run: function () {
this.makeUntargetable(this.actor, "kill");
},
});
this.game.queueAction(action);
},
};
}
};
85 changes: 83 additions & 2 deletions Games/types/Mafia/roles/cards/AskDeadQuestion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Card = require("../../Card");
const Action = require("../../Action");
const {
PRIORITY_DAY_DEFAULT,
PRIORITY_INVESTIGATIVE_DEFAULT,
Expand All @@ -25,10 +26,23 @@ module.exports = class AskDeadQuestion extends Card {
'Answer Mourner asking "' + this.actor.role.data.question + '"';
this.actor.role.mournerYes = 0;
this.actor.role.mournerNo = 0;
if (!this.actor.role.data.question) {
return;
}
for (let player of this.game.players) {
if (!player.alive) {
player.holdItem("Mourned", {
mourner: this.actor,
question: this.actor.role.data.question,
meetingName: this.actor.role.data.meetingName,
});
}
}
},
},
},
};
/*
this.actions = [
// give mourned item to dead
{
Expand All @@ -39,7 +53,10 @@ module.exports = class AskDeadQuestion extends Card {
return;
}
if (this.game.getStateName() !== "Day") {
if (
this.game.getStateName() !== "Day" &&
this.game.getStateName() !== "Dusk"
) {
return;
}
Expand Down Expand Up @@ -67,7 +84,10 @@ module.exports = class AskDeadQuestion extends Card {
return;
}
if (this.game.getStateName() !== "Night") {
if (
this.game.getStateName() !== "Night" &&
this.game.getStateName() !== "Dawn"
) {
return;
}
Expand Down Expand Up @@ -104,5 +124,66 @@ module.exports = class AskDeadQuestion extends Card {
},
},
];
*/

this.listeners = {
state: function (stateInfo) {
if (stateInfo.name.match(/Day/)) {
}
if (!stateInfo.name.match(/Night/)) {
return;
}
var action = new Action({
actor: this.player,
game: this.player.game,
priority: PRIORITY_INVESTIGATIVE_DEFAULT,
run: function () {
if (!this.actor.alive) {
return;
}

if (
this.game.getStateName() !== "Night" &&
this.game.getStateName() !== "Dawn"
) {
return;
}

if (!this.actor.role.data.question) {
return;
}

let numYes = this.actor.role.mournerYes;
let numNo = this.actor.role.mournerNo;

let totalResponses = numYes + numNo;

let percentNo = Math.round((numNo / totalResponses) * 100);
let percentYes = Math.round((numYes / totalResponses) * 100);

if (this.actor.hasEffect("FalseMode")) {
if (totalResponses === 0) {
percentYes = 100;
percentNo = 0;
totalResponses = totalResponses + 1;
} else {
let temp = percentNo;
percentNo = percentYes;
percentYes = temp;
}
}

if (totalResponses === 0)
this.actor.queueAlert(`You receive no responses from the dead.`);
else
this.actor.queueAlert(
`The dead has replied with ${percentYes}% Yes's and ${percentNo}% No's to your question "${this.actor.role.data.question}".`
);
},
});

this.game.queueAction(action);
},
};
}
};
28 changes: 27 additions & 1 deletion Games/types/Mafia/roles/cards/Astral.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const Card = require("../../Card");
const Action = require("../../Action");
const { PRIORITY_MODIFY_ACTION_LABELS } = require("../../const/Priority");

module.exports = class Astral extends Card {
constructor(role) {
super(role);

/*
this.actions = [
{
priority: PRIORITY_MODIFY_ACTION_LABELS,
Expand All @@ -23,5 +24,30 @@ module.exports = class Astral extends Card {
},
},
];
*/
this.listeners = {
state: function (stateInfo) {
if (!stateInfo.name.match(/Night/)) {
return;
}
var action = new Action({
actor: this.player,
game: this.player.game,
priority: PRIORITY_MODIFY_ACTION_LABELS,
labels: ["absolute", "hidden"],
run: function () {
for (let action of this.game.actions[0]) {
if (
action.priority > this.priority &&
action.actors.includes(this.actor)
) {
action.labels = [...action.labels, "hidden"];
}
}
},
});
this.game.queueAction(action);
},
};
}
};
53 changes: 36 additions & 17 deletions Games/types/Mafia/roles/cards/BecomeAlignmentOfVisitors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Card = require("../../Card");
const Action = require("../../Action");
const {
PRIORITY_BLOCK_VISITORS,
PRIORITY_WIN_CHECK_DEFAULT,
Expand All @@ -7,7 +8,7 @@ const {
module.exports = class BecomeAlignmentOfVisitors extends Card {
constructor(role) {
super(role);

/*
this.actions = [
{
priority: PRIORITY_BLOCK_VISITORS - 1,
Expand All @@ -27,25 +28,43 @@ module.exports = class BecomeAlignmentOfVisitors extends Card {
this.actor.faction = visit.faction;
return;
}
/*
for (let action of this.game.actions[0]) {
if (action.target == this.actor && !action.hasLabel("hidden")) {
},
},
];
*/
this.listeners = {
state: function (stateInfo) {
if (!this.player.alive) {
return;
}
if (!stateInfo.name.match(/Night/)) {
return;
}
var action = new Action({
actor: this.player,
target: target,
game: this.player.game,
priority: PRIORITY_BLOCK_VISITORS - 1,
labels: ["block", "hidden"],
run: function () {
if (!this.actor.alive) return;

if (
action.priority > this.priority
) {
if (this.dominates(action.actor)) {
this.blockWithMindRot(action.actor);
}
for (let visit of this.getVisitors(this.actor)) {
if (this.dominates(visit)) {
this.blockWithMindRot(visit);
}
this.actor.queueAlert(`After Hitchhiking with a player you feel like Supporting the ${action.actors [0].role.alignment}.`);
this.actor.role.alignment = action.actor.role.alignment;
return;

this.actor.queueAlert(
`After Hitchhiking with a player you feel like Supporting the ${visit.faction}.`
);
this.actor.faction = visit.faction;
return;
}
}
*/
},
},
});

this.game.queueAction(action);
},
];
};
}
};
Loading

0 comments on commit afafcbe

Please sign in to comment.