Signes draconiques aléatoires
This commit is contained in:
@ -1,5 +1,15 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDRollTables } from "./rdd-rolltables.js";
|
||||
import { TMRType } from "./tmr-utility.js";
|
||||
|
||||
const tableSignesIndicatifs = [
|
||||
{ rarete: "Très facile", difficulte: 0, xp: 6, nbCases: 14 },
|
||||
{ rarete: "Facile", difficulte: -2, xp: 10, nbCases: 10 },
|
||||
{ rarete: "Moyen", difficulte: -3, xp: 15, nbCases: 7 },
|
||||
{ rarete: "Difficile", difficulte: -5, xp: 20, nbCases: 4 },
|
||||
{ rarete: "Ardu", difficulte: -8, xp: 30, nbCases: 1 }
|
||||
|
||||
]
|
||||
export class RdDItemSigneDraconique {
|
||||
|
||||
static prepareSigneDraconiqueMeditation(meditation, rolled) {
|
||||
@ -57,4 +67,33 @@ export class RdDItemSigneDraconique {
|
||||
}
|
||||
}
|
||||
|
||||
static async randomSigneDraconique() {
|
||||
let modele = await Misc.rollOneOf(tableSignesIndicatifs);
|
||||
return {
|
||||
name: await RdDItemSigneDraconique.randomSigneDescription(),
|
||||
type: "signedraconique",
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp',
|
||||
data: {
|
||||
typesTMR: await RdDItemSigneDraconique.randomTmrs(modele.nbCases),
|
||||
ephemere: true,
|
||||
duree: "1 round",
|
||||
difficulte: modele.difficulte,
|
||||
valeur: { norm: modele.xp, sign: modele.xp, part: Math.floor(modele.xp * 1.5) },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static async randomTmrs(nbTmr = undefined) {
|
||||
let tmrs = Object.values(TMRType).map(value => Misc.upperFirst(value.name));
|
||||
let keep = nbTmr ?? (await new Roll("1d" + TMRType.length).evaluate().total + 1);
|
||||
for (let i = tmrs.length; i > keep; i--) {
|
||||
tmrs.splice(await new Roll("1d" + i).evaluate().total, 1);
|
||||
}
|
||||
return tmrs;
|
||||
}
|
||||
|
||||
static async randomSigneDescription() {
|
||||
return await RdDRollTables.drawTextFromRollTable("Signes draconiques", false);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user