Ajout entrainements
Some checks failed
Release Creation / build (release) Failing after 51s

This commit is contained in:
2026-04-19 19:06:47 +02:00
parent 1d6e6dd44e
commit 6883cc1020
37 changed files with 335 additions and 227 deletions

View File

@@ -27,10 +27,18 @@ export class DonjonEtCieItem extends Item {
return Number(this.system.delta ?? 0);
}
get usageDieMax() {
return Number(this.system.deltaMax ?? this.system.delta ?? 0);
}
async roll() {
if (this.type === "arme") return DonjonEtCieRollDialog.createWeapon(this.actor, this);
if (this.type === "sortilege") return DonjonEtCieRollDialog.createSpell(this.actor, this);
if (this.usageDie) return DonjonEtCieRollDialog.createUsage(this);
if (this.type === "entrainement" && this.usageDieMax > 0) {
ui.notifications.warn(game.i18n.localize("DNC.Warn.TrainingExhausted"));
return null;
}
return this.postToChat();
}
@@ -54,4 +62,11 @@ export class DonjonEtCieItem extends Item {
content
});
}
async resetUsageDie() {
if (this.type !== "entrainement") return this;
const deltaMax = this.usageDieMax;
if (!deltaMax) return this;
return this.update({ "system.delta": deltaMax });
}
}