23 lines
892 B
JavaScript
23 lines
892 B
JavaScript
if (this.actor.type != "character")
|
|
{
|
|
return;
|
|
}
|
|
|
|
let god = await ValueDialog.create("Saisir une Déité", "Béni")
|
|
|
|
if (god)
|
|
{
|
|
let prayers = await game.wfrp4e.utility.findAll("prayer", "Chargement des Prières")
|
|
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)
|
|
{
|
|
this.script.scriptNotification("Ajout de " + blessings.map(i => i.name).join(", "))
|
|
await this.actor.createEmbeddedDocuments("Item", blessings, {fromEffect : this.effect.id})
|
|
}
|
|
else
|
|
{
|
|
this.script.scriptNotification(`Impossible de trouver des Bénédictions associées avec ${god}.`)
|
|
}
|
|
this.item.updateSource({name : this.item.name.replace("Savoir divin", god)})
|
|
await this.actor.update({"system.details.god.value": god})
|
|
} |