Skip to content

Commit

Permalink
Show an error when an umemorized spell is cast
Browse files Browse the repository at this point in the history
  • Loading branch information
apewall committed Mar 26, 2024
1 parent 4e2f094 commit b756e01
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
18 changes: 13 additions & 5 deletions src/module/item/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b756e01

Please sign in to comment.