mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 10:29:54 +02:00
Fixed logic for picking which actor to summon
This commit is contained in:
parent
1ebbad4797
commit
cf4c546ca2
1 changed files with 9 additions and 2 deletions
|
|
@ -65,9 +65,16 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
/* Check for any available instances of the actor present in the world if we're missing artwork in the compendium. If none exists, create one. */
|
||||
static async getWorldActor(baseActor) {
|
||||
const dataType = game.system.api.data.actors[`Dh${baseActor.type.capitalize()}`];
|
||||
if (baseActor.inCompendium && dataType && baseActor.img === dataType.DEFAULT_ICON) {
|
||||
if (baseActor.inCompendium) {
|
||||
const worldActorCopy = game.actors.find(x => x.name === baseActor.name);
|
||||
if (worldActorCopy) return worldActorCopy;
|
||||
if (
|
||||
worldActorCopy && (
|
||||
baseActor.img === worldActorCopy.img ||
|
||||
(dataType && baseActor.img === dataType.DEFAULT_ICON)
|
||||
)
|
||||
) {
|
||||
return worldActorCopy;
|
||||
}
|
||||
|
||||
return await game.system.api.documents.DhpActor.create(baseActor.toObject());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue