From 42ae68b52bc1cf26938e2a645d60de871994f85c Mon Sep 17 00:00:00 2001 From: SawJester Date: Sun, 3 Nov 2024 17:07:15 -0500 Subject: [PATCH] Hexer Change (#1760) Hexer can now hex 4 letter words because people can't read. --------- Co-authored-by: SawJester --- Games/core/Game.js | 8 +- Games/types/Mafia/Event.js | 51 ++++++------- Games/types/Mafia/Events/CaveIn.js | 4 +- Games/types/Mafia/Events/NoEvent.js | 2 - Games/types/Mafia/Events/TimeLoop.js | 5 +- Games/types/Mafia/items/CaveIn.js | 74 +++++++++---------- Games/types/Mafia/items/EventManager.js | 7 +- .../Mafia/roles/cards/CurseWithWordCult.js | 4 +- data/contributors.js | 6 +- 9 files changed, 75 insertions(+), 86 deletions(-) diff --git a/Games/core/Game.js b/Games/core/Game.js index c93e638da..a3764c416 100644 --- a/Games/core/Game.js +++ b/Games/core/Game.js @@ -1239,15 +1239,15 @@ module.exports = class Game { return roleData[this.type][role.split(":")[0]].tags; } - checkEvent(eventName,eventMod) { - let temp = this.createGameEvent(eventName,eventMod); + checkEvent(eventName, eventMod) { + let temp = this.createGameEvent(eventName, eventMod); let valid = temp.getRequirements(); return valid; } - createGameEvent(eventName, eventMods){ + createGameEvent(eventName, eventMods) { const eventClass = Utils.importGameClass(this.type, "Events", eventName); - const event = new eventClass(eventMods,this); + const event = new eventClass(eventMods, this); return event; } diff --git a/Games/types/Mafia/Event.js b/Games/types/Mafia/Event.js index 1a72f7dc4..ecff2d101 100644 --- a/Games/types/Mafia/Event.js +++ b/Games/types/Mafia/Event.js @@ -7,47 +7,40 @@ module.exports = class MafiaEvent extends Event { } getModifierRequirements() { - if(this.modifiers == null) return true; + if (this.modifiers == null) return true; //this.game.queueAlert("Checks Null"); - if ( - this.game.dayCount % 2 == 0 && - this.modifiers.includes("Odd") - ) { + if (this.game.dayCount % 2 == 0 && this.modifiers.includes("Odd")) { return false; } //this.game.queueAlert(`${this.modifiers} ${this.modifiers.includes("Odd")}`); - if ( - this.game.dayCount % 2 == 1 && - this.modifiers.includes("Even") - ) { + if (this.game.dayCount % 2 == 1 && this.modifiers.includes("Even")) { return false; } - if ( - this.game.dayCount == 1 && - this.modifiers.includes("Delayed") - ) { + if (this.game.dayCount == 1 && this.modifiers.includes("Delayed")) { return false; } return true; } doEvent() { - if(this.modifiers != null){ - if ( - this.modifiers.includes("One Shot") && - !this.modifiers.includes("Banished") - ) { - this.game.PossibleEvents.splice(this.game.PossibleEvents.indexOf(this.fullName),1); - } else if ( - this.modifiers.includes("One Shot") && - this.modifiers.includes("Banished") - ) { - this.game.BanishedEvents.splice( - this.game.BanishedEvents.indexOf(this.fullName), - 1 - ); + if (this.modifiers != null) { + if ( + this.modifiers.includes("One Shot") && + !this.modifiers.includes("Banished") + ) { + this.game.PossibleEvents.splice( + this.game.PossibleEvents.indexOf(this.fullName), + 1 + ); + } else if ( + this.modifiers.includes("One Shot") && + this.modifiers.includes("Banished") + ) { + this.game.BanishedEvents.splice( + this.game.BanishedEvents.indexOf(this.fullName), + 1 + ); + } } } - - } }; diff --git a/Games/types/Mafia/Events/CaveIn.js b/Games/types/Mafia/Events/CaveIn.js index 64b957ae3..4780c2e21 100644 --- a/Games/types/Mafia/Events/CaveIn.js +++ b/Games/types/Mafia/Events/CaveIn.js @@ -26,8 +26,8 @@ module.exports = class CaveIn extends Event { labels: ["hidden", "absolute"], run: function () { for (const player of this.game.players) { - player.holdItem("CaveIn"); - } + player.holdItem("CaveIn"); + } }, }); this.game.queueAction(this.action); diff --git a/Games/types/Mafia/Events/NoEvent.js b/Games/types/Mafia/Events/NoEvent.js index 93e66c125..b86fa8d2f 100644 --- a/Games/types/Mafia/Events/NoEvent.js +++ b/Games/types/Mafia/Events/NoEvent.js @@ -9,7 +9,6 @@ const { module.exports = class MissingSupplies extends Event { constructor(modifiers, game) { super("No Event", modifiers, game); - } getNormalRequirements() { @@ -18,6 +17,5 @@ module.exports = class MissingSupplies extends Event { doEvent() { super.doEvent(); - } }; diff --git a/Games/types/Mafia/Events/TimeLoop.js b/Games/types/Mafia/Events/TimeLoop.js index fa668a796..22fe65e0a 100644 --- a/Games/types/Mafia/Events/TimeLoop.js +++ b/Games/types/Mafia/Events/TimeLoop.js @@ -17,7 +17,10 @@ module.exports = class TimeLoop extends Event { doEvent() { super.doEvent(); - this.game.PossibleEvents.splice(this.game.PossibleEvents.indexOf(this.fullName),1); + this.game.PossibleEvents.splice( + this.game.PossibleEvents.indexOf(this.fullName), + 1 + ); let victim = Random.randArrayVal(this.game.alivePlayers()); //this.game.; let L = function () { diff --git a/Games/types/Mafia/items/CaveIn.js b/Games/types/Mafia/items/CaveIn.js index cb57bb5c0..054a149b5 100644 --- a/Games/types/Mafia/items/CaveIn.js +++ b/Games/types/Mafia/items/CaveIn.js @@ -1,6 +1,8 @@ const Item = require("../Item"); -const { PRIORITY_KILL_DEFAULT,MEETING_PRIORITY_JAIL } = require("../const/Priority"); - +const { + PRIORITY_KILL_DEFAULT, + MEETING_PRIORITY_JAIL, +} = require("../const/Priority"); module.exports = class CaveIn extends Item { constructor() { @@ -20,49 +22,43 @@ module.exports = class CaveIn extends Item { speakDead: true, targets: { include: ["alive"], exclude: ["dead"] }, action: { - labels: ["kill", "hidden"], - priority: PRIORITY_KILL_DEFAULT, - power: 3, - item: this, - run: function () { - if (this.dominates()) { - if (!this.target.alive) { - this.game.exorcisePlayer(this.target); - } - this.target.kill("basic", this.actor); - for (let person of this.game.players) { - if (person.alive && person.role.name !== "Turkey") { - person.holdItem("Food", "Fresh Meat"); - } + labels: ["kill", "hidden"], + priority: PRIORITY_KILL_DEFAULT, + power: 3, + item: this, + run: function () { + if (this.dominates()) { + if (!this.target.alive) { + this.game.exorcisePlayer(this.target); + } + this.target.kill("basic", this.actor); + for (let person of this.game.players) { + if (person.alive && person.role.name !== "Turkey") { + person.holdItem("Food", "Fresh Meat"); } + } } - - - }, }, - + }, }, }; this.listeners = { - state: function () { - const state = this.game.getStateName(); - if (state == "Day" && this.hasBeenNight == true) { - this.drop(); - return; - } - if (state != "Night") { - return; - } - this.hasBeenNight = true; - this.holder.queueAlert( - `Event: Cave In, You all need something to eat!` - ); - - }, - }; - - + state: function () { + const state = this.game.getStateName(); + if (state == "Day" && this.hasBeenNight == true) { + this.drop(); + return; + } + if (state != "Night") { + return; + } + this.hasBeenNight = true; + this.holder.queueAlert( + `Event: Cave In, You all need something to eat!` + ); + }, + }; } shouldDisableMeeting(name) { @@ -78,6 +74,4 @@ module.exports = class CaveIn extends Item { return name !== "Caved In"; } - - }; diff --git a/Games/types/Mafia/items/EventManager.js b/Games/types/Mafia/items/EventManager.js index 542c12459..c6447b4eb 100644 --- a/Games/types/Mafia/items/EventManager.js +++ b/Games/types/Mafia/items/EventManager.js @@ -23,8 +23,9 @@ module.exports = class EventManager extends Item { let eventMods; let eventName; if (this.game.PossibleEvents.length > 0 && !this.game.selectedEvent) { - let Events = this.game.PossibleEvents.filter((e) => - this.game.checkEvent(e.split(":")[0],e.split(":")[1]) == true + let Events = this.game.PossibleEvents.filter( + (e) => + this.game.checkEvent(e.split(":")[0], e.split(":")[1]) == true ); if (Events.length <= 0) { //this.game.queueAlert("Failed Checks"); @@ -35,7 +36,7 @@ module.exports = class EventManager extends Item { eventMods = event.split(":")[1]; eventName = event.split(":")[0]; //this.game.queueAlert(`Manager ${eventMods}`); - event = this.game.createGameEvent(eventName,eventMods); + event = this.game.createGameEvent(eventName, eventMods); event.doEvent(); event = null; this.game.selectedEvent = true; diff --git a/Games/types/Mafia/roles/cards/CurseWithWordCult.js b/Games/types/Mafia/roles/cards/CurseWithWordCult.js index 979d565f5..6ddfcbd83 100644 --- a/Games/types/Mafia/roles/cards/CurseWithWordCult.js +++ b/Games/types/Mafia/roles/cards/CurseWithWordCult.js @@ -6,12 +6,12 @@ module.exports = class CurseWithWordCult extends Card { super(role); this.meetings = { - "Write with Sigils (5-15)": { + "Write with Sigils (4-15)": { states: ["Night"], flags: ["voting"], inputType: "text", textOptions: { - minLength: 5, + minLength: 4, maxLength: 15, alphaOnly: true, toLowerCase: true, diff --git a/data/contributors.js b/data/contributors.js index 6c6f549ed..144bc76f0 100644 --- a/data/contributors.js +++ b/data/contributors.js @@ -323,10 +323,10 @@ const artContributors = { Mafia: ["Samurai"], }, SawJester: { - Mafia: ["Tormentor", "Shoggoth","Bogeyman","Emperor"], + Mafia: ["Tormentor", "Shoggoth", "Bogeyman", "Emperor"], }, - drewsworth:{ - Mafia:["Puca"] + drewsworth: { + Mafia: ["Puca"], }, };