Génération aléatoire d'archétype
This commit is contained in:
+16
-2
@@ -24,8 +24,7 @@ export class Misc {
|
||||
return text.charAt(0).toLowerCase() + text.slice(1);
|
||||
}
|
||||
|
||||
static stripHtml(html)
|
||||
{
|
||||
static stripHtml(html) {
|
||||
const tmp = document.createElement("DIV")
|
||||
tmp.innerHTML = html
|
||||
return tmp.textContent || tmp.innerText || ""
|
||||
@@ -329,4 +328,19 @@ export class Misc {
|
||||
'-o-transform': rotation
|
||||
};
|
||||
}
|
||||
|
||||
static async random(count) {
|
||||
const roll = new Roll(`1d${count}`)
|
||||
await roll.evaluate()
|
||||
return roll.total
|
||||
}
|
||||
|
||||
static shuffled(source) {
|
||||
const result = source.slice(0)
|
||||
for (let i = result.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[result[i], result[j]] = [result[j], result[i]];
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user