#185 - Reinit nombres astraux
This commit is contained in:
parent
d42de6c316
commit
33ed7bfe2c
@ -1210,6 +1210,17 @@ export class RdDActor extends Actor {
|
||||
return queue;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async cacheTMR( ) {
|
||||
await this.update({ 'data.reve.tmrpos.cache': true });
|
||||
}
|
||||
async montreTMR( ) {
|
||||
await this.update({ 'data.reve.tmrpos.cache': false });
|
||||
}
|
||||
async isTMRCache( ) {
|
||||
return this.data.data.reve.tmrpos.cache;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async reinsertionAleatoire(raison) {
|
||||
ChatMessage.create({
|
||||
@ -1219,9 +1230,11 @@ export class RdDActor extends Actor {
|
||||
const innaccessible = this.buildTMRInnaccessible();
|
||||
let tmr = TMRUtility.getTMRAleatoire(tmr => !innaccessible.includes(tmr.coord));
|
||||
this.updateCoordTMR(tmr.coord);
|
||||
this.cacheTMR();
|
||||
return tmr;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
buildTMRInnaccessible() {
|
||||
const tmrInnaccessibles = this.filterItemsData(it => Draconique.isCaseTMR(it) &&
|
||||
EffetsDraconiques.isInnaccessible(it));
|
||||
|
@ -9,6 +9,7 @@ export class RdDAstrologieEditeur extends Dialog {
|
||||
constructor(html, calendrier, calendrierData) {
|
||||
|
||||
let myButtons = {
|
||||
resetButton: { label: "Re-tirer les nombres astraux", callback: html => this.resetNombreAstraux() },
|
||||
saveButton: { label: "Fermer", callback: html => this.fillData() }
|
||||
};
|
||||
|
||||
@ -21,6 +22,14 @@ export class RdDAstrologieEditeur extends Dialog {
|
||||
this.updateData( calendrierData );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
resetNombreAstraux() {
|
||||
game.system.rdd.calendrier.resetNombreAstral();
|
||||
game.system.rdd.calendrier.rebuildListeNombreAstral();
|
||||
|
||||
game.system.rdd.calendrier.showAstrologieEditor();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
fillData( ) {
|
||||
}
|
||||
|
@ -136,6 +136,12 @@ export class RdDCalendrier extends Application {
|
||||
return this.getNombreAstral(indexDate);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
resetNombreAstral( ) {
|
||||
this.listeNombreAstral = [];
|
||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getNombreAstral(indexDate) {
|
||||
const liste = this.listeNombreAstral ?? this._loadListNombreAstral();
|
||||
|
@ -44,6 +44,10 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
super(dialogConf, dialogOptions);
|
||||
|
||||
if ( actor.isTMRCache() ) {
|
||||
console.log("TMR cachées !!!!!!");
|
||||
}
|
||||
|
||||
this.tmrdata = duplicate(tmrData);
|
||||
this.actor = actor;
|
||||
this.actor.tmrApp = this; // reference this app in the actor structure
|
||||
@ -669,6 +673,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async validerVisite(tmr) {
|
||||
await EffetsDraconiques.pelerinage.onVisiteSupprimer(this.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr));
|
||||
await EffetsDraconiques.urgenceDraconique.onVisiteSupprimer(this.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr));
|
||||
@ -783,6 +788,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
await tmrObject._onClickTMRPos(eventPos); // Vérifier l'état des compteurs reve/fatigue/vie
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onClickTMRPos(eventPos) {
|
||||
let currentPos = TMRUtility.convertToCellPos(Misc.data(this.actor).data.reve.tmrpos.coord);
|
||||
|
||||
@ -862,6 +868,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async postRencontre(tmr) {
|
||||
if (!(this.viewOnly || this.currentRencontre)) {
|
||||
await this.manageCaseHumide(tmr);
|
||||
|
@ -445,6 +445,7 @@ export class TMRRencontres {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async postEchecPasseurFou(tmrDialog, tmrData) {
|
||||
if (tmrData.sortReserve) {
|
||||
await tmrDialog.processSortReserve(tmrData.sortReserve);
|
||||
@ -468,6 +469,7 @@ export class TMRRencontres {
|
||||
await data.actor.santeIncDec("vie", -1); // Et -1 PV
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async _toubillonner(tmrDialog, actor, cases) {
|
||||
let coord = Misc.templateData(actor).reve.tmrpos.coord;
|
||||
for (let i = 0; i < cases; i++) {
|
||||
@ -476,6 +478,7 @@ export class TMRRencontres {
|
||||
await tmrDialog.forceDemiRevePosition(coord)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async onPostSuccessReveDeDragon(tmrDialog, tmrData) {
|
||||
if (tmrData.rolled.isPart) {
|
||||
await tmrData.actor.appliquerExperience(tmrData.rolled, 'reve', tmrData.competence);
|
||||
@ -483,6 +486,7 @@ export class TMRRencontres {
|
||||
await tmrData.actor.resultCombatReveDeDragon(tmrData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async onPostEchecReveDeDragon(tmrDialog, tmrData) {
|
||||
await tmrData.actor.resultCombatReveDeDragon(tmrData);
|
||||
tmrDialog.close();
|
||||
|
@ -378,6 +378,7 @@ export class TMRUtility {
|
||||
return Misc.rollOneOf(tmrRandomMovePatten);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static deplaceTMRAleatoire(actor, coord) {
|
||||
return TMRUtility.deplaceTMRSelonPattern(actor, coord, TMRUtility.getDirectionPattern(), 1);
|
||||
}
|
||||
@ -465,12 +466,14 @@ export class TMRUtility {
|
||||
return caseList;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static distanceTMR(coord1, coord2) {
|
||||
let pos1 = this.convertToCellPos(coord1);
|
||||
let pos2 = this.convertToCellPos(coord2);
|
||||
return this.distancePosTMR(pos1, pos2);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static distancePosTMR(pos1, pos2) {
|
||||
const dx = pos2.x - pos1.x;
|
||||
const dy = pos2.y - pos1.y;
|
||||
|
@ -452,7 +452,8 @@
|
||||
},
|
||||
"tmrpos": {
|
||||
"coord": "A1",
|
||||
"label": "Position TMR"
|
||||
"label": "Position TMR",
|
||||
"cache": false
|
||||
},
|
||||
"reserve": {
|
||||
"list": []
|
||||
|
Loading…
Reference in New Issue
Block a user