working shape change (needs warpgate update)

This commit is contained in:
Mike Bloy 2023-09-24 22:14:35 -05:00 committed by Mike Bloy
parent 9e98425e63
commit f711e495a3

View File

@ -638,11 +638,18 @@ class ShapeChangeEffect extends TargetedPowerEffect {
this.increasedDuration = (!!this.inputs[this.inputIndex + 1])
this.actor = shim.actors.get(this.actorId)
this.icon = this.targets[0].document.texture.src
const targetActor = shim.actors.get(this.targets[0].actor.id)
const targetActor = this.targets[0].actor
this.protoDoc = await this.actor.getTokenDocument()
this.spawnOptions = {
controllingActor: this.targets[0].actor,
duplicates: 1,
updateOpts: {
embedded: {
Item: {
renderSheet: null
}
}
},
crosshairs: {
rememberControlled: true
}
@ -678,7 +685,9 @@ class ShapeChangeEffect extends TargetedPowerEffect {
},
token: {
actorLink: false,
name: `${this.targets[0].name} (${this.protoDoc.name} form) `
name: `${this.targets[0].name} (${this.protoDoc.name} form) `,
elevation: this.targets[0].document.elevation,
disposition: this.targets[0].document.disposition
},
embedded: { ActiveEffect: {}, Item: {} }
}
@ -704,13 +713,18 @@ class ShapeChangeEffect extends TargetedPowerEffect {
log('protoDoc', this.protoDoc)
log('spawnOptions', this.spawnOptions)
log('spawnMutation', this.spawnMutation)
await shim.warpgateSpawnAt(
const newTokenId = (await shim.warpgateSpawnAt(
this.targets[0].center,
this.protoDoc,
this.spawnMutation,
{},
this.spawnOptions
)
))[0]
if (!this.targets[0].document.hidden) {
await this.targets[0].toggleVisibility()
}
await this.targets[0].document.setFlag('swade-mb-helpers', 'shapeChange.to', newTokenId)
await this.targets[0].document.update({ x: 0, y: 0 })
}
}
@ -866,6 +880,13 @@ class SummonEffect extends PowerEffect {
this.spawnOptions = {
controllingActor: this.token.actor,
duplicates: this.number,
updateOpts: {
embedded: {
Item: {
renderSheet: null
}
}
},
crosshairs: {
icon: this.icon,
label: `Summon ${this.actor.name}`,