#51 Gestion des bonus de cases

This commit is contained in:
2020-12-04 20:52:04 +01:00
parent a831e8b0b2
commit ca84b593ec
11 changed files with 185 additions and 22 deletions

View File

@ -253,9 +253,12 @@ const tmrMovePattern =
{ name: 'topleft', x: -1, y: -1 }
]
/* -------------------------------------------- */
/* -------------------------------------------- */
export class TMRUtility {
/* -------------------------------------------- */
static convertToTMRCoord( x, y )
{
@ -264,6 +267,18 @@ export class TMRUtility {
return letterX+y
}
/* -------------------------------------------- */
static verifyTMRCoord( coord ) {
let TMRregexp = new RegExp(/([A-M])(\d+)/g);
let res = TMRregexp.exec( coord );
if (res && res[1] && res[2]) {
if (res[2] > 0 && res[2] < 16) {
return true;
}
}
return false;
}
/* -------------------------------------------- */
static convertToCellCoord( coordTMR )
{
@ -294,7 +309,7 @@ export class TMRUtility {
/* -------------------------------------------- */
static getDirectionPattern() {
let index = new Roll("d"+tmrMovePattern.length+" -1").roll().total;
let index = new Roll("1d"+tmrMovePattern.length+" -1").roll().total;
return tmrMovePattern[index];
}
@ -344,7 +359,7 @@ export class TMRUtility {
static async rencontreTMRTypeCase(typeTMR, roll=undefined) {
if (!roll) {
//roll = await RdDDice.show(new Roll("d100").evaluate()).total;
roll = new Roll("d100").roll().total;
roll = new Roll("1d100").roll().total;
console.log("rencontreTMRTypeCase", roll);
}
typeTMR = typeTMR.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
@ -373,7 +388,7 @@ export class TMRUtility {
return false;
}
if (roll == undefined) {
roll = new Roll("d100").evaluate().total;
roll = new Roll("1d100").evaluate().total;
}
roll = Math.max(1, Math.min(roll, 100));