foundryvtt-wh4-lang-fr-fr/scripts/1BT0MWM2cbhlEnrn.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-05-16 17:57:51 +02:00
let characteristics = {
"ws" : 5,
"bs" : 5,
"s" : 5,
"t" : 0,
"i" : 5,
"ag" : 5,
"dex" : 5,
"int" : 0,
"wp" : 5,
"fel" : 5
}
let items = []
let updateObj = this.actor.toObject();
let talents = (await Promise.all([game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents")])).map(i => i.text)
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
2024-10-08 20:52:09 +02:00
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
2024-05-16 17:57:51 +02:00
}
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);