Release version 2.1.0 #37

Merged
mike merged 5 commits from develop into main 2023-11-08 05:38:20 +00:00
Showing only changes of commit a5373585fb - Show all commits

View File

@ -1134,10 +1134,10 @@ class SummonEffect extends PowerEffect {
async applyResult () {
await this.prepAdditional()
await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions)
log('protoDoc', this.protoDoc)
log('spawnOptions', this.spawnOptions)
log('spawnMutation', this.spawnMutation)
await shim.warpgateSpawn(this.protoDoc, this.spawnMutation, {}, this.spawnOptions)
}
}
@ -1146,10 +1146,6 @@ class SummonAllyEffect extends SummonEffect {
return 'Summon Ally'
}
get mirrorFolder () {
return `${this.actorFolderBase}/Mirror Selves`
}
async prepMenu () {
await super.prepMenu()
this.menuData.inputs = this.menuData.inputs.concat([
@ -1255,44 +1251,44 @@ class SummonAllyEffect extends SummonEffect {
if (this.actor.name !== 'Mirror Self') {
return
}
const actorFolder = shim.getActorFolderByPath(this.mirrorFolder)
const oldActor = actorFolder.contents.find(a => a.name === `Mirror ${this.token.name}`)
if (oldActor) {
await oldActor.delete()
}
const actorDoc = this.token.actor.clone({
type: 'npc',
name: `Mirror ${this.token.actor.name}`,
folder: actorFolder.id,
'system.wildcard': false,
'system.fatigue.value': 0,
'system.wounds.value': 0,
'system.wounds.max': 0,
'system.bennies.max': 0,
'system.bennies.value': 0,
'prototypeToken.actorLink': false,
'prototypeToken.name': `Mirror ${this.token.name}`,
'prototypeToken.texture.scaleX': this.token.document.texture.scaleX * -1
const mirrorActor = this.token.actor
this.icon = mirrorActor.prototypeToken.texture.src
this.spawnMutation.actor.system = mirrorActor.system.clone({
wildcard: false,
'fatigue.value': 0,
'wounds.value': 0,
'wounds.max': 0,
'bennies.max': 0,
'bennies.value': 0
})
const mirrorActor = this.actor
this.actor = await shim.Actor.create(actorDoc)
this.actorId = this.actor.id
this.icon = this.actor.prototypeToken.texture.src
this.protoDoc = await this.actor.getTokenDocument()
this.spawnOptions.crosshairs.icon = this.icon
for (const mirrorItem of mirrorActor.items) {
this.spawnMutation.embedded.Item[mirrorItem.name] =
await mirrorActor.getEmbeddedDocument('Item', mirrorItem.id)
this.spawnMutation.actor.name = `Mirror ${mirrorActor.name}`
this.spawnMutation.actor.img = mirrorActor.img
this.spawnMutation.token.name = `Mirror ${this.token.name}`
this.spawnMutation.token.texture = {
src: this.token.document.texture.src,
scaleX: this.token.document.texture.scaleX * -1,
scaleY: this.token.document.texture.scaleY
}
this.spawnMutation.embedded.Item['Summon Ally'] = CONST.WARPGATE.DELETE
this.spawnOptions.crosshairs.icon = this.icon
const effectChanges = []
for (const item of this.token.actor.items.filter(i => i.type === 'skill')) {
effectChanges.push({
key: `@Skill{${item.name}}[system.die.sides]`,
mode: CONST.FOUNDRY.ACTIVE_EFFECT_MODES.ADD,
value: '-2',
priority: 0
})
for (const mirrorItem of mirrorActor.items) {
if (mirrorItem.type === 'power' &&
(mirrorItem.system?.swid === 'summon-ally' || mirrorItem.name === 'Summon Ally')) {
continue
}
if (['weapon', 'armor', 'consumable', 'gear'].includes(mirrorItem.type)) {
continue
}
this.spawnMutation.embedded.Item[mirrorItem.name] = await mirrorActor.getEmbeddedDocument(
'Item', mirrorItem.id)
if (mirrorItem.type === 'skill') {
effectChanges.push({
key: `@Skill{${mirrorItem.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',