#90 : Gestion de la connaissance du fleuve

This commit is contained in:
sladecraven 2020-12-30 21:11:01 +01:00
parent c2e984d700
commit 67e5e2c822
3 changed files with 70 additions and 5 deletions

View File

@ -1351,6 +1351,11 @@ export class RdDActor extends Actor {
return 1; return 1;
} }
/* -------------------------------------------- */
isConnaissanceFleuve( ) {
return this.data.items.find( item => item.type == 'tete' && item.name.toLowerCase().includes( 'connaissance du fleuve' ) );
}
/* -------------------------------------------- */ /* -------------------------------------------- */
isReserveEnSecurite() { isReserveEnSecurite() {
let reserveSecurite = this.data.items.find( item => item.type == 'tete' && item.name.toLowerCase().includes( ' en sécurité' ) ); let reserveSecurite = this.data.items.find( item => item.type == 'tete' && item.name.toLowerCase().includes( ' en sécurité' ) );
@ -1380,6 +1385,15 @@ export class RdDActor extends Actor {
} }
} }
/* -------------------------------------------- */
checkTeteDeplacementAccelere() {
let deplAccelere = this.data.items.find( item => item.type == 'tete' && item.name.toLowerCase().includes( ' déplacement accéléré' ) );
if ( deplAccelere ) {
return true;
}
return false;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
checkIsAdditionnalHumide( cellDescr, coordTMR) { checkIsAdditionnalHumide( cellDescr, coordTMR) {
let pontHumide = this.data.items.find( item => item.type == 'souffle' && item.name.toLowerCase().includes( ' des ponts' ) ); let pontHumide = this.data.items.find( item => item.type == 'souffle' && item.name.toLowerCase().includes( ' des ponts' ) );

View File

@ -80,6 +80,8 @@ export class RdDTMRDialog extends Dialog {
this._trackToken(this._tokenTerreAttache( caseTMR.data.coord )); this._trackToken(this._tokenTerreAttache( caseTMR.data.coord ));
} else if ( caseTMR.data.specific == 'debordement') { } else if ( caseTMR.data.specific == 'debordement') {
this._trackToken(this._tokenDebordement( caseTMR.data.coord )); this._trackToken(this._tokenDebordement( caseTMR.data.coord ));
} else if ( caseTMR.data.specific == 'maitrisee') {
this._trackToken(this._tokenMaitrisee( caseTMR.data.coord ));
} }
} }
} }
@ -354,6 +356,16 @@ export class RdDTMRDialog extends Dialog {
} }
} }
/* -------------------------------------------- */
isCaseMaitrisee( coordTMR) {
for( let caseTMR of this.casesSpeciales) {
if (caseTMR.data.coord == coordTMR && caseTMR.data.specific == 'maitrisee') {
return true;
}
}
return false;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
manageCaseHumideResult() { manageCaseHumideResult() {
if (this.toclose) if (this.toclose)
@ -367,6 +379,12 @@ export class RdDTMRDialog extends Dialog {
} }
let isHumide = this.actor.checkIsAdditionnalHumide(cellDescr, coordTMR); let isHumide = this.actor.checkIsAdditionnalHumide(cellDescr, coordTMR);
if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais" || isHumide) { if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais" || isHumide) {
if ( this.isCaseMaitrisee( coordTMR ) ) {
ChatMessage.create( {
content: "Cette case humide est déja maitrisée grâce à votre Tête <strong>Quête des Eaux</strong>",
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
return;
}
// TODO: permettre de choisir la voie de draconic? // TODO: permettre de choisir la voie de draconic?
let draconic = this.actor.getBestDraconic(); let draconic = this.actor.getBestDraconic();
@ -514,6 +532,17 @@ export class RdDTMRDialog extends Dialog {
return false; return false;
} }
/* -------------------------------------------- */
checkConnaissanceFleuve( currentTMR, nextTMR ) {
if ( this.actor.isConnaissanceFleuve() ) {
//console.log(currentTMR, nextTMR );
if ( TMRUtility.getTMRDescription(currentTMR).type == 'fleuve' && TMRUtility.getTMRDescription(nextTMR).type == 'fleuve') {
return true;
}
}
return false;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async deplacerDemiReve(event) { async deplacerDemiReve(event) {
if (this.viewOnly) { if (this.viewOnly) {
@ -529,11 +558,12 @@ export class RdDTMRDialog extends Dialog {
console.log("deplacerDemiReve >>>>", cellx, celly); console.log("deplacerDemiReve >>>>", cellx, celly);
let currentPos = TMRUtility.convertToCellCoord(myself.actor.data.data.reve.tmrpos.coord); let currentPos = TMRUtility.convertToCellCoord(myself.actor.data.data.reve.tmrpos.coord);
let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly); let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly);
let currentTMR = TMRUtility.convertToTMRCoord( currentPos.x, currentPos.y);
// Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter) // Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter)
let deplacementType = 'erreur'; let deplacementType = 'erreur';
if ( myself.rencontreState == 'aucune') { // Pas de recontre en post-processing, donc deplacement normal if ( myself.rencontreState == 'aucune') { // Pas de recontre en post-processing, donc deplacement normal
if ( !RdDTMRDialog._horsDePortee(currentPos, cellx, celly) || myself.isTerreAttache(coordTMR) ) { if ( !RdDTMRDialog._horsDePortee(currentPos, cellx, celly) || myself.isTerreAttache(coordTMR) || myself.checkConnaissanceFleuve(currentTMR,coordTMR ) ) {
deplacementType = 'normal'; deplacementType = 'normal';
} }
} else { } else {
@ -643,8 +673,16 @@ export class RdDTMRDialog extends Dialog {
return; return;
} }
let addMonteLaborieuse = this.actor.checkMonteeLaborieuse(); // Gestion du cout de montée en points de rêve
await this.actor.reveActuelIncDec( (this.tmrdata.isRapide) ? -2-addMonteLaborieuse : -1-addMonteLaborieuse ); let reveCout = -1;
if ( this.actor.checkTeteDeplacementAccelere() ) {
reveCout = -1;
} else {
reveCout = (this.tmrdata.isRapide) ? -2 : -1;
}
reveCout -= this.actor.checkMonteeLaborieuse();
await this.actor.reveActuelIncDec( reveCout );
// Le reste...
this.updateValuesDisplay(); this.updateValuesDisplay();
let coordTMR = this.actor.data.data.reve.tmrpos.coord; let coordTMR = this.actor.data.data.reve.tmrpos.coord;
let cellDescr = TMRUtility.getTMRDescription(coordTMR); let cellDescr = TMRUtility.getTMRDescription(coordTMR);
@ -713,6 +751,19 @@ export class RdDTMRDialog extends Dialog {
return { sprite: sprite, coordTMR: () => coord } return { sprite: sprite, coordTMR: () => coord }
} }
/* -------------------------------------------- */
_tokenMaitrisee(coord) {
let sprite = new PIXI.Graphics();
sprite.beginFill(0x1010F0, 0.8);
sprite.drawCircle(0, 0, 6);
sprite.endFill();
sprite.decallage = {
x: 16 - (tmrConstants.cellw / 2),
y: 16 - (tmrConstants.cellh / 2)
}
return { sprite: sprite, coordTMR: () => coord }
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_tokenTerreAttache(coord) { _tokenTerreAttache(coord) {
let sprite = new PIXI.Graphics(); let sprite = new PIXI.Graphics();

View File

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