forked from public/foundryvtt-reve-de-dragon
Affichage du jet de refoulement
This commit is contained in:
@ -1426,34 +1426,32 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async actionRefoulement(item) {
|
||||
const refoulement = item?.system.refoulement ?? 0;
|
||||
if (refoulement>0) {
|
||||
if (refoulement > 0) {
|
||||
RdDConfirm.confirmer({
|
||||
settingConfirmer: "confirmation-refouler",
|
||||
content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`,
|
||||
title: 'Confirmer la refoulement',
|
||||
buttonLabel: 'Refouler',
|
||||
onAction: async () => {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement`
|
||||
});
|
||||
await this.ajouterRefoulement(refoulement);
|
||||
await this.ajouterRefoulement(refoulement, `une queue ${item.name}`);
|
||||
await item.delete();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouterRefoulement(value = 1) {
|
||||
let refoulement = this.system.reve.refoulement.value + value;
|
||||
let total = await RdDDice.rollTotal("1d20");
|
||||
if (total <= refoulement) {
|
||||
async ajouterRefoulement(value = 1, refouler) {
|
||||
const refoulement = this.system.reve.refoulement.value + value;
|
||||
const roll = new Roll("1d20");
|
||||
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;
|
||||
await this.ajouterSouffle({ chat: true });
|
||||
}
|
||||
await this.update({ "system.reve.refoulement.value": refoulement });
|
||||
return refoulement == 0 ? "souffle" : "none";
|
||||
return roll;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user