diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 6ec548c6..221b4ae7 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -151,6 +151,15 @@ export class RdDActorSheet extends RdDBaseActorSheet { this.html.find('.creer-tache').click(async event => { this.createEmptyTache(); }); + this.html.find('.creer-tache-blessure-legere').click(async event => { + this.actor.createTacheBlessure('legere'); + }); + this.html.find('.creer-tache-blessure-grave').click(async event => { + this.actor.createTacheBlessure('grave'); + }); + this.html.find('.creer-tache-blessure-critique').click(async event => { + this.actor.createTacheBlessure('critique'); + }); this.html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvreToCreate(); }); @@ -477,7 +486,6 @@ export class RdDActorSheet extends RdDBaseActorSheet { async createEmptyTache() { await this.actor.createItem('tache', 'Nouvelle tache'); } - _optionRecherche(target) { if (!target.value?.length) { return undefined; diff --git a/module/actor.js b/module/actor.js index 450f9591..22467755 100644 --- a/module/actor.js +++ b/module/actor.js @@ -35,6 +35,7 @@ import { Targets } from "./targets.js"; import { DialogRepos } from "./dialog-repos.js"; import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDTimestamp } from "./rdd-timestamp.js"; +import { RdDItemTache } from "./item-tache.js"; const POSSESSION_SANS_DRACONIC = { img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', @@ -46,7 +47,6 @@ const POSSESSION_SANS_DRACONIC = { }; const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" }; - export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre'] /* -------------------------------------------- */ @@ -2325,6 +2325,13 @@ export class RdDActor extends RdDBaseActor { return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; } + async createTacheBlessure(gravite) { + const tache = RdDItemTache.prepareTacheSoin(gravite) + if (tache) { + await this.createEmbeddedDocuments('Item', [tache], { renderSheet: false }); + } + } + /* -------------------------------------------- */ async rollTache(id) { const tacheData = this.getTache(id) diff --git a/module/item-tache.js b/module/item-tache.js index 43b441d5..f17bb9af 100644 --- a/module/item-tache.js +++ b/module/item-tache.js @@ -1,4 +1,18 @@ -export class RdDItemTache extends Item { - +const BASE_TACHE_SOIN_BLESSURE = { type: "tache", img: 'systems/foundryvtt-reve-de-dragon/icons/competence_chirurgie.webp', system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, } } +const TACHES_SOIN_BLESSURE = { + 'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, + 'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, + 'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, +} +export class RdDItemTache extends Item { + + static prepareTacheSoin(gravite) { + const blessure = TACHES_SOIN_BLESSURE[gravite] + if (blessure) { + return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), blessure) + } + ui.notifications.warn(`Pas de tâche de soins pour une blessure ${gravite}`) + return undefined; + } } \ No newline at end of file diff --git a/module/rdd-utility.js b/module/rdd-utility.js index b62961df..ef8a1000 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -149,6 +149,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html', diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 772f0e72..d27e5384 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -89,6 +89,7 @@ {{#if options.isObserver}}{{!-- Combat Tab --}}