foundryvtt-wh4-lang-fr-fr/scripts/cUnbADgOQ4fMKgrH.js

20 lines
642 B
JavaScript
Raw Normal View History

2024-05-16 17:57:51 +02:00
let group
let item = await fromUuid("Compendium.wfrp4e-core.items.Item.5hH73j2NgPdsLCZN");
let data = item.toObject();
if (this.item.name.includes("("))
{
group = this.item.parenthesesText
}
else
{
2024-10-08 20:52:09 +02:00
group = await ValueDialog.create({text : "Enter Hatred Group", title : "Hatred Group"})
2024-05-16 17:57:51 +02:00
this.item.updateSource({name : this.item.name + ` (${group})`, "system.tests.value" : this.item.system.tests.value.replace("Group", group)})
this.effect.updateSource({name : this.effect.name + ` (${group})`})
}
data.name = data.name.replace("Target", group);
await this.actor.createEmbeddedDocuments("Item", [data], {fromEffect: this.effect.id});