Merge branch 'working' into 'master'
Regarder les TMR See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!16
This commit is contained in:
commit
183718638d
@ -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
|
||||
|
@ -744,14 +744,18 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayTMR( isRapide=false )
|
||||
async displayTMR(mode="normal" )
|
||||
{
|
||||
let minReveValue = (isRapide) ? 3 : 2;
|
||||
if (this.data.data.reve.reve.value <= minReveValue ) {
|
||||
ChatMessage.create( { title: "Montée impossible !", content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes",
|
||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
||||
return;
|
||||
}
|
||||
let isRapide= mode == "rapide"
|
||||
if (mode != "visu")
|
||||
{
|
||||
let minReveValue = (isRapide) ? 3 : 2;
|
||||
if (this.data.data.reve.reve.value <= minReveValue ) {
|
||||
ChatMessage.create( { title: "Montée impossible !", content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes",
|
||||
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>",
|
||||
@ -762,7 +766,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
// Roll Sort
|
||||
html.find('#lancer-sort').click((event) => {
|
||||
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
||||
});
|
||||
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;
|
||||
mytmr.on('pointerdown', this.deplacerDemiReve);
|
||||
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);
|
||||
@ -371,7 +397,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
x: 16 - (tmrConstants.cellw / 2),
|
||||
y: 16 - (tmrConstants.cellh / 2)
|
||||
}
|
||||
return { sprite: sprite, sort: sort, coordTMR: () => sort.coord}
|
||||
return { sprite: sprite, sort: sort, coordTMR: () => sort.coord }
|
||||
}
|
||||
|
||||
_tokenDemiReve() {
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user