ChatMessage.create est async, il faut donc de préférence l'appeler avec un await. Des effets secondaires avaient lieu (ordre de messages, updates ultérieurs parfois pas pris en compte)
47 lines
2.3 KiB
JavaScript
47 lines
2.3 KiB
JavaScript
import { ChatUtility } from "../chat-utility.js";
|
|
import { RdDItemBlessure } from "../item/blessure.js";
|
|
import { RdDBaseActorReveSheet } from "./base-actor-reve-sheet.js";
|
|
|
|
/* -------------------------------------------- */
|
|
/**
|
|
* Extend the basic ActorSheet with some very simple modifications
|
|
* @extends {ActorSheet}
|
|
*/
|
|
export class RdDBaseActorSangSheet extends RdDBaseActorReveSheet {
|
|
|
|
/* -------------------------------------------- */
|
|
/** @override */
|
|
activateListeners(html) {
|
|
super.activateListeners(html);
|
|
|
|
// Everything below here is only needed if the sheet is editable
|
|
if (!this.options.editable) return;
|
|
|
|
this.html.find('.creer-blessure-legere').click(async event => await RdDItemBlessure.createBlessure(this.actor, 2));
|
|
this.html.find('.creer-blessure-grave').click(async event => await RdDItemBlessure.createBlessure(this.actor, 4));
|
|
this.html.find('.creer-blessure-critique').click(async event => await RdDItemBlessure.createBlessure(this.actor, 6));
|
|
|
|
this.html.find('.subir-blessure-contusion').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 0));
|
|
this.html.find('.subir-blessure-legere').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 2));
|
|
this.html.find('.subir-blessure-grave').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 4));
|
|
this.html.find('.subir-blessure-critique').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 6));
|
|
|
|
this.html.find('.jet-vie').click(async event => await this.actor.jetDeVie())
|
|
this.html.find('.jet-endurance').click(async event => await this.jetEndurance())
|
|
|
|
this.html.find('.vie-plus').click(async event => await this.actor.santeIncDec("vie", 1))
|
|
this.html.find('.vie-moins').click(async event => await this.actor.santeIncDec("vie", -1))
|
|
}
|
|
|
|
async jetEndurance() {
|
|
const endurance = this.actor.getEnduranceActuelle()
|
|
const result = await this.actor.jetEndurance(endurance);
|
|
await ChatMessage.create({
|
|
content: `Jet d'Endurance : ${result.jetEndurance} / ${endurance}
|
|
<br>${this.actor.name} a ${result.sonne ? 'échoué' : 'réussi'} son Jet d'Endurance ${result.sonne ? 'et devient Sonné' : ''}`,
|
|
whisper: ChatUtility.getOwners(this.actor)
|
|
})
|
|
}
|
|
|
|
}
|