Skip to content

Commit

Permalink
Add alternate Inspiration message
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkinabout committed Apr 15, 2024
1 parent f919962 commit 2e4b7c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
"CUSTOM_DND5E.menu.spellSchools.name": "Configure Spell Schools",

"CUSTOM_DND5E.message.awardInspiration": "<p>{name} was awarded Inspiration for rolling a {value}.</p>",
"CUSTOM_DND5E.message.awardInspirationAlready": "<p>{name} rolled a {value}, but already has Inspiration.</p>",
"CUSTOM_DND5E.message.instantDeath": "<p>{name} suffered Instant Death.</p>",
"CUSTOM_DND5E.message.massiveDamage": "{name} suffered Massive Damage.",

Expand Down
11 changes: 9 additions & 2 deletions scripts/house-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,16 @@ export function awardInspiration (rollType, entity, roll) {
const d20Value = roll.terms.find(term => term.faces === 20).total

if (awardInspirationD20Value === d20Value) {
actor.update({ 'system.attributes.inspiration': true })
let message = 'CUSTOM_DND5E.message.awardInspiration'

if (actor.system.attributes.inspiration) {
message = 'CUSTOM_DND5E.message.awardInspirationAlready'
} else {
actor.update({ 'system.attributes.inspiration': true })
}

ChatMessage.create({
content: game.i18n.format('CUSTOM_DND5E.message.awardInspiration', { name: actor.name, value: awardInspirationD20Value })
content: game.i18n.format(message, { name: actor.name, value: awardInspirationD20Value })
})
}
}
Expand Down

0 comments on commit 2e4b7c4

Please sign in to comment.