shape-change #33
@ -472,6 +472,87 @@ class ProtectionEffect extends TargetedPowerEffect {
|
||||
}
|
||||
}
|
||||
|
||||
class ShapeChangeEffect extends TargetedPowerEffect {
|
||||
get name () {
|
||||
return 'Shape Change'
|
||||
}
|
||||
|
||||
get baseDurationRounds () {
|
||||
return 5
|
||||
}
|
||||
|
||||
get actorFolder () {
|
||||
return 'Shape Change'
|
||||
}
|
||||
|
||||
async prepFolders () {
|
||||
const folders = []
|
||||
const folderNames = [
|
||||
this.actorFolder,
|
||||
`${this.actorFolder} - Default`,
|
||||
`${this.actorFolder}/Default`,
|
||||
`${this.actorFolder} - ${this.token.name}`,
|
||||
`${this.actorFolder} - ${this.token.actor.name}`,
|
||||
`${this.actorFolder}/${this.token.name}`,
|
||||
`${this.actorFolder}/${this.token.actor.name}`
|
||||
]
|
||||
for (const folderName of folderNames) {
|
||||
const folder = shim.getActorFolderByPath(folderName)
|
||||
if (folder) {
|
||||
log(`Found actor folder ${folderName}`)
|
||||
folders.push(folder)
|
||||
}
|
||||
}
|
||||
if (folders.length > 1) {
|
||||
folders.shift()
|
||||
}
|
||||
return folders
|
||||
}
|
||||
|
||||
async prepActors () {
|
||||
const folders = await this.prepFolders()
|
||||
const actors = {}
|
||||
for (const folder of folders) {
|
||||
const folderActors = shim.getActorsInFolder(folder)
|
||||
for (const key in folderActors) {
|
||||
actors[key] = folderActors[key]
|
||||
}
|
||||
}
|
||||
return actors
|
||||
}
|
||||
|
||||
async prepMenu () {
|
||||
const actors = await this.prepActors()
|
||||
this.cancel = false
|
||||
if (Object.keys(actors).length < 1) {
|
||||
shim.notifications.error('No summonables found')
|
||||
this.cancel = true
|
||||
}
|
||||
|
||||
function actorData (key) {
|
||||
return {
|
||||
value: actors[key].id,
|
||||
html: key
|
||||
}
|
||||
}
|
||||
|
||||
this.summonableActors = actors
|
||||
|
||||
this.menuData.inputs = this.menuData.inputs.concat([
|
||||
{
|
||||
type: 'select',
|
||||
label: 'Turn into creature',
|
||||
options: Object.keys(actors).filter(
|
||||
k => !k.includes('_template')).sort().map(actorData)
|
||||
}, {
|
||||
type: 'checkbox',
|
||||
label: 'Duration (+1, rounds to minutes)',
|
||||
options: false
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
class SmiteEffect extends TargetedPowerEffect {
|
||||
get name () {
|
||||
return 'Smite'
|
||||
@ -926,6 +1007,7 @@ const PowerClasses = {
|
||||
invisibility: InvisibilityEffect,
|
||||
'lower trait': BoostLowerTraitEffect,
|
||||
protection: ProtectionEffect,
|
||||
'shape change': ShapeChangeEffect,
|
||||
smite: SmiteEffect,
|
||||
'summon ally': SummonAllyEffect,
|
||||
'summon animal': SummonAnimalEffect,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user