2024-06-06 22:07:28 +02:00
|
|
|
let actor = game.user.character ?? canvas.tokens.controlled[0]?.actor;
|
|
|
|
if (!actor || !(actor.system instanceof StandardActorModel))
|
2024-10-08 20:52:09 +02:00
|
|
|
return ui.notifications.warn("You must control an Actor capable of performing a Strength Test");
|
2024-06-06 22:07:28 +02:00
|
|
|
|
|
|
|
let test = await actor.setupCharacteristic("s", {
|
|
|
|
skipTargets: true,
|
2024-10-08 20:52:09 +02:00
|
|
|
appendTitle: " - Bailing Out",
|
2024-06-06 22:07:28 +02:00
|
|
|
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) {
|
2024-10-08 20:52:09 +02:00
|
|
|
const scriptData = this.effect.system.scriptData
|
2024-06-06 22:07:28 +02:00
|
|
|
scriptData[2].trigger = '';
|
2024-10-08 20:52:09 +02:00
|
|
|
await this.effect.update({disabled: true, "system.scriptData": scriptData});
|
2024-06-06 22:07:28 +02:00
|
|
|
}
|