Gestion des soins avancés

- raccourci soins HUD
- edition rapide des Item blessure
- gestion des taches de soins liées aux blessures
This commit is contained in:
2023-03-10 22:41:11 +01:00
parent acc880b53f
commit 9e6d5856b1
14 changed files with 311 additions and 58 deletions

View File

@ -13,6 +13,7 @@ import { STATUSES } from "./settings/status-effects.js";
import { MAINS_DIRECTRICES } from "./actor.js";
import { RdDBaseActorSheet } from "./actor/base-actor-sheet.js";
import { RdDItem } from "./item.js";
import { RdDItemBlessure } from "./item/blessure.js";
/* -------------------------------------------- */
/**
@ -152,13 +153,13 @@ export class RdDActorSheet extends RdDBaseActorSheet {
this.createEmptyTache();
});
this.html.find('.creer-tache-blessure-legere').click(async event => {
this.actor.createTacheBlessure('legere');
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'legere');
});
this.html.find('.creer-tache-blessure-grave').click(async event => {
this.actor.createTacheBlessure('grave');
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'grave');
});
this.html.find('.creer-tache-blessure-critique').click(async event => {
this.actor.createTacheBlessure('critique');
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'critique');
});
this.html.find('.creer-une-oeuvre').click(async event => {
this.selectTypeOeuvreToCreate();
@ -189,6 +190,23 @@ export class RdDActorSheet extends RdDBaseActorSheet {
await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc, psdone, scdone);
});
this.html.find('.blessure-premierssoins-done').change(async event => {
const blessure = this.getBlessure(event);
await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
});
this.html.find('.blessure-soinscomplets-done').change(async event => {
const blessure = this.getBlessure(event);
await blessure?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
});
this.html.find('.blessure-premierssoins-bonus').change(async event => {
const blessure = this.getBlessure(event);
await blessure?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
});
this.html.find('.blessure-soinscomplets-bonus').change(async event => {
const blessure = this.getBlessure(event);
await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
});
// Equip Inventory Item
this.html.find('.item-equip').click(async event => {
this.actor.equiperObjet(RdDSheetUtility.getItemId(event));
@ -426,6 +444,12 @@ export class RdDActorSheet extends RdDBaseActorSheet {
});
}
getBlessure(event) {
const itemId = this.html.find(event.currentTarget).parents(".item-blessure").data('item-id');
const blessure = this.actor.getItem(itemId, 'blessure');
return blessure;
}
isCompetenceAffichable(competence) {
return !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(competence);
}