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

53 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-10-08 20:52:09 +02:00
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
2024-06-06 22:07:28 +02:00
const test = 'Voile';
const difficulty = 'average';
const target = 30;
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: [
{
2024-10-08 20:52:09 +02:00
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
2024-06-06 22:07:28 +02:00
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);
2024-10-08 20:52:09 +02:00
this.script.message("${repaired_message}");
2024-06-06 22:07:28 +02:00
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
2024-10-08 20:52:09 +02:00
2024-06-06 22:07:28 +02:00
]
};
await this.actor.createEmbeddedDocuments("Item", [extendedTestData], {fromEffect: this.effect.id});