2024-04-29 00:04:14 -05:00

29 lines
846 B
JavaScript

import { PowerClasses } from './allPowers.js'
export async function powerEffectManagementHook(effect, data, userId) {
console.log('Power Effect Management')
console.log(effect)
console.log(data)
console.log(userId)
}
export async function powers (options = {}) {
const token = 'token' in options ? options.token : null
if (token === undefined || token === null) {
ui.notifications.error('Please select one token to be the caster')
return
}
const targets = 'targets' in options ? Array.from(options.targets) : []
const item = 'item' in options ? options.item : null
const swid = options?.name || item?.system.swid || null
if (swid in PowerClasses) {
const runner = new PowerClasses[swid](token, targets)
runner.powerEffect()
return
}
ui.notifications.error(`No power effect found for ${name}`)
}