Sync to v7.2.0
This commit is contained in:
28
scripts/BVNKF9omCppWPLys.js
Normal file
28
scripts/BVNKF9omCppWPLys.js
Normal file
@ -0,0 +1,28 @@
|
||||
let actor = game.user.character ?? canvas.tokens.controlled[0]?.actor;
|
||||
if (!actor || !(actor.system instanceof StandardActorModel))
|
||||
return ui.notifications.warn("Vous devez contrôler un Acteur capable de réaliser un Test de Force");
|
||||
|
||||
let test = await actor.setupCharacteristic("s", {
|
||||
skipTargets: true,
|
||||
appendTitle: " - Renflouement",
|
||||
fields: {
|
||||
difficulty: "challenging"
|
||||
},
|
||||
context: {
|
||||
success: "Reduced the Holed rating!"
|
||||
}
|
||||
});
|
||||
|
||||
await test.roll();
|
||||
if (test.succeeded) {
|
||||
let SL = parseInt(test.result.SL);
|
||||
let name = this.effect.name.replace(/\d+/, rating => parseInt(rating) - SL);
|
||||
await this.effect.update({name});
|
||||
}
|
||||
|
||||
let rating = parseInt(this.effect.name.match(/\d+/)?.[0]);
|
||||
if (rating <= 1) {
|
||||
const scriptData = this.effect.flags.wfrp4e.scriptData;
|
||||
scriptData[2].trigger = '';
|
||||
await this.effect.update({disabled: true, "flags.wfrp4e.scriptData": scriptData});
|
||||
}
|
Reference in New Issue
Block a user