#90 : Gestion du debordement

This commit is contained in:
sladecraven 2020-12-30 19:27:35 +01:00
parent 557bb3a7d7
commit c2e984d700
3 changed files with 33 additions and 10 deletions

View File

@ -1381,7 +1381,7 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
checkIsAdditionnalHumide( cellDescr ) {
checkIsAdditionnalHumide( cellDescr, coordTMR) {
let pontHumide = this.data.items.find( item => item.type == 'souffle' && item.name.toLowerCase().includes( ' des ponts' ) );
if ( pontHumide && cellDescr.type == 'pont') {
ChatMessage.create( {
@ -1389,6 +1389,13 @@ export class RdDActor extends Actor {
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
return true;
}
// Débordement ?
let debordementList = this.data.items.filter( item => item.type == 'casetmr' && item.data.specific == 'debordement' );
for (let caseTMR of debordementList) {
if ( caseTMR.data.coord == coordTMR )
return true;
}
return false;
}

View File

@ -78,6 +78,8 @@ export class RdDTMRDialog extends Dialog {
this._trackToken(this._tokenTrouNoir( caseTMR.data.coord ));
} else if ( caseTMR.data.specific == 'attache') {
this._trackToken(this._tokenTerreAttache( caseTMR.data.coord ));
} else if ( caseTMR.data.specific == 'debordement') {
this._trackToken(this._tokenDebordement( caseTMR.data.coord ));
}
}
}
@ -331,7 +333,7 @@ export class RdDTMRDialog extends Dialog {
refoulement.innerHTML = this.actor.data.data.reve.refoulement.value;
let fatigueItem = document.getElementById("tmr-fatigue-table");
console.log("Refresh : ", this.actor.data.data.sante.fatigue.value);
//console.log("Refresh : ", this.actor.data.data.sante.fatigue.value);
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max).html() + "</table>";
}
@ -359,11 +361,11 @@ export class RdDTMRDialog extends Dialog {
}
/* -------------------------------------------- */
async manageCaseHumide(cellDescr) {
async manageCaseHumide(cellDescr, coordTMR) {
if (this.viewOnly) {
return;
}
let isHumide = this.actor.checkIsAdditionnalHumide(cellDescr);
let isHumide = this.actor.checkIsAdditionnalHumide(cellDescr, coordTMR);
if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais" || isHumide) {
// TODO: permettre de choisir la voie de draconic?
let draconic = this.actor.getBestDraconic();
@ -558,7 +560,7 @@ export class RdDTMRDialog extends Dialog {
if ( deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
await myself.manageRencontre(coordTMR, cellDescr);
}
await myself.manageCaseHumide(cellDescr);
await myself.manageCaseHumide(cellDescr, coordTMR);
await myself.declencheSortEnReserve(coordTMR);
await myself.actor.checkSoufflePeage(cellDescr);
@ -585,7 +587,7 @@ export class RdDTMRDialog extends Dialog {
this._updateDemiReve(this);
let cellDescr = TMRUtility.getTMRDescription(coordTMR);
await this.manageRencontre(coordTMR, cellDescr);
this.manageCaseHumide(cellDescr);
this.manageCaseHumide(cellDescr, coordTMR);
await this.declencheSortEnReserve(coordTMR);
}
@ -644,9 +646,10 @@ export class RdDTMRDialog extends Dialog {
let addMonteLaborieuse = this.actor.checkMonteeLaborieuse();
await this.actor.reveActuelIncDec( (this.tmrdata.isRapide) ? -2-addMonteLaborieuse : -1-addMonteLaborieuse );
this.updateValuesDisplay();
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
await this.manageRencontre(this.actor.data.data.reve.tmrpos.coord, cellDescr);
this.manageCaseHumide(cellDescr);
let coordTMR = this.actor.data.data.reve.tmrpos.coord;
let cellDescr = TMRUtility.getTMRDescription(coordTMR);
await this.manageRencontre(coordTMR, cellDescr);
this.manageCaseHumide(cellDescr, coordTMR);
// Mise à jour du nb de cases de Fatigue
this.nbFatigue = this.actor.getTMRFatigue();
this.actor.displayTMRQueueSouffleInformation();
@ -697,6 +700,19 @@ export class RdDTMRDialog extends Dialog {
return { sprite: sprite, coordTMR: () => coord }
}
/* -------------------------------------------- */
_tokenDebordement( coord ) {
let sprite = new PIXI.Graphics();
sprite.beginFill(0x0101FE, 0.3);
sprite.drawCircle(0, 0, (tmrConstants.cellw / 2) - 2);
sprite.endFill();
sprite.decallage = {
x: 0,
y: 2
}
return { sprite: sprite, coordTMR: () => coord }
}
/* -------------------------------------------- */
_tokenTerreAttache(coord) {
let sprite = new PIXI.Graphics();

View File

@ -253,7 +253,7 @@ const rencontresTable = [
]
/* -------------------------------------------- */
const caseSpecificModes = [ "attache", "trounoir", "humide", "reserve_extensible", "maitrisee", "debordement" ];
const caseSpecificModes = [ "attache", "trounoir", "debordement", "reserve_extensible", "maitrisee", "debordement" ];
/* -------------------------------------------- */
const tmrMovePattern =