working but imperfect mirror self
This commit is contained in:
parent
66ea4c4388
commit
7dce7780b9
@ -752,6 +752,7 @@ class SummonAllyEffect extends SummonEffect {
|
|||||||
this.biteClaw = !!(this.inputs[this.inputIndex])
|
this.biteClaw = !!(this.inputs[this.inputIndex])
|
||||||
this.combatEdge = !!(this.inputs[this.inputIndex + 1])
|
this.combatEdge = !!(this.inputs[this.inputIndex + 1])
|
||||||
this.flight = !!(this.inputs[this.inputIndex + 2])
|
this.flight = !!(this.inputs[this.inputIndex + 2])
|
||||||
|
await this.prepMirrorSelf()
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepAdditional () {
|
async prepAdditional () {
|
||||||
@ -830,6 +831,53 @@ class SummonAllyEffect extends SummonEffect {
|
|||||||
log(`Added ${effect.name} to spawn mutation`)
|
log(`Added ${effect.name} to spawn mutation`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async prepMirrorSelf () {
|
||||||
|
if (this.actor.name !== 'Mirror Self') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const actorDoc = this.token.actor.clone({
|
||||||
|
'system.wildcard': false,
|
||||||
|
'system.fatigue.value': 0,
|
||||||
|
'system.wounds.value': 0,
|
||||||
|
'system.wounds.max': 0,
|
||||||
|
'system.bennies.max': 0,
|
||||||
|
'system.bennies.value': 0
|
||||||
|
})
|
||||||
|
await shim.mergeObject(
|
||||||
|
this.spawnMutation.actor, {
|
||||||
|
name: `Mirrored ${this.token.actor.name}`,
|
||||||
|
img: this.token.actor.img,
|
||||||
|
system: actorDoc.system
|
||||||
|
}, { inplace: true, recursive: true }
|
||||||
|
)
|
||||||
|
await shim.mergeObject(
|
||||||
|
this.spawnMutation.token, {
|
||||||
|
actorLink: false,
|
||||||
|
disposition: this.token.document.disposition,
|
||||||
|
light: this.token.document.light,
|
||||||
|
sight: this.token.document.sight,
|
||||||
|
name: `Mirrored ${this.token.name}`,
|
||||||
|
texture: this.token.document.texture
|
||||||
|
}, { inplace: true, recursive: true })
|
||||||
|
this.spawnMutation.token.texture.scaleX = -1 * this.token.document.texture.scaleX
|
||||||
|
const effectChanges = []
|
||||||
|
for (const item of this.token.actor.items) {
|
||||||
|
this.spawnMutation.embedded.Item[item.name] =
|
||||||
|
this.token.actor.getEmbeddedDocument('Item', item.id)
|
||||||
|
if (item.type === 'skill') {
|
||||||
|
effectChanges.push({
|
||||||
|
key: `@Skill{${item.name}}[system.die.sides]`,
|
||||||
|
mode: CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD,
|
||||||
|
value: '-2',
|
||||||
|
priority: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.spawnMutation.embedded.ActiveEffect['Mirror Self'] =
|
||||||
|
shim.createEffectDocument(this.ICON, 'Mirror Self',
|
||||||
|
this.durationRounds, effectChanges)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PowerClasses = {
|
const PowerClasses = {
|
||||||
|
|||||||
@ -41,6 +41,10 @@ export class shim {
|
|||||||
return game.actors
|
return game.actors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static mergeObject (...args) {
|
||||||
|
return mergeObject(...args)
|
||||||
|
}
|
||||||
|
|
||||||
static getStatus (label, name, favorite = true) {
|
static getStatus (label, name, favorite = true) {
|
||||||
const effect = JSON.parse(JSON.stringify(
|
const effect = JSON.parse(JSON.stringify(
|
||||||
CONFIG.statusEffects.find(se => se.label === label)))
|
CONFIG.statusEffects.find(se => se.label === label)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user