diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f27d25..0c3c77c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Changed how summon powers spawn multiple tokens. + ## [4.2.3] ### Changed diff --git a/src/module/powers/summonSupport.js b/src/module/powers/summonSupport.js index 6cc3575..2e0bfe8 100644 --- a/src/module/powers/summonSupport.js +++ b/src/module/powers/summonSupport.js @@ -45,25 +45,28 @@ export class BaseSummonEffect extends ActorFolderEffect { } async spawn() { - const location = await Sequencer.Crosshair.show({ - distance: this.targetTokenDoc.height / 2, - texture: this.targetTokenDoc.texture.src, - snap: { - position: CONST.GRID_SNAPPING_MODES.VERTEX | CONST.GRID_SNAPPING_MODES.CENTER, - }, - label: { text: this.targetTokenDoc.name }, - }); - const tokenDocs = []; + const spawned = []; for (let i = 0; i < this.summonCount; i++) { - tokenDocs[i] = this.targetTokenDoc.clone({ - x: location.token.x + i * 5, - y: location.token.y + i * 5, + let label = this.targetTokenDoc.name; + if (this.summonCount > 1) { + label = `${this.targetTokenDoc.name} #${i + 1}`; + } + const location = await Sequencer.Crosshair.show({ + distance: this.targetTokenDoc.height / 2, + texture: this.targetTokenDoc.texture.src, + snap: { + position: CONST.GRID_SNAPPING_MODES.VERTEX | CONST.GRID_SNAPPING_MODES.CENTER, + }, + label: { text: label }, + }); + const tokenDoc = this.targetTokenDoc.clone({ + x: location.token.x, + y: location.token.y, elevation: this.source.elevation, }); + const spawn = await this.source.scene.createEmbeddedDocuments('Token', [tokenDoc]); + spawned.push(...spawn); } - log('token docs', tokenDocs); - const spawned = await this.source.scene.createEmbeddedDocuments('Token', tokenDocs); - log('Spawned', spawned); return spawned; }