31 lines
774 B
JavaScript
31 lines
774 B
JavaScript
let SL = 1;
|
||
|
||
do {
|
||
const signedSL = SL >= 0 ? `+${SL}` : "SL";
|
||
const content = `
|
||
<div>
|
||
<p style="font-weight: bold;">Vous avez augmenté ${signedSL} ${SL > 1 ? "DRs" : "SL"}. Voulez-vous lancer un d10 ?</p>
|
||
<p>1–6: ajoutez +1 DR</p>
|
||
<p>7–10: perdez tous les DR accumulés et effectuez le test suivant à –1 DR</p>
|
||
</div>
|
||
`;
|
||
const choice = await foundry.applications.api.DialogV2.confirm({
|
||
yes: {label: "Lancer", icon: "fas fa-dice"},
|
||
no: {label: `Keep ${signedSL} DR`, icon: "fas fa-check"},
|
||
content,
|
||
});
|
||
|
||
if (!choice) break;
|
||
|
||
const roll = new Roll("1d10");
|
||
await roll.toMessage({flavor: this.effet.name});
|
||
|
||
if (roll.total >= 7) {
|
||
SL = -1;
|
||
break;
|
||
}
|
||
|
||
SL++;
|
||
} while (true);
|
||
|
||
this.effet.setFlag("wfrp4e", "SL", SL); |