mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Improved logic
This commit is contained in:
parent
7fac6e8e82
commit
8c2b114a04
2 changed files with 8 additions and 6 deletions
|
|
@ -44,7 +44,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
|
||||
const actor = await getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
|
||||
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */
|
||||
summon.actor = actor;
|
||||
summon.actor = actor.toObject();
|
||||
|
||||
const countNumber = Number.parseInt(count);
|
||||
for (let i = 0; i < countNumber; i++) {
|
||||
|
|
|
|||
|
|
@ -893,13 +893,15 @@ export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
|
|||
|
||||
export async function getWorldActor(baseActor) {
|
||||
if (baseActor.inCompendium) {
|
||||
const worldActorCopy =
|
||||
game.actors.find(x => x._stats.compendiumSource === baseActor.uuid && x.name === baseActor.name);
|
||||
const worldActorCopy = game.actors.find(x =>
|
||||
x._stats.compendiumSource === baseActor.uuid &&
|
||||
(!x.prototypeToken.actorLink || x.name === baseActor.name)
|
||||
);
|
||||
|
||||
if (worldActorCopy)
|
||||
return worldActorCopy.toObject();
|
||||
return worldActorCopy;
|
||||
|
||||
const baseActorData = baseActor.toObject();
|
||||
const baseActorData = baseActor;
|
||||
return await game.system.api.documents.DhpActor.create({
|
||||
...baseActorData,
|
||||
_stats: {
|
||||
|
|
@ -909,5 +911,5 @@ export async function getWorldActor(baseActor) {
|
|||
});
|
||||
}
|
||||
|
||||
return baseActor.toObject();
|
||||
return baseActor;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue