diff --git a/src/lang/en.json b/src/lang/en.json index 4a1ed8da..90e15bdc 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -329,5 +329,6 @@ "OSE.error.noTokenControlled": "You must have one or more controlled Tokens in order to use this option.", "OSE.error.noGP": "You need a GP item to use this feature.", "OSE.error.unexpectedSettings": "unexpected OSE setting {configName}: {configValue}", - "OSE.error.cantDealDamageTo": "Can't deal damage to {nameOrId}" + "OSE.error.cantDealDamageTo": "Can't deal damage to {nameOrId}", + "OSE.error.notMemorized": "The spell {name} is not memorized." } diff --git a/src/module/item/entity.js b/src/module/item/entity.js index 087d3566..12c81c4a 100644 --- a/src/module/item/entity.js +++ b/src/module/item/entity.js @@ -185,11 +185,19 @@ export default class OseItem extends Item { ); const itemData = this.system; - await this.update({ - system: { - cast: itemData.cast - 1, - }, - }); + + if (itemData.cast > 0) { + await this.update({ + system: { + cast: itemData.cast - 1, + }, + }); + } else { + return ui.notifications.error( + game.i18n.format("OSE.error.notMemorized", { + name: this.name, + })); + }; if (itemData.roll) { await this.rollFormula()