foundryvtt-wh4-lang-fr-fr/scripts/5M6IgCUncCwyxHok.js

35 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2024-05-16 17:57:51 +02:00
let etiquette = (await fromUuid("Compendium.wfrp4e-core.items.Item.sYbgpSnRqSZWgwFP")).toObject();
etiquette.name += ` (Suivants de Tzeentch)`;
2024-05-16 17:57:51 +02:00
let animosity = (await fromUuid("Compendium.wfrp4e-core.items.Item.0VpT5yubw4UL7j6f")).toObject();
animosity.system.specification.value = "Suivants de Nurgle";
2024-05-16 17:57:51 +02:00
let roll = await new Roll("ceil(1d10 / 3)").roll();
roll.toMessage(this.script.getChatData());
let mutations = [];
let msg = `<p><strong>Mutations acquises</strong></p>`
2024-05-16 17:57:51 +02:00
for(let i = 0; i < roll.total; i++)
{
let item;
let uuid;
let result;
if (i % 2 == 0)
{
result = await game.wfrp4e.tables.rollTable("mutatemental", {hideDSN: true}, "Tzeentch")
}
else
{
result = await game.wfrp4e.tables.rollTable("mutatephys", {hideDSN: true}, "Tzeentch")
}
uuid = `Compendium.${result.object.documentCollection}.${result.object.documentId}`;
item = await fromUuid(uuid);
if (item)
{
msg += `<p>@UUID[${uuid}]{${item.name}}</p>`
mutations.push(item.toObject());
}
}
this.actor.createEmbeddedDocuments("Item", mutations.concat([etiquette, animosity]), {fromEffect : this.effect.id})
this.script.scriptMessage(msg);