Ajout commande /tmra

This commit is contained in:
sladecraven 2020-09-13 23:08:52 +02:00
parent cec65edb83
commit cd291c4ae0
2 changed files with 24 additions and 3 deletions

View File

@ -628,6 +628,9 @@ export class RdDUtility {
} else if (command === "/tmrr") {
TMRUtility.getRencontre(commands[1], commands[2] )
return false
} else if (command === "/tmra") {
TMRUtility.getTMRAleatoire( )
return false
}
return true;

View File

@ -159,7 +159,7 @@ const TMRMapping = {
C12: { type: "lac", label: "Lac de Fricassa"},
D12: { type: "collines", label: "Collines dHuaï"},
E12: { type: "monts", label: "Monts Ajourés"},
F12: { type: "necropole", label: "Nécropole de 'roat"},
F12: { type: "necropole", label: "Nécropole de Troat"},
G12: { type: "plaines", label: "Plaines de Lufmil"},
H12: { type: "collines", label: "Collines de Tooth"},
I12: { type: "gouffre", label: "Gouffre Abimeux"},
@ -429,5 +429,23 @@ export class TMRUtility {
}
/* -------------------------------------------- */
/**
*
*/
static getTMRAleatoire()
{
let num = new Roll("1d15").roll().total;
let letter, letterValue;
if ( num == 15) {
letterValue = new Roll( "1d7").roll().total;
letter = String.fromCharCode( 65 + ((parseInt(letterValue)-1)*2) );
} else {
letterValue = new Roll( "1d13 + 64" ).roll().total;
letter = String.fromCharCode( letterValue );
}
let caseIndex = letter+num;
console.log("Case ", letterValue, letter, num, TMRMapping[caseIndex].label );
}
}