Merge branch 'working' into 'master'
#14 Séparer difficulté libre et ajustement de conditions See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!17
This commit is contained in:
commit
559e0b687e
@ -110,7 +110,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
data.data.competenceByCategory = data.competenceByCategory;
|
data.data.competenceByCategory = data.competenceByCategory;
|
||||||
data.data.encombrementTotal = this.actor.encombrementTotal;
|
data.data.encombrementTotal = this.actor.encombrementTotal;
|
||||||
data.data.isGM = game.user.isGM;
|
data.data.isGM = game.user.isGM;
|
||||||
data.bonusmalusTable = CONFIG.RDD.bonusmalus;
|
data.ajustementsConditions = CONFIG.RDD.ajustementsConditions;
|
||||||
|
data.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||||
|
|
||||||
// low is normal, this the base used to compute the grid.
|
// low is normal, this the base used to compute the grid.
|
||||||
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";
|
||||||
@ -156,7 +157,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async displayDialogEncaisser( ) {
|
async displayDialogEncaisser( ) {
|
||||||
let data = { bonusmalusTable: CONFIG.RDD.bonusmalus };
|
let data = { ajustementsConditions: CONFIG.RDD.ajustementsConditions /* techniquement on peut encaisser à +20 */ };
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
||||||
new RdDEncaisser(html, this.actor ).render(true);
|
new RdDEncaisser(html, this.actor ).render(true);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ export class RdDActor extends Actor {
|
|||||||
let attCategory = RdDUtility.getArmeCategory(rollData.attackerRoll.arme);
|
let attCategory = RdDUtility.getArmeCategory(rollData.attackerRoll.arme);
|
||||||
let defCategory = RdDUtility.getArmeCategory(rollData.arme);
|
let defCategory = RdDUtility.getArmeCategory(rollData.arme);
|
||||||
if (defCategory == "bouclier")
|
if (defCategory == "bouclier")
|
||||||
rollData.needSignificative = true;
|
rollData.needSignificative = false;
|
||||||
else if (attCategory != defCategory)
|
else if (attCategory != defCategory)
|
||||||
rollData.needSignificative = true;
|
rollData.needSignificative = true;
|
||||||
if (attCategory.match("epee") && (defCategory == "hache" || defCategory == "lance"))
|
if (attCategory.match("epee") && (defCategory == "hache" || defCategory == "lance"))
|
||||||
@ -166,8 +166,8 @@ export class RdDActor extends Actor {
|
|||||||
console.log(">>> ROLL", rollData, rolled);
|
console.log(">>> ROLL", rollData, rolled);
|
||||||
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
|
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
|
||||||
|
|
||||||
let resumeCompetence = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
|
let resumeCompetence = (rollData.competence) ? rollData.competence.name : (rollData.diffLibre + rollData.diffConditions);
|
||||||
let explications = "<br>Points de taches : " + rolled.tache + ", Points de qualité: " + rolled.qualite;
|
let explications = "<br>Points de taches : " + rolled.ptTache + ", ajustement qualité: " + rolled.ptQualite;
|
||||||
|
|
||||||
// Fight management !
|
// Fight management !
|
||||||
let defenseMsg;
|
let defenseMsg;
|
||||||
@ -217,7 +217,8 @@ export class RdDActor extends Actor {
|
|||||||
// Final chat message
|
// Final chat message
|
||||||
let chatOptions = {
|
let chatOptions = {
|
||||||
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + resumeCompetence + "</strong>"
|
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + resumeCompetence + "</strong>"
|
||||||
+ "<br>Jet : " + rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rolled.score + "%<br><strong>Résutat : </strong>" + rolled.roll
|
+ "<br>Difficultés <strong>libre : " + rollData.diffLibre + "</strong> / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
|
||||||
|
+ "<br>Jet : " + rolled.roll + " sur "+ rolled.score + "% (" + rollData.selectedCarac.value + " à " +Misc.toSignedString(rollData.finalLevel) + ")"
|
||||||
+ "<br><strong>" + quality + "</strong>"
|
+ "<br><strong>" + quality + "</strong>"
|
||||||
+ explications + xpmsg,
|
+ explications + xpmsg,
|
||||||
user: game.user._id,
|
user: game.user._id,
|
||||||
@ -264,7 +265,7 @@ export class RdDActor extends Actor {
|
|||||||
let closeTMR = true;
|
let closeTMR = true;
|
||||||
let coutReve = sort.data.ptreve_reel || sort.data.ptreve; // cas de sort à ptreve variables
|
let coutReve = sort.data.ptreve_reel || sort.data.ptreve; // cas de sort à ptreve variables
|
||||||
|
|
||||||
let explications = "<br>Lancement du sort <strong>" + sort.name + "</strong> : " + Misc._upperFirst(sort.data.draconic)
|
let explications = "<br>Lancement du sort <strong>" + sort.name + "</strong> : " + Misc.upperFirst(sort.data.draconic)
|
||||||
+ " pour "+coutReve+ " points de Rêve"
|
+ " pour "+coutReve+ " points de Rêve"
|
||||||
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
|
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
|
||||||
|
|
||||||
@ -694,7 +695,7 @@ export class RdDActor extends Actor {
|
|||||||
case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll }
|
case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll }
|
||||||
}
|
}
|
||||||
let second = RdDResolutionTable.rollChances(target)
|
let second = RdDResolutionTable.rollChances(target)
|
||||||
switch (second.qualite) {
|
switch (second.quality) {
|
||||||
case "part": case "sign":
|
case "part": case "sign":
|
||||||
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
||||||
default:
|
default:
|
||||||
@ -716,9 +717,11 @@ export class RdDActor extends Actor {
|
|||||||
selectedSort: sortList[0],
|
selectedSort: sortList[0],
|
||||||
coord: coord,
|
coord: coord,
|
||||||
finalLevel: 0,
|
finalLevel: 0,
|
||||||
bmValue: sortList[0].data.difficulte, // Per default at startup
|
diffConditions: 0,
|
||||||
|
diffLibre: sortList[0].data.difficulte, // Per default at startup
|
||||||
coutreve: Array(20).fill().map((item, index) => 1 + index),
|
coutreve: Array(20).fill().map((item, index) => 1 + index),
|
||||||
bonusmalusTable: CONFIG.RDD.bonusmalus
|
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||||
|
difficultesLibres: CONFIG.RDD.difficultesLibres
|
||||||
}
|
}
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData);
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData);
|
||||||
new RdDRollDialog("sort", html, rollData, this ).render(true);
|
new RdDRollDialog("sort", html, rollData, this ).render(true);
|
||||||
@ -729,10 +732,12 @@ export class RdDActor extends Actor {
|
|||||||
{
|
{
|
||||||
let rollData = {
|
let rollData = {
|
||||||
selectedCarac: this.data.data.carac[caracName],
|
selectedCarac: this.data.data.carac[caracName],
|
||||||
bonusmalusTable: CONFIG.RDD.bonusmalus,
|
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||||
|
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||||
etat: this.data.data.compteurs.etat.value,
|
etat: this.data.data.compteurs.etat.value,
|
||||||
finalLevel: 0,
|
finalLevel: 0,
|
||||||
bmValue: 0
|
diffConditions: 0,
|
||||||
|
diffLibre: 0
|
||||||
}
|
}
|
||||||
console.log(caracName, rollData);
|
console.log(caracName, rollData);
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
|
||||||
@ -793,9 +798,11 @@ export class RdDActor extends Actor {
|
|||||||
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
||||||
// Common rollData values
|
// Common rollData values
|
||||||
let rollData = {
|
let rollData = {
|
||||||
bonusmalusTable: CONFIG.RDD.bonusmalus,
|
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||||
|
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||||
etat: this.data.data.compteurs.etat.value,
|
etat: this.data.data.compteurs.etat.value,
|
||||||
bmValue: (attackerRoll) ? attackerRoll.bmValue : 0,
|
diffConditions: 0,
|
||||||
|
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll,
|
||||||
finalLevel: 0
|
finalLevel: 0
|
||||||
}
|
}
|
||||||
@ -894,7 +901,7 @@ export class RdDActor extends Actor {
|
|||||||
parerAttaque( attackerRoll, armeId )
|
parerAttaque( attackerRoll, armeId )
|
||||||
{
|
{
|
||||||
let armeItem = this.getOwnedItem(armeId); // Item.data.data !
|
let armeItem = this.getOwnedItem(armeId); // Item.data.data !
|
||||||
console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.bmValue);
|
console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre);
|
||||||
this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll );
|
this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,25 @@
|
|||||||
* to actual classes of the game system or of FoundryVTT
|
* to actual classes of the game system or of FoundryVTT
|
||||||
*/
|
*/
|
||||||
export class Misc {
|
export class Misc {
|
||||||
static _upperFirst(text) {
|
static upperFirst(text) {
|
||||||
return text.charAt(0).toUpperCase() + text.slice(1);
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
||||||
}
|
}
|
||||||
|
static toSignedString(number){
|
||||||
|
const value = parseInt(number)
|
||||||
|
const isPositiveNumber = value != NaN && value > 0;
|
||||||
|
return isPositiveNumber ? "+"+number : number
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts the value to an integer, or to 0 if undefined/null/not representing integer
|
||||||
|
* @param {*} value value to convert to an integer using parseInt
|
||||||
|
*/
|
||||||
|
static toInt(value)
|
||||||
|
{
|
||||||
|
if (value == undefined)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const parsed = parseInt(value);
|
||||||
|
return isNaN(parsed) ? 0 : parsed;
|
||||||
|
}
|
||||||
}
|
}
|
@ -122,7 +122,9 @@ Hooks.once("init", async function() {
|
|||||||
resolutionTable : RdDResolutionTable.resolutionTable,
|
resolutionTable : RdDResolutionTable.resolutionTable,
|
||||||
level_category : RdDUtility.getLevelCategory(),
|
level_category : RdDUtility.getLevelCategory(),
|
||||||
carac_array : RdDUtility.getCaracArray(),
|
carac_array : RdDUtility.getCaracArray(),
|
||||||
bonusmalus : RdDUtility.getBonusMalus()
|
ajustementsConditions : RdDUtility.getAjustementsConditions(),
|
||||||
|
difficultesLibres : RdDUtility.getDifficultesLibres()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register sheet application classes
|
// Register sheet application classes
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Misc } from "./misc.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* difficultés au delà de -10
|
* difficultés au delà de -10
|
||||||
@ -40,13 +41,13 @@ const specialResults = [
|
|||||||
|
|
||||||
|
|
||||||
const reussites = [
|
const reussites = [
|
||||||
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, tache: -4, qualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
|
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
|
||||||
{ code: "epart", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: false, tache: -2, qualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) },
|
{ code: "epart", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: false, ptTache: -2, ptQualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) },
|
||||||
{ code: "echec", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: false, isETotal: false, tache: 0, qualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.score && roll < target.etotal) },
|
{ code: "echec", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: false, isETotal: false, ptTache: 0, ptQualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.score && roll < target.etotal) },
|
||||||
{ code: "norm", isPart: false, isSign: false, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 1, qualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.score) },
|
{ code: "norm", isPart: false, isSign: false, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 1, ptQualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.score) },
|
||||||
{ code: "sign", isPart: false, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 2, qualite: 1, quality: "Réussite significative", condition: (target, roll) => (roll > target.part && roll <= target.sign) },
|
{ code: "sign", isPart: false, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 2, ptQualite: 1, quality: "Réussite significative", condition: (target, roll) => (roll > target.part && roll <= target.sign) },
|
||||||
{ code: "part", isPart: true, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 3, qualite: 2, quality: "Réussite Particulière!", condition: (target, roll) => (roll > 0 && roll <= target.part) },
|
{ code: "part", isPart: true, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 3, ptQualite: 2, quality: "Réussite Particulière!", condition: (target, roll) => (roll > 0 && roll <= target.part) },
|
||||||
{ code: "error", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, tache: 0, qualite: 0, quality: "Jet de dés invalide", condition: (target, roll) => (roll <= 0 || roll > 100) }
|
{ code: "error", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: 0, ptQualite: 0, quality: "Jet de dés invalide", condition: (target, roll) => (roll <= 0 || roll > 100) }
|
||||||
];
|
];
|
||||||
|
|
||||||
const reussiteSignificative = reussites.find(r => r.code == "sign");
|
const reussiteSignificative = reussites.find(r => r.code == "sign");
|
||||||
@ -196,9 +197,7 @@ export class RdDResolutionTable {
|
|||||||
tr.append($("<th class='table-resolution-level'/>").text("..."));
|
tr.append($("<th class='table-resolution-level'/>").text("..."));
|
||||||
}
|
}
|
||||||
for (let difficulte = minLevel; difficulte <= maxLevel; difficulte++) {
|
for (let difficulte = minLevel; difficulte <= maxLevel; difficulte++) {
|
||||||
const niveau = dataRow[difficulte + 10].niveau;
|
tr.append($("<th class='table-resolution-level'/>").text(Misc.toSignedString(difficulte)));
|
||||||
const txt = (niveau > 0 ? "+" : "") + niveau;
|
|
||||||
tr.append($("<th class='table-resolution-level'/>").text(txt));
|
|
||||||
}
|
}
|
||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Misc } from "./misc.js";
|
||||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +39,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
dialogOptions.height = 350
|
dialogOptions.height = 350
|
||||||
} else if (mode == "sort") {
|
} else if (mode == "sort") {
|
||||||
dialogConf.title = "Lancer un sort"
|
dialogConf.title = "Lancer un sort"
|
||||||
dialogConf.height = 450
|
dialogConf.height = 470
|
||||||
}
|
}
|
||||||
super(dialogConf, dialogOptions)
|
super(dialogConf, dialogOptions)
|
||||||
|
|
||||||
@ -65,7 +66,6 @@ export class RdDRollDialog extends Dialog {
|
|||||||
let rollLevel = RdDRollDialog._computeFinalLevel(rollData);
|
let rollLevel = RdDRollDialog._computeFinalLevel(rollData);
|
||||||
|
|
||||||
rollData.finalLevel = rollLevel;
|
rollData.finalLevel = rollLevel;
|
||||||
rollData.finalLevelStr = (rollLevel > 0 ? "+" : "") + rollLevel;
|
|
||||||
rollData.rollTarget = RdDResolutionTable.computeChances(rollData.selectedCarac.value, rollData.finalLevel);
|
rollData.rollTarget = RdDResolutionTable.computeChances(rollData.selectedCarac.value, rollData.finalLevel);
|
||||||
|
|
||||||
// Sort management
|
// Sort management
|
||||||
@ -83,7 +83,7 @@ export class RdDRollDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#roll-param").text(rollData.selectedCarac.value + " / " + rollData.finalLevelStr);
|
$("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel));
|
||||||
$("#compdialogTitle").text(RdDRollDialog._getTitle(rollData));
|
$("#compdialogTitle").text(RdDRollDialog._getTitle(rollData));
|
||||||
$(".table-resolution").remove();
|
$(".table-resolution").remove();
|
||||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
|
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
|
||||||
@ -101,36 +101,42 @@ export class RdDRollDialog extends Dialog {
|
|||||||
// Si sort, for les points de reve à 1
|
// Si sort, for les points de reve à 1
|
||||||
if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel)
|
if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel)
|
||||||
rollData.selectedSort.data.ptreve_reel = 1;
|
rollData.selectedSort.data.ptreve_reel = 1;
|
||||||
$("#bonusmalus").val(rollData.bmValue);
|
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||||
|
$("#diffConditions").val(Misc.toInt(rollData.diffConditions));
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update !
|
// Update !
|
||||||
html.find('#bonusmalus').click((event) => {
|
html.find('#diffLibre').change((event) => {
|
||||||
rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus
|
rollData.diffLibre = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
|
||||||
//console.log("RdDRollDialog","BM CLICKED !!!", rollData);
|
//console.log("RdDRollDialog","BM CLICKED !!!", rollData);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
});
|
});
|
||||||
html.find('#carac').click((event) => {
|
html.find('#diffConditions').change((event) => {
|
||||||
|
rollData.diffConditions = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
|
||||||
|
//console.log("RdDRollDialog","BM CLICKED !!!", rollData);
|
||||||
|
updateRollResult(rollData);
|
||||||
|
});
|
||||||
|
html.find('#carac').change((event) => {
|
||||||
let caracKey = event.currentTarget.value;
|
let caracKey = event.currentTarget.value;
|
||||||
this.rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
|
this.rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
|
||||||
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
});
|
});
|
||||||
html.find('#draconic').click((event) => {
|
html.find('#draconic').change((event) => {
|
||||||
let draconicKey = Number(event.currentTarget.value);
|
let draconicKey = Misc.toInt(event.currentTarget.value);
|
||||||
this.rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac
|
this.rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac
|
||||||
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
});
|
});
|
||||||
html.find('#sort').click((event) => {
|
html.find('#sort').change((event) => {
|
||||||
let sortKey = Number(event.currentTarget.value);
|
let sortKey = Misc.toInt(event.currentTarget.value);
|
||||||
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
|
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
|
||||||
//console.log("RdDRollDialog - Sort selection", rollData.selectedSort);
|
//console.log("RdDRollDialog - Sort selection", rollData.selectedSort);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
});
|
});
|
||||||
html.find('#ptreve-variable').click((event) => {
|
html.find('#ptreve-variable').change((event) => {
|
||||||
let ptreve = Number(event.currentTarget.value);
|
let ptreve = Misc.toInt(event.currentTarget.value);
|
||||||
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
|
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
|
||||||
console.log("RdDRollDialog - Cout reve", ptreve);
|
console.log("RdDRollDialog - Cout reve", ptreve);
|
||||||
updateRollResult(rollData);
|
updateRollResult(rollData);
|
||||||
@ -139,18 +145,17 @@ export class RdDRollDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static _computeFinalLevel(rollData) {
|
static _computeFinalLevel(rollData) {
|
||||||
let etat = rollData.etat === undefined ? 0 : parseInt(rollData.etat);
|
let etat = Misc.toInt(rollData.etat);
|
||||||
|
const diffLibre = Misc.toInt(rollData.diffLibre);
|
||||||
|
const diffConditions = Misc.toInt(rollData.diffConditions);
|
||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
return etat + parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue);
|
return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions;
|
||||||
}
|
}
|
||||||
if (rollData.draconicList) {
|
if (rollData.draconicList) {
|
||||||
let difficulte = rollData.selectedSort.data.difficulte; // Sort de difficulté variable
|
let diffSort = (rollData.selectedSort.data.difficulte.toLowerCase() == "variable") ? diffLibre : Misc.toInt(rollData.selectedSort.data.difficulte);
|
||||||
if (difficulte.toLowerCase() == "variable") {
|
return etat + Misc.toInt(rollData.selectedDraconic.data.niveau) + diffSort + diffConditions;
|
||||||
difficulte = parseInt(rollData.bmValue); // Récupérer la valeur de la listbox dans ce cas
|
|
||||||
}
|
}
|
||||||
return etat + parseInt(rollData.selectedDraconic.data.niveau) + parseInt(difficulte);
|
return etat + diffLibre + diffConditions;
|
||||||
}
|
|
||||||
return etat + parseInt(rollData.bmValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -158,8 +163,8 @@ export class RdDRollDialog extends Dialog {
|
|||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
// If a weapon is there, add it in the title
|
// If a weapon is there, add it in the title
|
||||||
let armeTitle = (rollData.arme) ? " (" + rollData.arme.name + ") " : "";
|
let armeTitle = (rollData.arme) ? " (" + rollData.arme.name + ") " : "";
|
||||||
let niveauStr = (rollData.competence.data.niveau > 0 ? "+" : "") + rollData.competence.data.niveau;
|
let niveau = Misc.toSignedString(rollData.competence.data.niveau);
|
||||||
return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveauStr
|
return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveau
|
||||||
}
|
}
|
||||||
if (rollData.draconicList) {
|
if (rollData.draconicList) {
|
||||||
return rollData.selectedDraconic.name + " - " + rollData.selectedSort.name;
|
return rollData.selectedDraconic.name + " - " + rollData.selectedSort.name;
|
||||||
|
@ -50,7 +50,7 @@ export class RdDEncaisser extends Dialog {
|
|||||||
$("#modificateurDegats").val("0");
|
$("#modificateurDegats").val("0");
|
||||||
});
|
});
|
||||||
|
|
||||||
html.find('#modificateurDegats').click((event) => {
|
html.find('#modificateurDegats').change((event) => {
|
||||||
this.modifier = event.currentTarget.value; // Update the selected bonus/malus
|
this.modifier = event.currentTarget.value; // Update the selected bonus/malus
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,6 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
else {
|
else {
|
||||||
// Roll Sort
|
// Roll Sort
|
||||||
html.find('#lancer-sort').click((event) => {
|
html.find('#lancer-sort').click((event) => {
|
||||||
|
|
||||||
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ const competence_xp = {
|
|||||||
// This table starts at 0 -> niveau -10
|
// This table starts at 0 -> niveau -10
|
||||||
const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 30, 30, 40, 40, 60, 60, 100, 100, 100, 100, 100, 100, 100, 100, 100];
|
const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 30, 30, 40, 40, 60, 60, 100, 100, 100, 100, 100, 100, 100, 100, 100];
|
||||||
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
|
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
|
||||||
const bonusmalus = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
|
const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10];
|
||||||
|
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
|
||||||
const fatigueMatrix = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Dummy filler for the array.
|
const fatigueMatrix = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Dummy filler for the array.
|
||||||
[2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3 ],
|
[2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3 ],
|
||||||
[2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3 ],
|
[2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3 ],
|
||||||
@ -195,9 +196,13 @@ export class RdDUtility {
|
|||||||
{
|
{
|
||||||
return carac_array;
|
return carac_array;
|
||||||
}
|
}
|
||||||
static getBonusMalus()
|
static getDifficultesLibres()
|
||||||
{
|
{
|
||||||
return bonusmalus;
|
return difficultesLibres;
|
||||||
|
}
|
||||||
|
static getAjustementsConditions()
|
||||||
|
{
|
||||||
|
return ajustementsConditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -11,14 +11,23 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="categorie">Bonus/Malus</label>
|
<label for="categorie">Difficulté libre</label>
|
||||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||||
{{#select bonusmalus}}
|
{{#select diffLibre}}
|
||||||
{{#each bonusmalusTable as |bmvalue key|}}
|
{{#each difficultesLibres as |key|}}
|
||||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
<label for="categorie">conditions</label>
|
||||||
|
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||||
|
{{#select diffConditions}}
|
||||||
|
{{#each ajustementsConditions as |key|}}
|
||||||
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{#if arme}}
|
{{#if arme}}
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
<form class="skill-roll-dialog">
|
<form class="skill-roll-dialog">
|
||||||
<h2 class="compdialog" id="compdialogTitle"></h2>
|
<h2 class="compdialog" id="compdialogTitle"></h2>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="categorie">Bonus/Malus</label>
|
<label for="categorie">Difficulté libre</label>
|
||||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||||
{{#select bonusmalus}}
|
{{#select diffLibre}}
|
||||||
{{#each bonusmalusTable as |bmvalue key|}}
|
{{#each difficultesLibres as |key|}}
|
||||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
<label for="categorie">conditions</label>
|
||||||
|
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||||
|
{{#select diffConditions}}
|
||||||
|
{{#each ajustementsConditions as |key|}}
|
||||||
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<label class="competence-label">Modificateurs aux Dommages:</label>
|
<label class="competence-label">Modificateurs aux Dommages:</label>
|
||||||
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
|
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
|
||||||
{{#select modificateurDegats}}
|
{{#select modificateurDegats}}
|
||||||
{{#each bonusmalusTable as |bmvalue key|}}
|
{{#each ajustementsConditions as |key|}}
|
||||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
@ -13,6 +13,14 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
<label for="categorie">conditions</label>
|
||||||
|
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||||
|
{{#select diffConditions}}
|
||||||
|
{{#each ajustementsConditions as |key|}}
|
||||||
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -20,7 +28,8 @@
|
|||||||
<select name="sort" id="sort" data-dtype="String">
|
<select name="sort" id="sort" data-dtype="String">
|
||||||
{{#select sort}}
|
{{#select sort}}
|
||||||
{{#each sortList as |sort key|}}
|
{{#each sortList as |sort key|}}
|
||||||
<option value={{key}}>{{sort.name}} : {{sort.data.difficulte}} / {{sort.data.ptreve}} / {{sort.data.caseTMR}}</option>
|
<option value={{key}}>{{this.name}} - {{#if this.data.caseTMRspeciale}} {{this.data.caseTMRspeciale}} {{else}}{{this.data.caseTMR}}{{/if}} / R{{this.data.difficulte}} r {{sort.data.ptreve}}</option>
|
||||||
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
@ -28,10 +37,10 @@
|
|||||||
|
|
||||||
<div class="form-group" id="div-sort-difficulte">
|
<div class="form-group" id="div-sort-difficulte">
|
||||||
<label for="categorie">Difficulté </label>
|
<label for="categorie">Difficulté </label>
|
||||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||||
{{#select bonusmalus}}
|
{{#select diffLibre}}
|
||||||
{{#each bonusmalusTable as |bmvalue key|}}
|
{{#each difficultesLibres as |key|}}
|
||||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
<table id="tmrsheet">
|
<table id="tmrsheet">
|
||||||
<tr id="tmrrow1">
|
<tr id="tmrrow1">
|
||||||
<td>
|
<td>
|
||||||
|
<div class="flex-group-center">
|
||||||
|
<a id="lancer-sort">Lancer un Sort</a>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="flex-group-center">
|
||||||
|
<label>Carac. Rêve : </label><label>{{caracReve}}</label>
|
||||||
|
</div>
|
||||||
<div class="flex-group-center">
|
<div class="flex-group-center">
|
||||||
Rêve Actuel : <span id="pointsreve-value">0</span>
|
Rêve Actuel : <span id="pointsreve-value">0</span>
|
||||||
</div>
|
</div>
|
||||||
@ -20,41 +27,6 @@
|
|||||||
Fatigue
|
Fatigue
|
||||||
<span id="fatigue-table">{{{fatigueHTML}}}</span>
|
<span id="fatigue-table">{{{fatigueHTML}}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-group-center">
|
|
||||||
<label>Carac. Rêve : </label><label>{{caracReve}}</label>
|
|
||||||
</div>
|
|
||||||
<div class="flex-group-center">
|
|
||||||
<label>Points de Rêve : </label><label>{{pointsReve}}</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-group-center">
|
|
||||||
Draconic : <span id="draconic-list">
|
|
||||||
<select name="draconic" id="draconic-list" data-dtype="String">
|
|
||||||
{{#select draconic}}
|
|
||||||
{{#each draconic}}
|
|
||||||
<option value={{this.name}}>{{this.name}} - {{this.data.niveau}}</option>
|
|
||||||
{{/each}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-group-center">
|
|
||||||
Sorts : <span id="sorts-list">
|
|
||||||
<select name="sort" id="sort-list" data-dtype="String">
|
|
||||||
{{#select sort}}
|
|
||||||
{{#each sort}}
|
|
||||||
<option value={{this.name}}>{{this.name}}</option>
|
|
||||||
{{/each}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-group-center">
|
|
||||||
<a id="lancer-sort">Lancer un Sort</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user