-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added MiGo role. It chooses a player and a role. If the role's alignment matches the player's alignment and the role does not already exist. The player becomes that role. Golbolco wanted the role to be called "Mi-Go" but the "-" in the name broke the code. --------- Co-authored-by: SawJester <[email protected]>
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const Role = require("../../Role"); | ||
|
||
module.exports = class MiGo extends Role { | ||
constructor(player, data) { | ||
super("MiGo", player, data); | ||
|
||
this.alignment = "Cult"; | ||
this.cards = [ | ||
"VillageCore", | ||
"WinWithCult", | ||
"MeetingCult", | ||
"ConvertToChosenRole", | ||
]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
const Card = require("../../Card"); | ||
const { PRIORITY_CONVERT_DEFAULT } = require("../../const/Priority"); | ||
const { addArticle } = require("../../../../core/Utils"); | ||
module.exports = class ConvertToChosenRole extends Card { | ||
constructor(role) { | ||
super(role); | ||
//const targetOptions = this.game.PossibleRoles.filter((r) => r); | ||
this.meetings = { | ||
"Select Player": { | ||
states: ["Night"], | ||
flags: ["voting"], | ||
targets: { include: ["alive", "self"] }, | ||
action: { | ||
priority: PRIORITY_CONVERT_DEFAULT - 1, | ||
run: function () { | ||
this.actor.role.data.targetPlayer = this.target; | ||
}, | ||
}, | ||
}, | ||
"Convert To": { | ||
states: ["Night"], | ||
flags: ["voting"], | ||
inputType: "custom", | ||
//targets: { targetOptions }, | ||
action: { | ||
labels: ["convert", "role"], | ||
priority: PRIORITY_CONVERT_DEFAULT, | ||
run: function () { | ||
let targetPlayer = this.actor.role.data.targetPlayer; | ||
if (targetPlayer) { | ||
let players = this.game.players.filter((p) => p.role); | ||
let currentRoles = []; | ||
|
||
for (let x = 0; x < players.length; x++) { | ||
currentRoles.push(players [x].role); | ||
} | ||
for(let y = 0; y < currentRoles.length;y++){ | ||
if(this.target.split(":")[0] == currentRoles[y].name){ | ||
return; | ||
} | ||
} | ||
|
||
if (this.game.getRoleAlignment(this.target) == targetPlayer.role.alignment) { | ||
targetPlayer.setRole(`${this.target}`); | ||
} | ||
delete this.actor.role.data.targetPlayer; | ||
} | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
this.listeners = { | ||
roleAssigned: function (player) { | ||
if (player !== this.player) { | ||
return; | ||
} | ||
|
||
this.data.ConvertOptions = this.game.PossibleRoles.filter((r) => r); | ||
}, | ||
// refresh cooldown | ||
state: function (stateInfo) { | ||
if (!stateInfo.name.match(/Night/)) { | ||
return; | ||
} | ||
var ConvertOptions = this.data.ConvertOptions; | ||
|
||
this.meetings["Convert To"].targets = ConvertOptions; | ||
}, | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters