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

22 lines
861 B
JavaScript
Raw Permalink Normal View History

2024-05-16 17:57:51 +02:00
if (getProperty(args.data, "system.loaded.value") == true)
{
let repeaterValue = Math.ceil(CONFIG.Dice.randomUniform() * 10);
let qualities = foundry.utils.deepClone(this.item.system.qualities.value);
let repeater = qualities.find(i => i.name == "repeater")
if (repeater)
{
repeater.value = repeaterValue
}
else
{
qualities.push({name : "repeater", value : repeaterValue})
}
setProperty(args.data, "system.loaded.amt", repeaterValue)
this.item.update({"system.qualities.value" : qualities});
this.script.scriptNotification("Repeater " + repeaterValue);
}
else if (getProperty(args.data, "system.loaded.value") == false)
{
let qualities = foundry.utils.deepClone(this.item.system.qualities.value).filter(i => i.name != "repeater");
this.item.update({"system.qualities.value" : qualities});
}