Jets de masse

Quelques exemples:

- `/rdd dexterite bricolage -2`
- `/rdd vue survie en sous-sol -2`
- `/rdd vue désert 0`
- `/rdd vue vigi -3`
- `/rdd vol vigi 0` : Volonté Vigilance
- `/rdd chance-actuelle 0`
- `/rdd reve-actuel -8`

Attention:
- `/rdd vue vig 0`

 => Navigation et Vigilance correspondent, c'est Navigation qui est
pris (premier dans l'ordre alphabétique), avec un message.
This commit is contained in:
Vincent Vandemeulebrouck
2021-03-25 00:14:56 +01:00
parent d95a0ebfc1
commit 5fb8d22a7a
3 changed files with 92 additions and 18 deletions

View File

@ -11,9 +11,9 @@ import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { RdDUtility } from "./rdd-utility.js";
import { TMRRencontres } from "./tmr-rencontres.js";
import { TMRType, TMRUtility } from "./tmr-utility.js";
import { TMRUtility } from "./tmr-utility.js";
const rddRollNumeric = /(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
const rddRollNumeric = /$(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
/* -------------------------------------------- */
export class RdDCommands {
@ -64,9 +64,11 @@ export class RdDCommands {
descr: `Effectue un jet de dés dans la table de résolution. Exemples:
<br><strong>/rdd</strong> ouvre la table de résolution
<br><strong>/rdd 10 3</strong> effectue un jet 10 à +3
<br><strong>/rdd 10 +2</strong> effectue un jet 10 à +2
<br><strong>/rdd 15 -2</strong> effectue un jet 15 à -2
<br><strong>/rdd 15 0 s</strong> effectue un jet 15 à 0, avec significative requise`
<br><strong>/rdd 15 0 s</strong> effectue un jet 15 à 0, avec significative requise
<br><strong>/rdd Vue Vigilance -2</strong> effectue un jet de Vue/Vigilance à -2 pour les tokens sélectionnés
<br><strong>/rdd vol déser +2</strong> effectue un jet de Volonté/Survie en désert à +2 pour les tokens sélectionnés
`
});
rddCommands.registerCommand({ path: ["/ddr"], func: (content, msg, params) => rddCommands.rollDeDraconique(msg), descr: "Lance un Dé Draconique" });
@ -217,6 +219,27 @@ export class RdDCommands {
await this.rollRdDNumeric(msg, carac, diff, significative);
return;
}
let actors = canvas.tokens.controlled.map(it => it.actor).filter(it => it);
if (actors && actors.length > 0){
let length = params.length;
let diff = Number(params[length-1]);
if (Number.isInteger(Number(diff))){
length --;
}
else {
diff = 0;
}
const caracName = params[0];
const compName = length>1 ? params.slice(1, length).reduce((a, b) => `${a} ${b}`): undefined;
for (let actor of actors) {
await actor.rollCaracCompetence(caracName, compName, diff);
}
return;
}
else{
ui.notifications.warn("Sélectionnez au moins un personnage pour lancer les dés")
}
}
}