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