2024-05-16 17:57:51 +02:00
|
|
|
if (this.actor.type != "character")
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-05-17 09:19:48 +02:00
|
|
|
let god = await ValueDialog.create("Saisir une Déité", "Béni")
|
2024-05-16 17:57:51 +02:00
|
|
|
|
|
|
|
if (god)
|
|
|
|
{
|
2024-05-17 09:19:48 +02:00
|
|
|
let prayers = await game.wfrp4e.utility.findAll("prayer", "Chargement des Prières")
|
2024-05-16 17:57:51 +02:00
|
|
|
let blessings = prayers.filter(p => p.system.god.value.split(",").map(i => i.trim().toLowerCase()).includes(god.toLowerCase()) && p.system.type.value == "blessing")
|
|
|
|
if (blessings.length)
|
|
|
|
{
|
2024-05-17 09:19:48 +02:00
|
|
|
this.script.scriptNotification("Ajout de " + blessings.map(i => i.name).join(", "))
|
2024-05-16 17:57:51 +02:00
|
|
|
await this.actor.createEmbeddedDocuments("Item", blessings, {fromEffect : this.effect.id})
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-05-17 09:19:48 +02:00
|
|
|
this.script.scriptNotification(`Impossible de trouver des Bénédictions associées avec ${god}.`)
|
2024-05-16 17:57:51 +02:00
|
|
|
}
|
2024-05-17 09:19:48 +02:00
|
|
|
this.item.updateSource({name : this.item.name.replace("Savoir divin", god)})
|
2024-05-16 17:57:51 +02:00
|
|
|
await this.actor.update({"system.details.god.value": god})
|
|
|
|
}
|