Skip to content

Commit

Permalink
hotfix: diviner refactor (#1354)
Browse files Browse the repository at this point in the history
I cleaned up its description and did some refactoring.
  • Loading branch information
R9H9 authored Dec 20, 2023
1 parent 73de655 commit 190f484
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
50 changes: 36 additions & 14 deletions Games/types/Mafia/roles/cards/DivinerPrediction.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ module.exports = class DivinerPrediction extends Card {
if (!stateInfo.name.match(/Night/)) {
return;
}

if (!this.predictedCorrect) {
this.player.removeEffect("ExtraLife");
delete this.predictedVote;
} else if (this.predictedCorrect) {
this.player.giveEffect("ExtraLife");
}
},
death: function (player, killer, deathType) {
Expand All @@ -51,20 +55,38 @@ module.exports = class DivinerPrediction extends Card {
`The Village has condemned ${this.predictedVote.name} to death, allowing you to use your Divining Rod to find the orichalcum to empower your runestone.`
);
}
if (
player === this.player &&
deathType === "condemn" &&
this.predictedCorrect
) {
const playerRoleName = this.player.getRoleAppearance("condemn");
const playerLastWill = this.player.lastWill;
this.player.role.appearance.condemn = null;
this.player.lastWill = null;
this.player.revive("basic", this.player);
if (this.dominates()) this.predictedVote.kill("condemn", this.actor);
this.player.role.appearance.condemn = playerRoleName;
this.player.lastWill = playerLastWill;
this.predictedCorrect = false;
},
immune: function (action) {
if (action.target !== this.player) {
return;
}

if (action.hasLabel("condemn")) {
let action = new Action({
actor: this.player,
target: this.predictedVote,
game: this.player.game,
power: 5,
labels: ["kill", "condemn", "overthrow", "diviner"],
run: function () {
if (this.dominates()) this.target.kill("condemn", this.actor);
this.predictedCorrect = false;
},
});
action.do();
} else if (action.hasLabel("kill")) {
let action = new Action({
actor: this.player,
target: this.predictedVote,
game: this.player.game,
power: 5,
labels: ["kill", "diviner"],
run: function () {
if (this.dominates()) this.target.kill("basic", this.actor);
this.predictedCorrect = false;
},
});
action.do();
}
},
};
Expand Down
3 changes: 2 additions & 1 deletion data/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,8 @@ const roleData = {
newlyAdded: true,
description: [
"Each night, predicts the village vote.",
"If the guess is correct and they are condemned the following day, they will be revived with their role will be hidden from the town, with their previous night's target condemned in their place.",
"If guessed correct, they will become immortal for the following day.",
"While immortal, their previous night's target will be killed/condemned in their place."
"Wins if the last one standing.",
],
},
Expand Down

0 comments on commit 190f484

Please sign in to comment.