Skip to content

Commit

Permalink
hotfix: vice president & versatile (#1331)
Browse files Browse the repository at this point in the history
Co-authored-by: DrSharky <[email protected]>
  • Loading branch information
R9H9 and DrSharky authored Dec 17, 2023
1 parent 3d35ece commit 611e33e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
8 changes: 6 additions & 2 deletions Games/types/Mafia/roles/cards/ElectOnPresidentDeath.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ module.exports = class ElectOnPresidentDeath extends Card {

this.listeners = {
death: function (player) {
if (this.player.alive && player.role.name === "President") {
this.player.setRole("President");
if (
player !== this.player &&
player.role.name === "President" &&
this.player.alive
) {
this.player.setRole(`${player.role.name}:${player.role.modifier}`, player.role.data);
}
},
};
Expand Down
9 changes: 1 addition & 8 deletions Games/types/Mafia/roles/cards/InheritFirstDeadAligned.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@ module.exports = class InheritFirstDeadAligned extends Card {
!isVanillaRole(player) &&
this.player.alive
) {
this.actor.setRole(
`${this.target.role.name}:${this.target.role.modifier}`,
this.target.role.data,
false,
false,
true
);
this.game.events.emit("roleAssigned", this.actor);
this.player.setRole(`${player.role.name}:${player.role.modifier}`, player.role.data);
}
},
};
Expand Down
16 changes: 1 addition & 15 deletions Games/types/Mafia/roles/cards/KillAlignedOnDeath.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ module.exports = class KillAlignedOnDeath extends Card {
return;
}

this.player.role.data.position = this.player.role.modifier;
if (this.player.role.name === "President") {
this.player.role.data.position = this.player.role.name;
}

this.game.queueAlert(
`${this.player.name} has been elected as the ${this.player.role.data.position}! Protect them at all costs!`,
`${this.player.name} is the ${this.player.role.modifier}! Protect them at all costs!`,
0,
this.game.players.filter(
(p) => p.role.alignment === this.player.role.alignment
Expand All @@ -32,15 +27,6 @@ module.exports = class KillAlignedOnDeath extends Card {
return;
}

if (this.name == "President") {
const vicePresidents = this.game.players.filter(
(p) => p.role.name == "Vice President"
);
if (vicePresidents.length > 0) {
return;
}
}

for (let p of this.game.alivePlayers()) {
if (p.role.alignment === this.player.role.alignment) {
p.kill("basic", this.player, instant);
Expand Down
4 changes: 4 additions & 0 deletions Games/types/Mafia/roles/cards/WinWithMafia.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ module.exports = class WinWithMafia extends Card {
},
death: function (player) {
if (player.role.name == "President") {
const vicePresidents = this.game.players.filter((p) => p.role.name == "Vice President");
if (vicePresidents.length > 0) {
return;
}
this.killedPresident = true;
}
},
Expand Down

0 comments on commit 611e33e

Please sign in to comment.