54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
|
const repaired_message = `<p>Finished raisint <em>the anchor</em>.</p>`;
|
||
|
const test = 'Strength';
|
||
|
const difficulty = 'vhard';
|
||
|
const target = 20;
|
||
|
|
||
|
const extendedTestData = {
|
||
|
name: this.item.name,
|
||
|
type: "extendedTest",
|
||
|
img: this.item.img,
|
||
|
system: {
|
||
|
SL: {
|
||
|
current: 0,
|
||
|
target: target
|
||
|
},
|
||
|
test: {
|
||
|
value: test
|
||
|
},
|
||
|
completion: {
|
||
|
value: "remove"
|
||
|
},
|
||
|
difficulty: {
|
||
|
value: difficulty
|
||
|
}
|
||
|
},
|
||
|
effects: [
|
||
|
{
|
||
|
name: `Repair the ${this.item.name}`,
|
||
|
icon: this.item.img,
|
||
|
flags: {
|
||
|
wfrp4e: {
|
||
|
applicationData: {
|
||
|
type: "document",
|
||
|
documentType: "Item"
|
||
|
},
|
||
|
scriptData: [
|
||
|
{
|
||
|
label: this.item.name,
|
||
|
script: `
|
||
|
let id = this.item.flags.wfrp4e.fromEffect;
|
||
|
let effect = this.actor.appliedEffects.find(e => e.id === id);
|
||
|
this.script.scriptMessage("${repaired_message}");
|
||
|
await effect.item.delete();
|
||
|
`,
|
||
|
trigger: "deleteEffect"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
|
||
|
await this.actor.createEmbeddedDocuments("Item", [extendedTestData], {fromEffect: this.effect.id});
|