Soins des blessures

Maintenant, les tâches peuvent être créées directement
dans l'onglet combat, à côté des blessures.

Les tâches des oins sont dans cet onglet
This commit is contained in:
Vincent Vandemeulebrouck 2023-01-19 02:42:25 +01:00
parent f221bb31eb
commit a790c36618
7 changed files with 69 additions and 15 deletions

View File

@ -151,6 +151,15 @@ export class RdDActorSheet extends RdDBaseActorSheet {
this.html.find('.creer-tache').click(async event => { this.html.find('.creer-tache').click(async event => {
this.createEmptyTache(); 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.html.find('.creer-une-oeuvre').click(async event => {
this.selectTypeOeuvreToCreate(); this.selectTypeOeuvreToCreate();
}); });
@ -477,7 +486,6 @@ export class RdDActorSheet extends RdDBaseActorSheet {
async createEmptyTache() { async createEmptyTache() {
await this.actor.createItem('tache', 'Nouvelle tache'); await this.actor.createItem('tache', 'Nouvelle tache');
} }
_optionRecherche(target) { _optionRecherche(target) {
if (!target.value?.length) { if (!target.value?.length) {
return undefined; return undefined;

View File

@ -35,6 +35,7 @@ import { Targets } from "./targets.js";
import { DialogRepos } from "./dialog-repos.js"; import { DialogRepos } from "./dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDBaseActor } from "./actor/base-actor.js";
import { RdDTimestamp } from "./rdd-timestamp.js"; import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDItemTache } from "./item-tache.js";
const POSSESSION_SANS_DRACONIC = { const POSSESSION_SANS_DRACONIC = {
img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', 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": "" }; 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'] export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -2325,6 +2325,13 @@ export class RdDActor extends RdDBaseActor {
return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; 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) { async rollTache(id) {
const tacheData = this.getTache(id) const tacheData = this.getTache(id)

View File

@ -1,4 +1,18 @@
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 { 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;
}
} }

View File

@ -149,6 +149,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', '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/alchimie.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.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/non-haut-revant.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',

View File

@ -89,6 +89,7 @@
{{#if options.isObserver}}{{!-- Combat Tab --}} {{#if options.isObserver}}{{!-- Combat Tab --}}
<div class="tab combat" data-group="primary" data-tab="combat"> <div class="tab combat" data-group="primary" data-tab="combat">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}<hr> {{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}<hr>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}}

View File

@ -0,0 +1,21 @@
<h3>Soins</h3>
<a class="chat-card-button creer-tache-blessure-legere">Blessure légère</a>
<a class="chat-card-button creer-tache-blessure-grave">Blessure grave</a>
<a class="chat-card-button creer-tache-blessure-critique">Blessure critique</a>
<ul class="item-list alterne-list">
{{#each taches as |tache id|}}
{{#if (eq tache.system.competence 'Chirurgie')}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}">
<img class="sheet-competence-img" src="{{tache.img}}" />
<span class="competence-title tache-label"><a>{{tache.name}}
({{tache.system.points_de_tache_courant}}{{#if
(or @root.options.isGM (not tache.system.cacher_points_de_tache))
}}/{{tache.system.points_de_tache}}{{/if}})</a></span>
<div class="item-controls flex-shrink">
<a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/if}}
{{/each}}
</ul>

View File

@ -1,6 +1,7 @@
<h3>Tâches</h3><a class="chat-card-button creer-tache">Nouvelle Tâche</a> <h3>Tâches</h3><a class="chat-card-button creer-tache">Nouvelle Tâche</a>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each taches as |tache id|}} {{#each taches as |tache id|}}
{{#unless (eq tache.system.competence 'Chirurgie')}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}"> <li class="item flexrow list-item" data-item-id="{{tache._id}}">
<img class="sheet-competence-img" src="{{tache.img}}" /> <img class="sheet-competence-img" src="{{tache.img}}" />
<span class="competence-title tache-label"><a>{{tache.name}} <span class="competence-title tache-label"><a>{{tache.name}}
@ -12,5 +13,6 @@
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/unless}}
{{/each}} {{/each}}
</ul> </ul>