Separation difficulte libre/conditions
* ajout de diffConditions pour gérer l'ajustement de conditions * renommage de bmValue en diffLibre * calcul de l'ajustement (etat+conditions+difficulté libre) * présentation des 2 champs fix: * utiliser .change() au lieu de .click() permet de supporter aussi les changements au clavier
This commit is contained in:
parent
5776ae0a20
commit
52caf1b39a
@ -110,7 +110,8 @@ export class RdDActorSheet extends ActorSheet {
|
||||
data.data.competenceByCategory = data.competenceByCategory;
|
||||
data.data.encombrementTotal = this.actor.encombrementTotal;
|
||||
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.
|
||||
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( ) {
|
||||
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 );
|
||||
new RdDEncaisser(html, this.actor ).render(true);
|
||||
}
|
||||
|
141
module/actor.js
141
module/actor.js
@ -166,8 +166,8 @@ export class RdDActor extends Actor {
|
||||
console.log(">>> ROLL", rollData, rolled);
|
||||
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
|
||||
|
||||
let resumeCompetence = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
|
||||
let explications = "<br>Points de taches : " + rolled.tache + ", Points de qualité: " + rolled.qualite;
|
||||
let resumeCompetence = (rollData.competence) ? rollData.competence.name : (rollData.diffLibre + rollData.diffConditions);
|
||||
let explications = "<br>Points de taches : " + rolled.ptTache + ", ajustement qualité: " + rolled.ptQualite;
|
||||
|
||||
// Fight management !
|
||||
let defenseMsg;
|
||||
@ -217,7 +217,8 @@ export class RdDActor extends Actor {
|
||||
// Final chat message
|
||||
let chatOptions = {
|
||||
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>"
|
||||
+ explications + xpmsg,
|
||||
user: game.user._id,
|
||||
@ -264,7 +265,7 @@ export class RdDActor extends Actor {
|
||||
let closeTMR = true;
|
||||
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"
|
||||
+ "<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 }
|
||||
}
|
||||
let second = RdDResolutionTable.rollChances(target)
|
||||
switch (second.qualite) {
|
||||
switch (second.quality) {
|
||||
case "part": case "sign":
|
||||
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
||||
default:
|
||||
@ -716,9 +717,11 @@ export class RdDActor extends Actor {
|
||||
selectedSort: sortList[0],
|
||||
coord: coord,
|
||||
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),
|
||||
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);
|
||||
new RdDRollDialog("sort", html, rollData, this ).render(true);
|
||||
@ -729,41 +732,43 @@ export class RdDActor extends Actor {
|
||||
{
|
||||
let rollData = {
|
||||
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,
|
||||
finalLevel: 0,
|
||||
bmValue: 0
|
||||
diffConditions: 0,
|
||||
diffLibre: 0
|
||||
}
|
||||
console.log(caracName, rollData);
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
|
||||
new RdDRollDialog("carac", html, rollData, this ).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSortList() {
|
||||
return this.data.items.filter(item => item.type == "sort");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDraconicList() {
|
||||
return this.data.items.filter(item => item.data.categorie == 'draconic')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayTMR(mode="normal" )
|
||||
{
|
||||
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;
|
||||
}
|
||||
console.log(caracName, rollData);
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
|
||||
new RdDRollDialog("carac", html, rollData, this ).render(true);
|
||||
}
|
||||
|
||||
let data = {
|
||||
/* -------------------------------------------- */
|
||||
getSortList() {
|
||||
return this.data.items.filter(item => item.type == "sort");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDraconicList() {
|
||||
return this.data.items.filter(item => item.data.categorie == 'draconic')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayTMR(mode="normal" )
|
||||
{
|
||||
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>",
|
||||
draconic: this.getDraconicList(),
|
||||
sort: this.getSortList(),
|
||||
@ -771,36 +776,38 @@ export class RdDActor extends Actor {
|
||||
pointsReve: this.data.data.reve.reve.value,
|
||||
isRapide: isRapide
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
|
||||
this.currentTMR = new RdDTMRDialog(html, this, data, mode == "visu");
|
||||
this.currentTMR.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme( armeName )
|
||||
{
|
||||
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
||||
if ( armeItem && armeItem.data.competence )
|
||||
this.rollCompetence( armeItem.data.competence, armeItem );
|
||||
else
|
||||
this.rollCompetence( armeName ); //Bypass mode!
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined )
|
||||
{
|
||||
let competence = RdDUtility.findCompetence( this.data.items, name);
|
||||
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
||||
// Common rollData values
|
||||
let rollData = {
|
||||
bonusmalusTable: CONFIG.RDD.bonusmalus,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
bmValue: (attackerRoll) ? attackerRoll.bmValue : 0,
|
||||
attackerRoll: attackerRoll,
|
||||
finalLevel: 0
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
|
||||
this.currentTMR = new RdDTMRDialog(html, this, data, mode == "visu");
|
||||
this.currentTMR.render(true);
|
||||
}
|
||||
|
||||
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme( armeName )
|
||||
{
|
||||
let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
|
||||
if ( armeItem && armeItem.data.competence )
|
||||
this.rollCompetence( armeItem.data.competence, armeItem );
|
||||
else
|
||||
this.rollCompetence( armeName ); //Bypass mode!
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence( name, armeItem=undefined, attackerRoll=undefined )
|
||||
{
|
||||
let competence = RdDUtility.findCompetence( this.data.items, name);
|
||||
console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
|
||||
// Common rollData values
|
||||
let rollData = {
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
diffConditions: 0,
|
||||
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
|
||||
attackerRoll: attackerRoll,
|
||||
finalLevel: 0
|
||||
}
|
||||
|
||||
if ( competence.type == 'competencecreature') { // Specific case for Creatures
|
||||
if ( competence.data.iscombat ) {
|
||||
armeItem = { name: name, data: { dommages: competence.data.dommages} };
|
||||
}
|
||||
@ -894,7 +901,7 @@ export class RdDActor extends Actor {
|
||||
parerAttaque( attackerRoll, armeId )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,25 @@
|
||||
* to actual classes of the game system or of FoundryVTT
|
||||
*/
|
||||
export class Misc {
|
||||
static _upperFirst(text) {
|
||||
static upperFirst(text) {
|
||||
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;
|
||||
}
|
||||
}
|
@ -119,10 +119,12 @@ Hooks.once("init", async function() {
|
||||
// Define custom Entity classes
|
||||
CONFIG.Actor.entityClass = RdDActor;
|
||||
CONFIG.RDD = {
|
||||
resolutionTable : RdDResolutionTable.resolutionTable,
|
||||
level_category : RdDUtility.getLevelCategory(),
|
||||
carac_array : RdDUtility.getCaracArray(),
|
||||
bonusmalus : RdDUtility.getBonusMalus()
|
||||
resolutionTable : RdDResolutionTable.resolutionTable,
|
||||
level_category : RdDUtility.getLevelCategory(),
|
||||
carac_array : RdDUtility.getCaracArray(),
|
||||
ajustementsConditions : RdDUtility.getAjustementsConditions(),
|
||||
difficultesLibres : RdDUtility.getDifficultesLibres()
|
||||
|
||||
}
|
||||
|
||||
// Register sheet application classes
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/**
|
||||
* difficultés au delà de -10
|
||||
@ -40,13 +41,13 @@ const specialResults = [
|
||||
|
||||
|
||||
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: "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: "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: "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: "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: "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: "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: "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, 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, 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, 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, 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, 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, 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");
|
||||
@ -196,9 +197,7 @@ export class RdDResolutionTable {
|
||||
tr.append($("<th class='table-resolution-level'/>").text("..."));
|
||||
}
|
||||
for (let difficulte = minLevel; difficulte <= maxLevel; difficulte++) {
|
||||
const niveau = dataRow[difficulte + 10].niveau;
|
||||
const txt = (niveau > 0 ? "+" : "") + niveau;
|
||||
tr.append($("<th class='table-resolution-level'/>").text(txt));
|
||||
tr.append($("<th class='table-resolution-level'/>").text(Misc.toSignedString(difficulte)));
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
|
||||
/**
|
||||
@ -38,7 +39,7 @@ export class RdDRollDialog extends Dialog {
|
||||
dialogOptions.height = 350
|
||||
} else if (mode == "sort") {
|
||||
dialogConf.title = "Lancer un sort"
|
||||
dialogConf.height = 450
|
||||
dialogConf.height = 470
|
||||
}
|
||||
super(dialogConf, dialogOptions)
|
||||
|
||||
@ -65,7 +66,6 @@ export class RdDRollDialog extends Dialog {
|
||||
let rollLevel = RdDRollDialog._computeFinalLevel(rollData);
|
||||
|
||||
rollData.finalLevel = rollLevel;
|
||||
rollData.finalLevelStr = (rollLevel > 0 ? "+" : "") + rollLevel;
|
||||
rollData.rollTarget = RdDResolutionTable.computeChances(rollData.selectedCarac.value, rollData.finalLevel);
|
||||
|
||||
// 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));
|
||||
$(".table-resolution").remove();
|
||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
|
||||
@ -101,36 +101,42 @@ export class RdDRollDialog extends Dialog {
|
||||
// Si sort, for les points de reve à 1
|
||||
if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel)
|
||||
rollData.selectedSort.data.ptreve_reel = 1;
|
||||
$("#bonusmalus").val(rollData.bmValue);
|
||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||
$("#diffConditions").val(Misc.toInt(rollData.diffConditions));
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
|
||||
// Update !
|
||||
html.find('#bonusmalus').click((event) => {
|
||||
rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus
|
||||
html.find('#diffLibre').change((event) => {
|
||||
rollData.diffLibre = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
|
||||
//console.log("RdDRollDialog","BM CLICKED !!!", 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;
|
||||
this.rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
|
||||
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#draconic').click((event) => {
|
||||
let draconicKey = Number(event.currentTarget.value);
|
||||
html.find('#draconic').change((event) => {
|
||||
let draconicKey = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac
|
||||
//console.log("RdDRollDialog","CARAC CLICKED !!!", rollData);
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#sort').click((event) => {
|
||||
let sortKey = Number(event.currentTarget.value);
|
||||
html.find('#sort').change((event) => {
|
||||
let sortKey = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
|
||||
//console.log("RdDRollDialog - Sort selection", rollData.selectedSort);
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#ptreve-variable').click((event) => {
|
||||
let ptreve = Number(event.currentTarget.value);
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
let ptreve = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
|
||||
console.log("RdDRollDialog - Cout reve", ptreve);
|
||||
updateRollResult(rollData);
|
||||
@ -139,18 +145,17 @@ export class RdDRollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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) {
|
||||
return etat + parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue);
|
||||
return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions;
|
||||
}
|
||||
if (rollData.draconicList) {
|
||||
let difficulte = rollData.selectedSort.data.difficulte; // Sort de difficulté variable
|
||||
if (difficulte.toLowerCase() == "variable") {
|
||||
difficulte = parseInt(rollData.bmValue); // Récupérer la valeur de la listbox dans ce cas
|
||||
}
|
||||
return etat + parseInt(rollData.selectedDraconic.data.niveau) + parseInt(difficulte);
|
||||
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;
|
||||
}
|
||||
return etat + parseInt(rollData.bmValue);
|
||||
return etat + diffLibre + diffConditions;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -158,8 +163,8 @@ export class RdDRollDialog extends Dialog {
|
||||
if (rollData.competence) {
|
||||
// If a weapon is there, add it in the title
|
||||
let armeTitle = (rollData.arme) ? " (" + rollData.arme.name + ") " : "";
|
||||
let niveauStr = (rollData.competence.data.niveau > 0 ? "+" : "") + rollData.competence.data.niveau;
|
||||
return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveauStr
|
||||
let niveau = Misc.toSignedString(rollData.competence.data.niveau);
|
||||
return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveau
|
||||
}
|
||||
if (rollData.draconicList) {
|
||||
return rollData.selectedDraconic.name + " - " + rollData.selectedSort.name;
|
||||
|
@ -50,7 +50,7 @@ export class RdDEncaisser extends Dialog {
|
||||
$("#modificateurDegats").val("0");
|
||||
});
|
||||
|
||||
html.find('#modificateurDegats').click((event) => {
|
||||
html.find('#modificateurDegats').change((event) => {
|
||||
this.modifier = event.currentTarget.value; // Update the selected bonus/malus
|
||||
});
|
||||
}
|
||||
|
@ -314,7 +314,6 @@ export class RdDTMRDialog extends Dialog {
|
||||
else {
|
||||
// Roll Sort
|
||||
html.find('#lancer-sort').click((event) => {
|
||||
|
||||
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ const competence_xp = {
|
||||
// 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 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.
|
||||
[2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3 ],
|
||||
[2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3 ],
|
||||
@ -195,9 +196,13 @@ export class RdDUtility {
|
||||
{
|
||||
return carac_array;
|
||||
}
|
||||
static getBonusMalus()
|
||||
static getDifficultesLibres()
|
||||
{
|
||||
return bonusmalus;
|
||||
return difficultesLibres;
|
||||
}
|
||||
static getAjustementsConditions()
|
||||
{
|
||||
return ajustementsConditions;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -11,14 +11,23 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="categorie">Bonus/Malus</label>
|
||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
||||
{{#select bonusmalus}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
<label for="categorie">Difficulté libre</label>
|
||||
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||
{{#select diffLibre}}
|
||||
{{#each difficultesLibres as |key|}}
|
||||
<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}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
{{#if arme}}
|
||||
<div>
|
||||
|
@ -1,11 +1,19 @@
|
||||
<form class="skill-roll-dialog">
|
||||
<h2 class="compdialog" id="compdialogTitle"></h2>
|
||||
<div class="form-group">
|
||||
<label for="categorie">Bonus/Malus</label>
|
||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
||||
{{#select bonusmalus}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
<label for="categorie">Difficulté libre</label>
|
||||
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||
{{#select diffLibre}}
|
||||
{{#each difficultesLibres as |key|}}
|
||||
<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}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
@ -4,8 +4,8 @@
|
||||
<label class="competence-label">Modificateurs aux Dommages:</label>
|
||||
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
|
||||
{{#select modificateurDegats}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
@ -13,6 +13,14 @@
|
||||
{{/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}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@ -20,7 +28,8 @@
|
||||
<select name="sort" id="sort" data-dtype="String">
|
||||
{{#select sort}}
|
||||
{{#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}}
|
||||
{{/select}}
|
||||
</select>
|
||||
@ -28,12 +37,12 @@
|
||||
|
||||
<div class="form-group" id="div-sort-difficulte">
|
||||
<label for="categorie">Difficulté </label>
|
||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
||||
{{#select bonusmalus}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||
{{#select diffLibre}}
|
||||
{{#each difficultesLibres as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
@ -4,6 +4,13 @@
|
||||
<table id="tmrsheet">
|
||||
<tr id="tmrrow1">
|
||||
<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">
|
||||
Rêve Actuel : <span id="pointsreve-value">0</span>
|
||||
</div>
|
||||
@ -20,41 +27,6 @@
|
||||
Fatigue
|
||||
<span id="fatigue-table">{{{fatigueHTML}}}</span>
|
||||
</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>
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user