forked from public/foundryvtt-reve-de-dragon
Fix: deplacement aleatoire
Le déplacement aléatoire ne prenait pas compte de la différence entre colonnes paires/impaires
This commit is contained in:
@ -19,7 +19,6 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
export class RdDTMRDialog extends Dialog {
|
||||
|
||||
static async create(actor, tmrData) {
|
||||
@ -188,36 +187,23 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
forceDemiRevePositionView() {
|
||||
this.notifierResonanceSigneDraconique(this._getActorCoord());
|
||||
this.notifierResonanceSigneDraconique(this._getCoordActor());
|
||||
this._trackToken(this.demiReve);
|
||||
}
|
||||
|
||||
_getActorCoord() {
|
||||
_getCoordActor() {
|
||||
return this.actor.system.reve.tmrpos.coord;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async moveFromKey(move) {
|
||||
async deplacementTMR(move) {
|
||||
if (this.subdialog) {
|
||||
return this.forceTMRContinueAction();
|
||||
}
|
||||
|
||||
let oddq = TMRUtility.coordTMRToOddq(this._getActorCoord());
|
||||
|
||||
if (move == 'top') oddq.row -= 1;
|
||||
if (move == 'bottom') oddq.row += 1;
|
||||
if (move.includes('left')) oddq.col -= 1;
|
||||
if (move.includes('right')) oddq.col += 1;
|
||||
if (oddq.col % 2 == 1) {
|
||||
if (move == 'top-left') oddq.row -= 1;
|
||||
if (move == 'top-right') oddq.row -= 1;
|
||||
} else {
|
||||
if (move == 'bottom-left') oddq.row += 1;
|
||||
if (move == 'bottom-right') oddq.row += 1;
|
||||
}
|
||||
|
||||
let targetCoord = TMRUtility.oddqToCoordTMR(oddq);
|
||||
await this._deplacerDemiReve(targetCoord, 'normal');
|
||||
const coordOrig = this._getCoordActor();
|
||||
const coordTarget = TMRUtility.deplacement(coordOrig, move);
|
||||
await this._deplacerDemiReve(coordTarget, 'normal');
|
||||
this.checkQuitterTMR();
|
||||
}
|
||||
|
||||
@ -238,36 +224,36 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
HtmlUtility.showControlWhen(this.html.find(".appliquerFatigue"), ReglesOptionnelles.isUsing("appliquer-fatigue"));
|
||||
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(this._getActorCoord()));
|
||||
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(this._getCoordActor()));
|
||||
|
||||
this.html.find('tr.tmr-row *').click(event => this.subdialog?.bringToTop());
|
||||
|
||||
// Roll Sort
|
||||
this.html.find('.lancer-sort').click(event => this.actor.rollUnSort(this._getActorCoord()));
|
||||
this.html.find('.lire-signe-draconique').click(event => this.actor.rollLireSigneDraconique(this._getActorCoord()));
|
||||
this.html.find('#dir-top').click(event=> this.moveFromKey("top"));
|
||||
this.html.find('#dir-top-left').click(event=> this.moveFromKey("top-left"));
|
||||
this.html.find('#dir-top-right').click(event=> this.moveFromKey("top-right"));
|
||||
this.html.find('#dir-bottom-left').click(event=> this.moveFromKey("bottom-left"));
|
||||
this.html.find('#dir-bottom-right').click(event=> this.moveFromKey("bottom-right"));
|
||||
this.html.find('#dir-bottom').click(event=> this.moveFromKey("bottom"));
|
||||
this.html.find('.lancer-sort').click(event => this.actor.rollUnSort(this._getCoordActor()));
|
||||
this.html.find('.lire-signe-draconique').click(event => this.actor.rollLireSigneDraconique(this._getCoordActor()));
|
||||
|
||||
this.html.find('img.tmr-move').click(event => this.deplacementTMR(this.html.find(event.currentTarget)?.data('move')));
|
||||
|
||||
// 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();
|
||||
await this.actor.reveActuelIncDec(reveCout);
|
||||
await this.actor.reveActuelIncDec(this.calculCoutMonteeTMR());
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
|
||||
// Le reste...
|
||||
this.updateValuesDisplay();
|
||||
let tmr = TMRUtility.getTMR(this._getActorCoord());
|
||||
let tmr = TMRUtility.getTMR(this._getCoordActor());
|
||||
await this.manageRencontre(tmr);
|
||||
}
|
||||
|
||||
calculCoutMonteeTMR() {
|
||||
return ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - this.actor.countMonteeLaborieuse();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateValuesDisplay() {
|
||||
if (!this.rendered) {
|
||||
return;
|
||||
}
|
||||
const coord = this._getActorCoord();
|
||||
const coord = this._getCoordActor();
|
||||
|
||||
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord));
|
||||
|
||||
@ -425,7 +411,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
nbRounds: 1,
|
||||
canClose: false,
|
||||
selectedCarac: { label: "reve-actuel" },
|
||||
tmr: TMRUtility.getTMR(this._getActorCoord())
|
||||
tmr: TMRUtility.getTMR(this._getCoordActor())
|
||||
}
|
||||
|
||||
await this._tentativeMaitrise(rencontreData);
|
||||
@ -608,19 +594,18 @@ export class RdDTMRDialog extends Dialog {
|
||||
if (rencontre) {
|
||||
return game.system.rdd.rencontresTMR.calculRencontre(rencontre, tmr);
|
||||
}
|
||||
let locTMR = (this.isDemiReveCache()
|
||||
const coordTMR = (this.isDemiReveCache()
|
||||
? TMRUtility.getTMRType(tmr.coord) + " ??"
|
||||
: tmr.label + " (" + tmr.coord + ")");
|
||||
|
||||
const fakeDialogRencontre = { bringToTop: () => { } };
|
||||
this.setTMRPendingAction(fakeDialogRencontre)
|
||||
let myRoll = await RdDDice.rollTotal("1dt", { showDice: SHOW_DICE });
|
||||
this.setTMRPendingAction({ bringToTop: () => { } })
|
||||
const myRoll = await RdDDice.rollTotal("1dt", { showDice: SHOW_DICE });
|
||||
this.restoreTMRAfterAction()
|
||||
if (myRoll == 7) {
|
||||
this._tellToUser(myRoll + ": Rencontre en " + locTMR);
|
||||
this._tellToUser(myRoll + ": Rencontre en " + coordTMR);
|
||||
return await game.system.rdd.rencontresTMR.getRencontreAleatoire(tmr, this.actor.isMauvaiseRencontre())
|
||||
} else {
|
||||
this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR);
|
||||
this._tellToUser(myRoll + ": Pas de rencontre en " + coordTMR);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@ -935,7 +920,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
return this.forceTMRContinueAction()
|
||||
}
|
||||
let clickOddq = TMRUtility.computeEventOddq(event);
|
||||
let currentOddq = TMRUtility.coordTMRToOddq(this._getActorCoord());
|
||||
let currentOddq = TMRUtility.coordTMRToOddq(this._getCoordActor());
|
||||
|
||||
let targetCoord = TMRUtility.oddqToCoordTMR(clickOddq);
|
||||
let currentCoord = TMRUtility.oddqToCoordTMR(currentOddq);
|
||||
|
Reference in New Issue
Block a user