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

40 lines
937 B
JavaScript
Raw Permalink Normal View History

2024-05-16 17:57:51 +02:00
let dice = await new Roll("1d10").roll()
let roll = dice.total
let talent
let message
let modifier = 0
if (roll <= 3)
{
item = await fromUuid("Compendium.wfrp4e-core.items.mNoCuaVbFBflfO6X")
}
else if (roll <= 6)
{
item = await fromUuid("Compendium.wfrp4e-core.items.OEjUvJKi0xmBwbS2")
modifier = -3
}
else if (roll <= 9)
{
item = await fromUuid("Compendium.wfrp4e-core.items.mdPGZsn2396dEpOf")
modifier = -3
}
else if (roll = 10)
{
item = await fromUuid("Compendium.wfrp4e-core.items.qdMbxW09FUoYBzmB")
modifier = -5
}
message = `Résultat de ${roll}, gagnez ${item.name}, ${modifier} en Force`
2024-05-16 17:57:51 +02:00
dice.toMessage(this.script.getChatData())
2024-06-06 22:46:40 +02:00
let changes = foundry.utils.duplicate(this.effect.changes)
2024-05-16 17:57:51 +02:00
changes[0].value = modifier
this.effect.updateSource({changes})
await this.actor.createEmbeddedDocuments("Item", [item.toObject()], {fromEffect : this.effect.id})
this.script.scriptNotification(message)