Affichage du jet de refoulement

This commit is contained in:
Vincent Vandemeulebrouck 2022-10-31 15:20:33 +01:00
parent cf4be389b4
commit 086ad4f23a
3 changed files with 14 additions and 17 deletions

View File

@ -1426,34 +1426,32 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async actionRefoulement(item) { async actionRefoulement(item) {
const refoulement = item?.system.refoulement ?? 0; const refoulement = item?.system.refoulement ?? 0;
if (refoulement>0) { if (refoulement > 0) {
RdDConfirm.confirmer({ RdDConfirm.confirmer({
settingConfirmer: "confirmation-refouler", settingConfirmer: "confirmation-refouler",
content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`, content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`,
title: 'Confirmer la refoulement', title: 'Confirmer la refoulement',
buttonLabel: 'Refouler', buttonLabel: 'Refouler',
onAction: async () => { onAction: async () => {
ChatMessage.create({ await this.ajouterRefoulement(refoulement, `une queue ${item.name}`);
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement`
});
await this.ajouterRefoulement(refoulement);
await item.delete(); await item.delete();
} }
}) });
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async ajouterRefoulement(value = 1) { async ajouterRefoulement(value = 1, refouler) {
let refoulement = this.system.reve.refoulement.value + value; const refoulement = this.system.reve.refoulement.value + value;
let total = await RdDDice.rollTotal("1d20"); const roll = new Roll("1d20");
if (total <= refoulement) { await roll.evaluate({ async: true });
await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` });
if (roll.total <= refoulement) {
refoulement = 0; refoulement = 0;
await this.ajouterSouffle({ chat: true }); await this.ajouterSouffle({ chat: true });
} }
await this.update({ "system.reve.refoulement.value": refoulement }); await this.update({ "system.reve.refoulement.value": refoulement });
return refoulement == 0 ? "souffle" : "none"; return roll;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -289,9 +289,8 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async refouler() { async refouler() {
this._tellToGM(this.actor.name + " a refoulé : " + this.currentRencontre.name); await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1, `une rencontre ${this.currentRencontre.name}`);
await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1);
this.updateTokens(); this.updateTokens();
console.log("-> refouler", this.currentRencontre) console.log("-> refouler", this.currentRencontre)
this.updateValuesDisplay(); this.updateValuesDisplay();
@ -300,7 +299,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async ignorerRencontre() { async ignorerRencontre() {
this._tellToGM(this.actor.name + " a ignoré : " + this.currentRencontre.name); this._tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
this.updateTokens(); this.updateTokens();
this.updateValuesDisplay(); this.updateValuesDisplay();

View File

@ -11,7 +11,7 @@
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}
{{#if carac.derivee}} {{#if carac.derivee}}
<span class="carac-label" name="system.carac.{{key}}.label"> <a name={{key}}>{{carac.label}}</a></span> <span class="carac-label" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
<label class="competence-value">{{carac.value}}</label> <label class="competence-value">{{carac.value}}</label>
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}