add confusion to supported powers
This commit is contained in:
parent
ec5e9f770b
commit
e4cf396b43
@ -174,6 +174,22 @@ const PowerMenus = {
|
||||
menuData.inputs.push({ type: 'checkbox', label: 'Greater', options: false })
|
||||
menuData.inputs.push({ type: 'checkbox', label: 'Strong (lower only)', options: false })
|
||||
return { menuOptions, menuData, extra: { traits } }
|
||||
},
|
||||
|
||||
confusion: function (token, targets) {
|
||||
if (targets.length < 1) {
|
||||
shim.notifications.error('No target selected for Confusion')
|
||||
return null
|
||||
}
|
||||
const { menuOptions, menuData } = baseMenu('Confusion', targets)
|
||||
menuData.inputs.push({ type: 'checkbox', label: 'Greater (adds Shaken)', options: false })
|
||||
menuData.buttons = [
|
||||
{ label: 'Distracted', value: 'distracted' },
|
||||
{ label: 'Vulnerable', value: 'vulnerable' },
|
||||
{ label: 'Raise (both)', value: 'raise' },
|
||||
{ label: 'Cancel', value: 'cancel' }
|
||||
]
|
||||
return { menuOptions, menuData, extra: {} }
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,6 +264,23 @@ const PowerHandlers = {
|
||||
for (const target of targets) {
|
||||
shim.applyActiveEffects(target, effectDocs)
|
||||
}
|
||||
},
|
||||
|
||||
confusion: async function (token, targets, buttons, inputs, extra) {
|
||||
const { effectDocs, inputIndex } = globalModifierEffects(inputs, 'Confusion', 1)
|
||||
const greater = !!inputs[inputIndex]
|
||||
if (buttons === 'distracted' || buttons === 'raise') {
|
||||
effectDocs.push(shim.getStatus('SWADE.Distr', 'Distracted'))
|
||||
}
|
||||
if (buttons === 'vulnerable' || buttons === 'raise') {
|
||||
effectDocs.push(shim.getStatus('SWADE.Vuln', 'Vulnerable'))
|
||||
}
|
||||
if (greater) {
|
||||
effectDocs.push(shim.getStatus('SWADE.Shaken', 'Shaken'))
|
||||
}
|
||||
for (const target of targets) {
|
||||
shim.applyActiveEffects(target, effectDocs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,15 @@ export class shim {
|
||||
return game.user
|
||||
}
|
||||
|
||||
static getStatus (label, name) {
|
||||
const effect = JSON.parse(JSON.stringify(
|
||||
CONFIG.statusEffects.find(se => se.label === label)))
|
||||
effect.name = ('name' in effect ? effect.name : effect.label)
|
||||
effect.flags.swade.favorite = true
|
||||
effect.flags.core = { statusId: effect.id }
|
||||
return effect
|
||||
}
|
||||
|
||||
static createEffectDocument (icon, name, durationRounds, changes = null) {
|
||||
if (changes === null) {
|
||||
changes = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user