#24 Ajouter le seuil de rêve

This commit is contained in:
Vincent Vandemeulebrouck 2020-11-16 03:52:34 +01:00
parent 8aaf7770dc
commit 09f68a5c7c
5 changed files with 31 additions and 2 deletions

View File

@ -333,6 +333,12 @@ export class RdDActorSheet extends ActorSheet {
reve.value = reveValue; reve.value = reveValue;
this.actor.update( { "data.reve.reve": reve } ); this.actor.update( { "data.reve.reve": reve } );
} ); } );
// On seuil de reve change
html.find('.seuil-reve-value').change((event) => {
console.log("seuil-reve-value", event.currentTarget)
this.actor.setPointsDeSeuil(event.currentTarget.value);
} );
// On competence change // On competence change
html.find('.competence-xp').change((event) => { html.find('.competence-xp').change((event) => {

View File

@ -552,7 +552,21 @@ export class RdDActor extends Actor {
reve.value = Math.max(reve.value + value, 0); reve.value = Math.max(reve.value + value, 0);
await this.update( {"data.reve.reve": reve } ); await this.update( {"data.reve.reve": reve } );
} }
async updatePointDeSeuil(value=1) {
const seuil = Misc.toInt(this.data.data.reve.seuil.value);
const reve = Misc.toInt(this.data.data.carac.reve.value);
if (seuil < reve) {
await this.setPointsDeSeuil(Math.min(seuil+value, reve));
}
}
async setPointsDeSeuil( value ) {
let seuil = duplicate(this.data.data.reve.seuil);
seuil.value = value;
await this.update( {"data.reve.seuil": seuil } );
}
/* -------------------------------------------- */ /* -------------------------------------------- */
testSiSonne( sante, endurance ) testSiSonne( sante, endurance )
{ {

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.48", "version": "0.9.49",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6", "compatibleCoreVersion": "0.7.6",
"templateVersion": 46, "templateVersion": 46,

View File

@ -395,6 +395,11 @@
"value": 0, "value": 0,
"label": "Points de Rêve actuels" "label": "Points de Rêve actuels"
}, },
"seuil": {
"max": 0,
"value": 0,
"label": "Seuil de Rêve"
},
"tmrpos": { "tmrpos": {
"coord": "A1", "coord": "A1",
"label": "Position TMR" "label": "Position TMR"

View File

@ -398,7 +398,11 @@
<ol class="item-list"> <ol class="item-list">
<li class="item flexrow"> <li class="item flexrow">
<span class="ptreve-actuel"><a>Points de Rêve actuels</a> :</span> <span class="ptreve-actuel"><a>Points de Rêve actuels</a> :</span>
<span><input class="pointsreve-value competence-value" type="text" name="data.reve.reve.value" value="{{data.reve.reve.value}}" data-dtype="Number"/></span> <span><input class="pointsreve-value" type="text" name="data.reve.reve.value" value="{{data.reve.reve.value}}" data-dtype="Number"/></span>
</li>
<li class="item flexrow">
<span class="seuil-reve"><a>Seuil de Rêve</a> :</span>
<span><input class="seuil-reve-value" type="text" name="data.reve.seuil.value" value="{{data.reve.seuil.value}}" data-dtype="Number"/></span>
</li> </li>
{{#if data.isGM}} {{#if data.isGM}}
<li class="item flexrow"> <li class="item flexrow">