Skip to content

Commit

Permalink
Hexer Change (#1760)
Browse files Browse the repository at this point in the history
Hexer can now hex 4 letter words because people can't read.

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Nov 3, 2024
1 parent fee6e5d commit 42ae68b
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 86 deletions.
8 changes: 4 additions & 4 deletions Games/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
51 changes: 22 additions & 29 deletions Games/types/Mafia/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
}

}
};
4 changes: 2 additions & 2 deletions Games/types/Mafia/Events/CaveIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions Games/types/Mafia/Events/NoEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const {
module.exports = class MissingSupplies extends Event {
constructor(modifiers, game) {
super("No Event", modifiers, game);

}

getNormalRequirements() {
Expand All @@ -18,6 +17,5 @@ module.exports = class MissingSupplies extends Event {

doEvent() {
super.doEvent();

}
};
5 changes: 4 additions & 1 deletion Games/types/Mafia/Events/TimeLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
74 changes: 34 additions & 40 deletions Games/types/Mafia/items/CaveIn.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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) {
Expand All @@ -78,6 +74,4 @@ module.exports = class CaveIn extends Item {

return name !== "Caved In";
}


};
7 changes: 4 additions & 3 deletions Games/types/Mafia/items/EventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Games/types/Mafia/roles/cards/CurseWithWordCult.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions data/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
},
};

Expand Down

0 comments on commit 42ae68b

Please sign in to comment.