Minor reformat avant signes draconiques
This commit is contained in:
@ -59,8 +59,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
this.rencontreState = 'aucune';
|
||||
this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
|
||||
|
||||
this.pixiTMR = new PixiTMR(this, this.pixiApp);
|
||||
this.cacheTMR = (game.user.isGM) ? false: actor.isTMRCache();
|
||||
this.pixiTMR = new PixiTMR(this, this.pixiApp);
|
||||
this.cacheTMR = (game.user.isGM) ? false : actor.isTMRCache();
|
||||
|
||||
this.callbacksOnAnimate = [];
|
||||
if (!this.viewOnly) {
|
||||
@ -69,7 +69,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
// load the texture we need
|
||||
this.pixiTMR.load( (loader, resources) => this.createPixiSprites() );
|
||||
this.pixiTMR.load((loader, resources) => this.createPixiSprites());
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -142,20 +142,25 @@ export class RdDTMRDialog extends Dialog {
|
||||
_tokenSortEnReserve(sortEnReserve) {
|
||||
return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortEnReserve.sort, () => sortEnReserve.coord);
|
||||
}
|
||||
|
||||
_tokenDemiReve() {
|
||||
const actorData = Misc.data(this.actor);
|
||||
return EffetsDraconiques.demiReve.token(this.pixiTMR, actorData, () => actorData.data.reve.tmrpos.coord);
|
||||
}
|
||||
|
||||
_updateDemiReve() {
|
||||
if ( !this.cacheTMR) {
|
||||
if (!this.cacheTMR) {
|
||||
this._setTokenPosition(this.demiReve);
|
||||
}
|
||||
}
|
||||
|
||||
_getActorCoord() {
|
||||
return Misc.data(this.actor).data.reve.tmrpos.coord;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async moveFromKey( move ) {
|
||||
let pos = TMRUtility.convertToCellPos(Misc.data(this.actor).data.reve.tmrpos.coord);
|
||||
async moveFromKey(move) {
|
||||
let pos = TMRUtility.convertToCellPos(this._getActorCoord());
|
||||
|
||||
if (move == 'top') pos.y -= 1;
|
||||
if (move == 'bottom') pos.y += 1;
|
||||
@ -165,7 +170,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
if (move == 'top-left') pos.y -= 1;
|
||||
if (move == 'top-right') pos.y -= 1;
|
||||
} else {
|
||||
if (move == 'bottom-left') pos.y += 1;
|
||||
if (move == 'bottom-left') pos.y += 1;
|
||||
if (move == 'bottom-right') pos.y += 1;
|
||||
}
|
||||
|
||||
@ -196,34 +201,33 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
html.find('#dir-top').click((event) => {
|
||||
this.moveFromKey("top");
|
||||
} );
|
||||
});
|
||||
html.find('#dir-top-left').click((event) => {
|
||||
this.moveFromKey("top-left");
|
||||
} );
|
||||
});
|
||||
html.find('#dir-top-right').click((event) => {
|
||||
this.moveFromKey("top-right");
|
||||
} );
|
||||
});
|
||||
html.find('#dir-bottom-left').click((event) => {
|
||||
this.moveFromKey("bottom-left");
|
||||
} );
|
||||
});
|
||||
html.find('#dir-bottom-right').click((event) => {
|
||||
this.moveFromKey("bottom-right");
|
||||
} );
|
||||
});
|
||||
html.find('#dir-bottom').click((event) => {
|
||||
this.moveFromKey("bottom");
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
// Gestion du cout de montée en points de rêve
|
||||
let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - this.actor.countMonteeLaborieuse();
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")){
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
}
|
||||
await this.actor.reveActuelIncDec(reveCout);
|
||||
|
||||
// Le reste...
|
||||
this.updateValuesDisplay();
|
||||
let tmr = TMRUtility.getTMR(Misc.data(this.actor).data.reve.tmrpos.coord);
|
||||
let tmr = TMRUtility.getTMR(this._getActorCoord());
|
||||
await this.manageRencontre(tmr, () => {
|
||||
this.postRencontre(tmr);
|
||||
});
|
||||
@ -234,13 +238,13 @@ export class RdDTMRDialog extends Dialog {
|
||||
let ptsreve = document.getElementById("tmr-pointsreve-value");
|
||||
const actorData = Misc.data(this.actor);
|
||||
ptsreve.innerHTML = actorData.data.reve.reve.value;
|
||||
const coord = this._getActorCoord();
|
||||
|
||||
let tmrpos = document.getElementById("tmr-pos");
|
||||
if ( this.cacheTMR ) {
|
||||
tmrpos.innerHTML = '?? ('+ TMRUtility.getTMRType( actorData.data.reve.tmrpos.coord ) + ')';
|
||||
if (this.cacheTMR) {
|
||||
tmrpos.innerHTML = '?? (' + TMRUtility.getTMRType(coord) + ')';
|
||||
} else {
|
||||
let tmr = TMRUtility.getTMR(actorData.data.reve.tmrpos.coord);
|
||||
tmrpos.innerHTML = actorData.data.reve.tmrpos.coord + " (" + tmr.label + ")";
|
||||
tmrpos.innerHTML = coord + " (" + TMRUtility.getTMRLabel(coord) + ")";
|
||||
}
|
||||
|
||||
let etat = document.getElementById("tmr-etatgeneral-value");
|
||||
@ -249,7 +253,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
let refoulement = document.getElementById("tmr-refoulement-value");
|
||||
refoulement.innerHTML = actorData.data.reve.refoulement.value;
|
||||
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")){
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||
let fatigueItem = document.getElementById("tmr-fatigue-table");
|
||||
//console.log("Refresh : ", actorData.data.sante.fatigue.value);
|
||||
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(actorData.data.sante.fatigue.value, actorData.data.sante.endurance.max).html() + "</table>";
|
||||
@ -373,7 +377,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
rencontre: this.currentRencontre,
|
||||
nbRounds: 1,
|
||||
canClose: false,
|
||||
tmr: TMRUtility.getTMR(Misc.data(this.actor).data.reve.tmrpos.coord)
|
||||
tmr: TMRUtility.getTMR(this._getActorCoord())
|
||||
}
|
||||
|
||||
await this._tentativeMaitrise(rencontreData);
|
||||
@ -414,7 +418,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
else if (rencData.rolled.isEchec && rencData.rencontre.isPersistant) {
|
||||
setTimeout(() => {
|
||||
rencData.nbRounds++;
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")){
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
}
|
||||
this._tentativeMaitrise(rencData);
|
||||
@ -523,11 +527,11 @@ export class RdDTMRDialog extends Dialog {
|
||||
if (rencontre) {
|
||||
return rencontre;
|
||||
}
|
||||
let myRoll = new Roll("1d7").evaluate( { async: false} ).total;
|
||||
let myRoll = new Roll("1d7").evaluate({ async: false }).total;
|
||||
if (TMRUtility.isForceRencontre() || myRoll == 7) {
|
||||
return await this.rencontreTMRRoll(tmr, this.actor.isRencontreSpeciale());
|
||||
}
|
||||
let locTMR = (this.cacheTMR) ? "??": tmr.label + " (" + tmr.coord + ")";
|
||||
let locTMR = (this.cacheTMR) ? "??" : tmr.label + " (" + tmr.coord + ")";
|
||||
this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR);
|
||||
}
|
||||
|
||||
@ -852,7 +856,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onClickTMRPos(eventPos) {
|
||||
let currentPos = TMRUtility.convertToCellPos(Misc.data(this.actor).data.reve.tmrpos.coord);
|
||||
let currentPos = TMRUtility.convertToCellPos(this._getActorCoord());
|
||||
|
||||
console.log("deplacerDemiReve >>>>", currentPos, eventPos);
|
||||
|
||||
@ -861,7 +865,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
// Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter)
|
||||
let deplacementType = this._calculDeplacement(targetCoord, currentCoord, currentPos, eventPos);
|
||||
|
||||
|
||||
// Si le deplacement est valide
|
||||
if (deplacementType == 'normal' || deplacementType == 'saut') {
|
||||
await this._deplacerDemiReve(targetCoord, deplacementType);
|
||||
@ -901,8 +905,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
externalRefresh( tmrData ) {
|
||||
this.cacheTMR = (game.user.isGM) ? false: this.actor.isTMRCache();
|
||||
externalRefresh(tmrData) {
|
||||
this.cacheTMR = (game.user.isGM) ? false : this.actor.isTMRCache();
|
||||
this.createPixiSprites();
|
||||
this.forceDemiRevePositionView();
|
||||
this.updateValuesDisplay();
|
||||
@ -920,11 +924,10 @@ export class RdDTMRDialog extends Dialog {
|
||||
// Gestion cases spéciales type Trou noir, etc
|
||||
tmr = await this.manageTmrInnaccessible(tmr);
|
||||
|
||||
this.actor.updateCoordTMR(tmr.coord);
|
||||
await this.actor.updateCoordTMR(tmr.coord);
|
||||
|
||||
this._updateDemiReve();
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")){
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
}
|
||||
this.updateValuesDisplay();
|
||||
@ -998,7 +1001,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_setTokenPosition(token) {
|
||||
if ( !this.cacheTMR) {
|
||||
if (!this.cacheTMR) {
|
||||
this.pixiTMR.setPosition(token.sprite, TMRUtility.convertToCellPos(token.coordTMR()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user