Merge branch 'master' of gitlab.com:LeRatierBretonnien/foundryvtt-reve-de-dragon

This commit is contained in:
sladecraven 2020-11-14 21:34:40 +01:00
commit 360a2edf45
4 changed files with 58 additions and 21 deletions

View File

@ -275,15 +275,19 @@ export class RdDActorSheet extends ActorSheet {
let armeName = event.currentTarget.text;
this.actor.rollArme( armeName);
});
// Display TMR, normal
html.find('.visu-tmr a').click((event) => {
this.actor.displayTMR( "visu");
});
// Display TMR, normal
html.find('.monte-tmr a').click((event) => {
this.actor.displayTMR( false );
this.actor.displayTMR( "normal" );
});
// Display TMR, fast
html.find('.monte-tmr-rapide a').click((event) => {
this.actor.displayTMR( true );
this.actor.displayTMR( "rapide" );
});
// Display info about queue

View File

@ -748,7 +748,10 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
async displayTMR( isRapide=false )
async displayTMR(mode="normal" )
{
let isRapide= mode == "rapide"
if (mode != "visu")
{
let minReveValue = (isRapide) ? 3 : 2;
if (this.data.data.reve.reve.value <= minReveValue ) {
@ -756,6 +759,7 @@ export class RdDActor extends Actor {
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
return;
}
}
let data = {
fatigueHTML:"<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( this.data.data.sante.fatigue.value, this.data.data.sante.endurance.max ).html() + "</table>",
@ -766,7 +770,7 @@ export class RdDActor extends Actor {
isRapide: isRapide
}
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
this.currentTMR = new RdDTMRDialog(html, this, data );
this.currentTMR = new RdDTMRDialog(html, this, data, mode == "visu");
this.currentTMR.render(true);
}

View File

@ -19,7 +19,7 @@ const tmrConstants = {
export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
constructor(html, actor, tmrData) {
constructor(html, actor, tmrData, viewOnly) {
const dialogConf = {
title: "Terres Médianes de Rêve",
content: html,
@ -38,7 +38,8 @@ export class RdDTMRDialog extends Dialog {
this.tmrdata = duplicate(tmrData);
this.actor = actor;
this.nbFatigue = 1; // 1 premier point de fatigue du à la montée
this.viewOnly = viewOnly
this.nbFatigue = this.viewOnly ? 0 : 1; // 1 premier point de fatigue du à la montée
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list);
this.allTokens = []
@ -132,7 +133,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async manageRencontre(coordTMR, cellDescr) {
if (this.viewOnly) {
return;
}
this.currentRencontre = undefined;
let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR);
let deRencontre = new Roll("d7").roll();
@ -162,6 +165,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
performRoll(html) {
if (this.viewOnly) {
return;
}
this.actor.performRoll(this.rollData);
}
@ -193,6 +199,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async manageCaseHumide(cellDescr) {
if (this.viewOnly) {
return;
}
if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais") {
let draconic = this.actor.getBestDraconic();
@ -239,6 +248,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async declencheSortEnReserve(coordTMR) {
if (this.viewOnly) {
return;
}
let sortReserve = this.sortReserves.find(it => it.coord == coordTMR)
if (sortReserve != undefined) {
await this.actor.deleteSortReserve(sortReserve.coord);
@ -254,6 +266,9 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async deplacerDemiReve(event) {
if (this.viewOnly) {
return;
}
let origEvent = event.data.originalEvent;
let myself = event.target.tmrObject;
@ -293,10 +308,16 @@ export class RdDTMRDialog extends Dialog {
var cell1 = row.insertCell(1);
cell1.append(this.pixiApp.view);
if (this.viewOnly) {
html.find('#lancer-sort').remove();
}
else {
// Roll Sort
html.find('#lancer-sort').click((event) => {
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
});
}
// load the texture we need
await this.pixiApp.loader
@ -317,7 +338,9 @@ export class RdDTMRDialog extends Dialog {
mytmr.interactive = true;
mytmr.buttonMode = true;
mytmr.tmrObject = this;
if (!this.viewOnly) {
mytmr.on('pointerdown', this.deplacerDemiReve);
}
this.pixiApp.stage.addChild(mytmr);
this._addDemiReve();
@ -325,6 +348,9 @@ export class RdDTMRDialog extends Dialog {
this.displaySortReserve();
});
if (this.viewOnly) {
return;
}
await this.actor.updatePointsDeReve((this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
this.updateValuesDisplay();
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);

View File

@ -385,11 +385,14 @@
{{!-- hautreve Tab --}}
<div class="tab hautreve" data-group="primary" data-tab="hautreve" style="height:200px">
<div>
<span class="visu-tmr"><strong><a>Regarder les Terres Medianes</a></strong></span>
</div>
<div>
<span class="monte-tmr"><strong><a>Monter Normale dans les Terres Medianes !</a></strong></span>
</div>
<div>
<span class="monte-tmr-rapide"><strong><a>Monter Accélérée dans les Terres Medianes !</a></strong></span>
<span class="monte-tmr-rapide"><strong><a>Monter en Accéléré dans les Terres Medianes !</a></strong></span>
</div>
<div>
<ol class="item-list">