#27 Gestion des rencontres
This commit is contained in:
parent
7ff428d1c2
commit
34acf9e00c
@ -768,7 +768,7 @@ export class RdDActor extends Actor {
|
||||
async santeIncDec(name, inc ) {
|
||||
const sante = duplicate(this.data.data.sante);
|
||||
let data = sante[name];
|
||||
let minValue = name == "vie" ? - this.data.data.attributs.sconst : 0;
|
||||
let minValue = name == "vie" ? Number(-this.data.data.attributs.sconst.value) : 0;
|
||||
let newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
|
||||
|
||||
if (name == "endurance" && this.data.type != 'entite' ) {
|
||||
@ -789,7 +789,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
data.value = newValue;
|
||||
//console.log(name, inc, data.value);
|
||||
//console.log(name, inc, data.value, newValue, minValue, data.max);
|
||||
if ( sante.fatigue) { // If endurance lost, then the same amount of fatigue cannot be recovered
|
||||
sante.fatigue.value = Math.max(sante.fatigue.value, this._computeFatigueMin());
|
||||
}
|
||||
@ -798,10 +798,12 @@ export class RdDActor extends Actor {
|
||||
await this.update( {"data.sante": sante } );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeFatigueMin() {
|
||||
return this.data.data.sante.endurance.max - this.data.data.sante.endurance.value;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeEnduranceMax() {
|
||||
let blessures = this.data.data.blessures;
|
||||
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
||||
|
@ -25,7 +25,7 @@ export class RdDRollDialog extends Dialog {
|
||||
|
||||
// Common conf
|
||||
let dialogConf = { content: html, title: "Test", buttons: myButtons, default: "rollButton" }
|
||||
let dialogOptions = { classes: ["rdddialog"], width: 600, height: 400, 'z-index': 30 }
|
||||
let dialogOptions = { classes: ["rdddialog"], width: 600, height: 400, 'z-index': 99999 }
|
||||
|
||||
// Select proper roll dialog template and stuff
|
||||
if (mode == "competence") {
|
||||
@ -39,7 +39,7 @@ export class RdDRollDialog extends Dialog {
|
||||
dialogOptions.height = 350
|
||||
} else if (mode == "sort") {
|
||||
dialogConf.title = "Lancer un sort"
|
||||
dialogConf.height = 470
|
||||
dialogConf.height = 490
|
||||
}
|
||||
super(dialogConf, dialogOptions)
|
||||
|
||||
@ -57,7 +57,8 @@ export class RdDRollDialog extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
|
||||
this.bringToTop(); // Ensure top level
|
||||
// Get the rollData stuff
|
||||
var rollData = this.rollData;
|
||||
|
||||
|
@ -201,7 +201,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||
}
|
||||
}
|
||||
//rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||
if ( TMRUtility.isForceRencontre() )
|
||||
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||
|
||||
if (rencontre) { // Manages it
|
||||
if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres
|
||||
@ -232,21 +233,20 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
updateValuesDisplay() {
|
||||
let ptsreve = document.getElementById("pointsreve-value");
|
||||
let ptsreve = document.getElementById("tmr-pointsreve-value");
|
||||
ptsreve.innerHTML = this.actor.data.data.reve.reve.value;
|
||||
|
||||
let tmrpos = document.getElementById("tmr-pos");
|
||||
let tmr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
|
||||
//console.log("updateValuesDisplay", this.actor.data.data.reve.tmrpos, tmr);
|
||||
tmrpos.innerHTML = this.actor.data.data.reve.tmrpos.coord + " (" + tmr.label + ")";
|
||||
|
||||
let etat = document.getElementById("etatgeneral-value");
|
||||
let etat = document.getElementById("tmr-etatgeneral-value");
|
||||
etat.innerHTML = this.actor.data.data.compteurs.etat.value;
|
||||
|
||||
let refoulement = document.getElementById("refoulement-value");
|
||||
let refoulement = document.getElementById("tmr-refoulement-value");
|
||||
refoulement.innerHTML = this.actor.data.data.reve.refoulement.value;
|
||||
|
||||
let fatigueItem = document.getElementById("fatigue-table");
|
||||
let fatigueItem = document.getElementById("tmr-fatigue-table");
|
||||
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max).html() + "</table>";
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,20 @@ export class TMRUtility {
|
||||
return TMRMapping[coordTMR];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** Some debug functions */
|
||||
static setForceRencontre( id, force ) {
|
||||
this.forceRencontre = { id: id, force: force}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static clearForceRencontre( id, force ) {
|
||||
this.forceRencontre = undefined
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isForceRencontre() {
|
||||
return this.forceRencontre
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rencontreTMRRoll( coordTMR, cellDescr )
|
||||
{
|
||||
@ -275,10 +289,12 @@ export class TMRUtility {
|
||||
rencontre.force = this.evaluerForceRencontre(rencontre);
|
||||
rencontre.coord = coordTMR;
|
||||
}
|
||||
// Forced
|
||||
//rencontre = rencontresTable[0];
|
||||
//rencontre.force = 2;
|
||||
//rencontre.coord = coordTMR;
|
||||
if ( this.forceRencontre ) {
|
||||
// Forced
|
||||
rencontre = rencontresTable[this.forceRencontre.id];
|
||||
rencontre.force = this.forceRencontre.force;
|
||||
rencontre.coord = coordTMR;
|
||||
}
|
||||
|
||||
return rencontre;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@
|
||||
.rdddialog {
|
||||
width: 600px;
|
||||
height: 430px;
|
||||
z-index: 100;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.table-resolution-carac {
|
||||
|
@ -1,10 +1,9 @@
|
||||
<form class="dialog-roll-sort">
|
||||
<h2 class="compdialog" id="sort-dialog"></h2>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="categorie">Rêve : {{selectedCarac.value}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="categorie">TMR : {{coord}} - {{coordLabel}}
|
||||
<label for="categorie">Rêve : {{selectedCarac.value}}</label>
|
||||
<label for="categorie">TMR : {{coord}} - {{coordLabel}}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -12,20 +12,20 @@
|
||||
<label>Carac. Rêve : </label><label>{{caracReve}}</label>
|
||||
</div>
|
||||
<div class="flex-group-center">
|
||||
Rêve Actuel : <span id="pointsreve-value">0</span>
|
||||
<label>Rêve Actuel : </label><span id="tmr-pointsreve-value">0</span>
|
||||
</div>
|
||||
<div class="flex-group-center">
|
||||
Coordonnées : <span id="tmr-pos">0</span>
|
||||
<label>Coordonnées : </label><span id="tmr-pos">0</span>
|
||||
</div>
|
||||
<div class="flex-group-center">
|
||||
Etat général : <span id="etatgeneral-value">0</span>
|
||||
<label>Etat général : </label><span id="tmr-etatgeneral-value">0</span>
|
||||
</div>
|
||||
<div class="flex-group-center">
|
||||
Refoulement : <span id="refoulement-value">0</span>
|
||||
<label>Refoulement : </label><span id="tmr-refoulement-value">0</span>
|
||||
</div>
|
||||
<div class="flex-group-center flex-actions-bar">
|
||||
Fatigue
|
||||
<span id="fatigue-table">{{{fatigue.html}}}</span>
|
||||
<span id="tmr-fatigue-table">{{{fatigue.html}}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user