Message pour maîtrise Fleuve de l'Oubli

This commit is contained in:
Vincent Vandemeulebrouck
2021-02-06 21:53:25 +01:00
parent 4b88efa999
commit 863fc65844
11 changed files with 551 additions and 431 deletions

View File

@ -68,13 +68,13 @@ export class RdDItemSort extends Item {
let list = [];
let caseCheck = {};
for(let i=0; i<formData.bonusValue.length; i++) {
let caseTMR = formData.caseValue[i] || 'A1';
caseTMR = caseTMR.toUpperCase();
if ( TMRUtility.verifyTMRCoord( caseTMR ) ) { // Sanity check
let coord = formData.caseValue[i] || 'A1';
coord = coord.toUpperCase();
if ( TMRUtility.verifyTMRCoord( coord ) ) { // Sanity check
let bonus = formData.bonusValue[i] || 0;
if ( bonus > 0 && caseCheck[caseTMR] == undefined ) {
caseCheck[caseTMR] = bonus;
list.push( caseTMR+":"+bonus );
if ( bonus > 0 && caseCheck[coord] == undefined ) {
caseCheck[coord] = bonus;
list.push( coord+":"+bonus );
}
}
}
@ -86,21 +86,21 @@ export class RdDItemSort extends Item {
}
/* -------------------------------------------- */
static incrementBonusCase( actor, sort, coordTMR ) {
static incrementBonusCase( actor, sort, coord ) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false);
//console.log("ITEMSORT", sort, bonusCaseList);
let found = false;
let StringList = [];
for( let bc of bonusCaseList) {
if (bc.case == coordTMR) { // Case existante
if (bc.case == coord) { // Case existante
found = true;
bc.bonus = Number(bc.bonus) + 1;
}
StringList.push( bc.case+':'+bc.bonus );
}
if ( !found) { //Nouvelle case, bonus de 1
StringList.push(coordTMR+':1');
StringList.push(coord+':1');
}
// Sauvegarde/update
@ -110,10 +110,10 @@ export class RdDItemSort extends Item {
}
/* -------------------------------------------- */
static getCaseBonus( sort, coordTMR) {
static getCaseBonus( sort, coord) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false);
for( let bc of bonusCaseList) {
if (bc.case == coordTMR) { // Case existante
if (bc.case == coord) { // Case existante
return Number(bc.bonus);
}
}