diff --git a/icons/creatures/grincette.svg b/icons/creatures/grincette.svg
index bdca7dd3..892cfcbd 100644
--- a/icons/creatures/grincette.svg
+++ b/icons/creatures/grincette.svg
@@ -44,16 +44,17 @@
units="mm"
inkscape:zoom="4.4272867"
inkscape:cx="163.04016"
- inkscape:cy="208.47984"
+ inkscape:cy="181.3752"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
- inkscape:current-layer="svg878" />
+ inkscape:current-layer="svg878"
+ inkscape:document-rotation="0" />
diff --git a/icons/creatures/oiseau-oracle.svg b/icons/creatures/oiseau-oracle.svg
index bdadad77..b9682a02 100644
--- a/icons/creatures/oiseau-oracle.svg
+++ b/icons/creatures/oiseau-oracle.svg
@@ -48,12 +48,13 @@
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
- inkscape:current-layer="svg852" />
+ inkscape:current-layer="svg852"
+ inkscape:document-rotation="0" />
diff --git a/icons/creatures/rananevre.svg b/icons/creatures/rananevre.svg
index 9268a36a..88f18690 100644
--- a/icons/creatures/rananevre.svg
+++ b/icons/creatures/rananevre.svg
@@ -42,18 +42,19 @@
id="namedview5"
showgrid="false"
units="mm"
- inkscape:zoom="1.1433761"
- inkscape:cx="285.44016"
+ inkscape:zoom="1"
+ inkscape:cx="30.93073"
inkscape:cy="440.79982"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
- inkscape:current-layer="svg3" />
+ inkscape:current-layer="svg3"
+ inkscape:document-rotation="0" />
diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index 12f5330b..81e7f4f1 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -336,11 +336,11 @@ export class RdDActorSheet extends ActorSheet {
this.render(true);
});
html.find('#ptreve-actuel-plus').click((event) => {
- this.actor.updatePointsDeReve(1);
+ this.actor.reveActuelIncDec(1);
this.render(true);
});
html.find('#ptreve-actuel-moins').click((event) => {
- this.actor.updatePointsDeReve(-1);
+ this.actor.reveActuelIncDec(-1);
this.render(true);
});
html.find('#fatigue-plus').click((event) => {
diff --git a/module/actor.js b/module/actor.js
index 73f8ef0d..ae6825a2 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -220,7 +220,7 @@ export class RdDActor extends Actor {
// Sort management
if (rollData.selectedSort) { // Lancement de sort !
- resumeCompetence = rollData.selectedDraconic.name + "/" + sort.name;
+ resumeCompetence = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name;
explications = await this._rollLancementDeSort(rollData, rolled);
}
@@ -284,10 +284,10 @@ export class RdDActor extends Actor {
let sort = duplicate(rollData.selectedSort);
let closeTMR = true;
- let coutReve = sort.data.ptreve_reel || sort.data.ptreve; // cas de sort à ptreve variables
+ let coutReve = sort.data.ptreve_reel; // toujours positionné par cas de sort à ptreve variables
let explications = "
Lancement du sort " + sort.name + " : " + Misc.upperFirst(sort.data.draconic)
- + " pour "+coutReve+ " points de Rêve"
+ + " pour " + coutReve + " points de Rêve"
+ "
Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
let myReve = duplicate(this.data.data.reve.reve);
diff --git a/module/item-sort.js b/module/item-sort.js
new file mode 100644
index 00000000..b03de5f9
--- /dev/null
+++ b/module/item-sort.js
@@ -0,0 +1,25 @@
+import { Misc } from "./misc.js";
+
+export class RdDItemSort extends Item {
+
+ static isDifficulteVariable(sort) {
+ return sort && (sort.data.difficulte.toLowerCase() == "variable");
+ }
+ static isCoutVariable(sort) {
+ return sort && (sort.data.ptreve.toLowerCase() == "variable" || sort.data.ptreve.indexOf("+") >= 0);
+ }
+
+ static setCoutReveReel(sort){
+ if (sort) {
+ sort.data.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.data.ptreve;
+ }
+ }
+
+ static getDifficulte(sort, variable) {
+ if (sort && !RdDItemSort.isDifficulteVariable(sort)) {
+ return Misc.toInt(sort.data.difficulte);
+ }
+ return variable;
+ }
+
+}
\ No newline at end of file
diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js
index 057d60db..0f085d89 100644
--- a/module/rdd-roll-dialog.js
+++ b/module/rdd-roll-dialog.js
@@ -1,3 +1,4 @@
+import { RdDItemSort } from "./item-sort.js";
import { Misc } from "./misc.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
@@ -72,12 +73,12 @@ export class RdDRollDialog extends Dialog {
// Sort management
if ( rollData.selectedSort ) {
//console.log("Toggle show/hide", rollData.selectedSort);
- if (rollData.selectedSort.data.difficulte.toLowerCase() == "variable") {
+ if (RdDItemSort.isDifficulteVariable(rollData.selectedSort)) {
$("#div-sort-difficulte").show();
} else {
$("#div-sort-difficulte").hide();
}
- if (rollData.selectedSort.data.ptreve.toLowerCase() == "variable" || rollData.selectedSort.data.ptreve.indexOf("+")>=0) {
+ if (RdDItemSort.isCoutVariable(rollData.selectedSort)) {
$("#div-sort-ptreve").show();
} else {
$("#div-sort-ptreve").hide();
@@ -88,6 +89,7 @@ export class RdDRollDialog extends Dialog {
$("#compdialogTitle").text(RdDRollDialog._getTitle(rollData));
$(".table-resolution").remove();
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
+
}
// Setup everything onload
@@ -99,9 +101,7 @@ export class RdDRollDialog extends Dialog {
rollData.selectedCarac = rollData.carac[rollData.competence.data.defaut_carac];
$("#carac").val(rollData.competence.data.defaut_carac);
}
- // Si sort, for les points de reve à 1
- if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel)
- rollData.selectedSort.data.ptreve_reel = 1;
+ RdDItemSort.setCoutReveReel(rollData.selectedSort);
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
$("#diffConditions").val(Misc.toInt(rollData.diffConditions));
updateRollResult(rollData);
@@ -133,12 +133,13 @@ export class RdDRollDialog extends Dialog {
html.find('#sort').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
+ RdDItemSort.setCoutReveReel(rollData.selectedSort);
//console.log("RdDRollDialog - Sort selection", rollData.selectedSort);
updateRollResult(rollData);
});
html.find('#ptreve-variable').change((event) => {
let ptreve = Misc.toInt(event.currentTarget.value);
- this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
+ this.rollData.selectedSort.data.ptreve_reel = ptreve;
console.log("RdDRollDialog - Cout reve", ptreve);
updateRollResult(rollData);
});
@@ -149,17 +150,18 @@ export class RdDRollDialog extends Dialog {
/* -------------------------------------------- */
static _computeFinalLevel(rollData) {
- let etat = Misc.toInt(rollData.etat);
- const diffLibre = Misc.toInt(rollData.diffLibre);
+ const etat = Misc.toInt(rollData.etat);
const diffConditions = Misc.toInt(rollData.diffConditions);
+ let diffLibre = Misc.toInt(rollData.diffLibre);
+ let diffCompetence = 0;
if (rollData.competence) {
- return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions;
+ diffCompetence = Misc.toInt(rollData.competence.data.niveau);
}
- if (rollData.draconicList) {
- let diffSort = (rollData.selectedSort.data.difficulte.toLowerCase() == "variable") ? diffLibre : Misc.toInt(rollData.selectedSort.data.difficulte);
- return etat + Misc.toInt(rollData.selectedDraconic.data.niveau) + diffSort + diffConditions;
+ else if (rollData.draconicList) {
+ diffCompetence = Misc.toInt(rollData.selectedDraconic.data.niveau);
+ diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre);
}
- return etat + diffLibre + diffConditions;
+ return etat + diffCompetence + diffLibre + diffConditions;
}
/* -------------------------------------------- */
diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js
index 8d7e530b..6a0bc2aa 100644
--- a/module/rdd-tmr-dialog.js
+++ b/module/rdd-tmr-dialog.js
@@ -124,7 +124,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async gererTourbillon( value ) {
this.nbFatigue += value;
- await this.actor.updatePointsDeReve( -value );
+ await this.actor.reveActuelIncDec( -value );
if ( !this.currentRencontre.tourbillonDirection ) {
this.currentRencontre.tourbillonDirection = TMRUtility.getDirectionPattern();
}
@@ -512,7 +512,7 @@ export class RdDTMRDialog extends Dialog {
if (this.viewOnly) {
return;
}
- await this.actor.updatePointsDeReve((this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
+ await this.actor.reveActuelIncDec((this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
this.updateValuesDisplay();
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
await this.manageRencontre(this.actor.data.data.reve.tmrpos.coord, cellDescr);
diff --git a/module/tmr-utility.js b/module/tmr-utility.js
index 7cc41387..f2c86855 100644
--- a/module/tmr-utility.js
+++ b/module/tmr-utility.js
@@ -429,7 +429,7 @@ export class TMRUtility {
state = "passeur";
} else if (rencontre.name == "Fleur des Rêves") {
- await actor.updatePointsDeReve( rencontre.force );
+ await actor.reveActuelIncDec( rencontre.force );
msg += "La Fleur des rêves s'évanouit en vous fournissant " + rencontre.force + " Points de Rêve";
} else if (rencontre.name == "Mangeur de Rêve") {
@@ -474,7 +474,7 @@ export class TMRUtility {
msg += "La Fleur des rêves s'éloigne de vous et se perd dans les Terres Médianes";
} else if (rencontre.name == "Mangeur de Rêve") {
- await actor.updatePointsDeReve( -rencontre.force );
+ await actor.reveActuelIncDec( -rencontre.force );
msg += "Ce Mangeur des Rêves croque votre Rêve ! Vous perdez " + rencontre.force + " points de rêve actuels, votre nouveau total est de " + actor.data.data.reve.reve.value;
} else if (rencontre.name == "Changeur de Rêve") {