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

54 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2024-06-06 22:07:28 +02:00
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Force';
const difficulty = 'easy';
const target = 10;
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: `Réparer le ${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});