Skip to content

Commit

Permalink
Only roll ancestry formula message when ancestry is dropped on an actor
Browse files Browse the repository at this point in the history
  • Loading branch information
juanferrer committed Nov 26, 2024
1 parent 8639a1c commit bb02aa1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/module/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,27 @@ export class DemonlordItem extends Item {
rolls.push({property: 'corruption', roll: roll })
}

// Send a message to chat with all the rolls
const actor = game.user.character ?? canvas.tokens.controlled[0]?.actor

// If we dropped it into an actor, print the roll data
if (rolls.length > 0) {
const templateData = {
item: ancestry,
rolls,
}

const actor = game.user.character ?? canvas.tokens.controlled[0].actor
const rollMode = game.settings.get('core', 'rollMode')
if (actor) {
const rollMode = game.settings.get('core', 'rollMode')

const chatData = getChatBaseData(actor, rollMode)
const chatData = getChatBaseData(actor, rollMode)

const template = 'systems/demonlord/templates/chat/formulaeroll.hbs'
renderTemplate(template, templateData).then(async content => {
chatData.content = content
chatData.sound = CONFIG.sounds.dice
await ChatMessage.create(chatData)
})
const template = 'systems/demonlord/templates/chat/formulaeroll.hbs'
renderTemplate(template, templateData).then(async content => {
chatData.content = content
chatData.sound = CONFIG.sounds.dice
await ChatMessage.create(chatData)
})
}
}

const l0 = this.system.levels.find(l => l.level === '0')
Expand Down

0 comments on commit bb02aa1

Please sign in to comment.