Tirage des tarots

This commit is contained in:
2023-02-07 19:55:33 +01:00
parent 1923a63ebf
commit 04039513bc
35 changed files with 334 additions and 56 deletions

View File

@ -2,6 +2,7 @@
import { MaleficesUtility } from "./malefices-utility.js";
import { MaleficesRollDialog } from "./malefices-roll-dialog.js";
import { MaleficesTirageTarotDialog } from "./malefices-tirage-tarot-dialog.js"
/* -------------------------------------------- */
export class MaleficesCommands {
@ -9,7 +10,7 @@ export class MaleficesCommands {
static init() {
if (!game.system.malefices.commands) {
const commands = new MaleficesCommands();
//crucibleCommands.registerCommand({ path: ["/char"], func: (content, msg, params) => crucibleCommands.createChar(msg), descr: "Create a new character" });
commands.registerCommand({ path: ["/tirage"], func: (content, msg, params) => MaleficesCommands.createTirage(msg), descr: "Tirage des tarots" });
//crucibleCommands.registerCommand({ path: ["/pool"], func: (content, msg, params) => crucibleCommands.poolRoll(msg), descr: "Generic Roll Window" });
game.system.malefices.commands = commands;
}
@ -100,18 +101,30 @@ export class MaleficesCommands {
static _chatAnswer(msg, content) {
msg.whisper = [game.user.id];
msg.content = content;
ChatMessage.create(msg);
ChatMessage.create(msg);
}
/* -------------------------------------------- */
async poolRoll( msg) {
let rollData = MaleficesUtility.getBasicRollData()
rollData.alias = "Dice Pool Roll",
rollData.mode = "generic"
rollData.title = `Dice Pool Roll`;
let rollDialog = await MaleficesRollDialog.create( this, rollData);
rollDialog.render( true );
static async createTirage(msg) {
if (game.user.isGM) {
let tirageData = {
state: 'select-player',
nbCard: 0,
maxPlayerCard: 5,
maxSecretCard: 1,
cards: [],
players: duplicate(game.users),
secretCards: [],
deck: MaleficesUtility.getTarots()
}
for (let i = 0; i < 5; i++) {
tirageData.cards.push({ name: "???", img: "systems/fvtt-malefices/images/tarots/background.webp" })
}
tirageData.secretCards.push({ name: "???", img: "systems/fvtt-malefices/images/tarots/background.webp" })
let tirageDialog = await MaleficesTirageTarotDialog.create(this, tirageData)
tirageDialog.render(true)
}
}
}