2024-05-17 12:46:44 +02:00
|
|
|
let wounds = this.actor.itemTypes.disease.filter(i => i.name == "Blessure Purulente" && i.system.duration.active);
|
2024-05-16 17:57:51 +02:00
|
|
|
let selected;
|
|
|
|
if (wounds.length == 0)
|
|
|
|
{
|
2024-05-17 12:46:44 +02:00
|
|
|
return this.script.scriptNotification("Aucune Blessure Purulente!");
|
2024-05-16 17:57:51 +02:00
|
|
|
}
|
|
|
|
else if (wounds.length == 1)
|
|
|
|
{
|
|
|
|
selected = wounds[0];
|
|
|
|
}
|
|
|
|
else if (wounds.length >= 2)
|
|
|
|
{
|
|
|
|
selected = (await ItemDialog.create(wounds, 1))[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
{
|
|
|
|
let test = await this.actor.setupSkill(game.i18n.localize("NAME.Endurance"), {fields: {difficulty : "average"}})
|
|
|
|
await test.roll();
|
|
|
|
if (test.succeeded)
|
|
|
|
{
|
|
|
|
let SL = parseInt(test.result.SL);
|
|
|
|
if (SL >= 0)
|
|
|
|
{
|
|
|
|
selected.update({"system.duration.value" : selected.system.duration.value - SL})
|
2024-05-17 12:46:44 +02:00
|
|
|
this.script.scriptMessage(`<strong>${selected.name}</strong> durée réduite de ${SL}!`)
|
2024-05-16 17:57:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|