This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user