#PF2E Unowned Token Buff

1 messages ยท Page 1 of 1 (latest)

onyx eagle
zinc garden
#

So just loop over targets.

errant owl
#

Here you go

const tokenDocs=targets.map(i=>i.document)
for (let tokenDoc of tokenDocs){
    const existing = tokenDoc.actor.itemTypes.effect.find((e) => e.data.flags.core?.sourceId === ITEM_UUID);
    if(existing){

    }else{

    }
}
#

Just fill in the actual stuff

zinc garden
#
if(existing) warpgate.revert(tokenDoc, "STEVE!");
else warpgate.mutate(tokenDoc, {embedded: {Item: {[source.name]: source}}, {}, {name: "STEVE!", description: "Is that you, Steve?"});
#

also e.getFlag("core", sourceId) === ITEM_UUID

onyx eagle
#

Looks right. Give it a description as well for more context

#

That's what is shown to the remote user

zinc garden
#

Panda_Beard may replace those strings himself. ๐Ÿ™‚

#

But I like Steve.

onyx eagle
#

You could also replace the item types.find with a mutation stack query instead. Only a bit shorter but doesn't rely on the source uuid comparison

solid skiff
#

This is super helpful thanks! I'm gonna see if I can play around at some point today, but got a busy one. I'll let you know how I get on ๐Ÿ‘

cyan nexus
#

adding the final result here: