Boutons créatures/entités #69

Change-Id: I0aeded39e99551dbe09dc988e04c1de185c1dc70
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-27 22:21:08 +01:00
parent 97a6ef408d
commit 5d1cb2abec
5 changed files with 40 additions and 14 deletions

View File

@ -1,11 +1,9 @@
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
export class RdDActorEntiteSheet extends ActorSheet {
@ -55,7 +53,7 @@ export class RdDActorEntiteSheet extends ActorSheet {
/** @override */
activateListeners(html) {
super.activateListeners(html);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
// Everything below here is only needed if the sheet is editable
@ -119,7 +117,6 @@ export class RdDActorEntiteSheet extends ActorSheet {
this.actor.remiseANeuf();
}
});
}

View File

@ -1,12 +1,12 @@
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
*/
import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
/* -------------------------------------------- */
export class RdDActorHumanoideSheet extends ActorSheet {
/** @override */
@ -64,7 +64,9 @@ export class RdDActorHumanoideSheet extends ActorSheet {
/** @override */
activateListeners(html) {
super.activateListeners(html);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
@ -147,6 +149,16 @@ export class RdDActorHumanoideSheet extends ActorSheet {
this.actor.santeIncDec("endurance", -1);
this.render(true);
});
html.find('#encaisser-direct').click(ev => {
this.actor.encaisser()
});
html.find('#remise-a-neuf').click(ev => {
if (game.user.isGM) {
this.actor.remiseANeuf();
}
});
}

View File

@ -130,7 +130,7 @@ export class RdDActorSheet extends ActorSheet {
return data;
}
/* -------------------------------------------- */
async _onDrop(event) {
await RdDUtility.processItemDropEvent(this, event);

View File

@ -309,7 +309,11 @@ export class RdDActor extends Actor {
whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ),
content : "Remise à neuf de " + this.name
};
if (!this.isEntiteCauchemar()) {
if (this.isEntiteCauchemar()) {
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
}
else {
if (this.data.data.blessures){
const blessures = duplicate(this.data.data.blessures);
for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) {
@ -322,9 +326,7 @@ export class RdDActor extends Actor {
await this.update({ "data.compteurs.ethylisme.value": 0 });
await this.update({ "data.compteurs.ethylisme.nb_doses": 0 });
await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value);
}
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
if (!this.isEntiteCauchemar()) {
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
if (this.data.data.sante.fatigue){
let fatigue = duplicate(this.data.data.sante.fatigue)
fatigue.value = 0;
@ -1760,6 +1762,13 @@ export class RdDActor extends Actor {
new RdDEncaisser(html, this ).render(true);
}
/* -------------------------------------------- */
async encaisser( ) {
let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() };
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
new RdDEncaisser(html, this).render(true);
}
/* -------------------------------------------- */
async encaisserDommages( attackerRoll, attacker = undefined ) {
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {

View File

@ -4,7 +4,15 @@
<header class="sheet-header">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
<div class="flexrow">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
</div>
<div class="flexrow flex-group-center flex-actions-bar">
<div>
<span id="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span>
<span id="remise-a-neuf" class="gm-only"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
</div>
</div>
<div class="flexrow">
<div class="flexrow">
<span>{{data.blessures.resume}}</span>