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

40 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2024-05-16 17:57:51 +02:00
let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") }
let message = ""
2024-06-06 22:46:40 +02:00
let wounds = foundry.utils.duplicate(this.actor.status.wounds)
2024-05-16 17:57:51 +02:00
let regenRoll = await new Roll("1d10").roll();
let regen = regenRoll.total;
if (wounds.value >= wounds.max)
return
if (wounds.value > 0)
{
wounds.value += regen
if (wounds.value > wounds.max)
{
wounds.value = wounds.max
}
2024-06-06 21:09:27 +02:00
message += `<b>${this.actor.name}</b> regagne ${regen} Blessures.`
2024-05-16 17:57:51 +02:00
if (regen == 10)
{
2024-06-06 21:09:27 +02:00
message += `<br>Et guéri une Blessure Critique.`
}
2024-05-16 17:57:51 +02:00
}
else if (regen >= 8)
{
2024-06-06 21:09:27 +02:00
message += `<b>${this.actor.name}</b> a obtenu ${regen} et récupère 1 Blessure.`
2024-05-16 17:57:51 +02:00
wounds.value += 1
if (regen == 10)
{
2024-06-06 21:09:27 +02:00
message += `<br>Et guéri une Blessure Critique.`
2024-05-16 17:57:51 +02:00
}
}
else
{
2024-06-06 21:09:27 +02:00
message += `<b>${this.actor.name}</b> Résultat de régénération de ${regen} - Aucun effet.`
2024-05-16 17:57:51 +02:00
}
await this.actor.update({ "system.status.wounds": wounds })
this.script.scriptMessage(message, { whisper: ChatMessage.getWhisperRecipients("GM") })