diff --git a/module/actor-creature-sheet.js b/module/actor-creature-sheet.js
index 28d238aa..a299a949 100644
--- a/module/actor-creature-sheet.js
+++ b/module/actor-creature-sheet.js
@@ -128,7 +128,7 @@ export class RdDActorCreatureSheet extends ActorSheet {
// Roll Skill
html.find('.competence-label a').click((event) => {
let compName = event.currentTarget.text;
- this.actor.rollCompetence( compName );
+ this.actor.rollCompetenceCreature( compName );
});
html.find('#vie-plus').click((event) => {
diff --git a/module/actor-entite-sheet.js b/module/actor-entite-sheet.js
index 25f7f2dc..fb2dc46f 100644
--- a/module/actor-entite-sheet.js
+++ b/module/actor-entite-sheet.js
@@ -95,7 +95,7 @@ export class RdDActorEntiteSheet extends ActorSheet {
// Roll Skill
html.find('.competence-label a').click((event) => {
let compName = event.currentTarget.text;
- this.actor.rollCompetence( compName );
+ this.actor.rollCompetenceCreature( compName );
});
html.find('#endurance-plus').click((event) => {
diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index 062d5425..f5e3303b 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -286,7 +286,7 @@ export class RdDActorSheet extends ActorSheet {
html.find('.arme-label a').click((event) => {
let armeName = event.currentTarget.text;
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
- this.actor.rollArme( armeName, competenceName);
+ this.actor.rollArme(competenceName, armeName);
});
// Initiative pour l'arme
html.find('.arme-initiative a').click((event) => {
diff --git a/module/actor.js b/module/actor.js
index 7c882855..48d084b9 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -16,6 +16,7 @@ import { RdDDice } from "./rdd-dice.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { ChatUtility } from "./chat-utility.js";
import { RdDItemSort } from "./item-sort.js";
+import { Grammar } from "./grammar.js";
export class RdDActor extends Actor {
@@ -90,7 +91,6 @@ export class RdDActor extends Actor {
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
if (actorData.type === 'creature') this.computeEtatGeneral(actorData);
if (actorData.type === 'humanoide') this.computeEtatGeneral(actorData);
-
}
/* -------------------------------------------- */
@@ -141,14 +141,8 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async performRoll(rollData, attacker = undefined) {
-
- // Cas des bonus de cases pour les sorts
- let sortBonus = 0;
- if (rollData.selectedSort) {
- sortBonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord );
- }
// garder le résultat
- rollData.rolled = await RdDResolutionTable.roll(rollData.caracValue, rollData.finalLevel, sortBonus);
+ rollData.rolled = await RdDResolutionTable.rollData(rollData);
//console.log("performRoll", rollData)
if ( !rollData.attackerRoll) {// Store in the registry if not a defense roll
@@ -206,7 +200,7 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
- computeRecul( rollData ) { // Calcul du recul (p. 132)
+ computeRecul( rollData, encaisser = undefined ) { // Calcul du recul (p. 132)
if ( rollData.arme || encaisser ) {
if ( (rollData.attackerRoll.particuliereAttaque && rollData.attackerRoll.particuliereAttaque == 'force') || rollData.attackerRoll.isCharge) {
let reculNiveau = this.data.data.taille.value - (rollData.attackerRoll.forceValue+rollData.attackerRoll.arme.dommages);
@@ -271,7 +265,6 @@ export class RdDActor extends Actor {
if (rollData.needSignificative)
explications += " Significative nécessaire!";
}
- this.computeRecul( rollData );
encaisser = rollData.needSignificative ? !rolled.isSign : !rolled.isSuccess;
this.computeRecul( rollData, encaisser );
} else { // This is the attack roll!
@@ -303,12 +296,6 @@ export class RdDActor extends Actor {
}
}
- // Sort management
- if (rollData.selectedSort) { // Lancement de sort !
- resumeCompetence = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name;
- explications = await this._rollLancementDeSort(rollData, rolled);
- }
-
// Save it for fight in the flags area
game.system.rdd.rollDataHandler[this.data._id] = duplicate(rollData);
@@ -370,68 +357,6 @@ export class RdDActor extends Actor {
return dmgArme + dmgPerso;
}
- /* -------------------------------------------- */
- async _rollLancementDeSort(rollData, rolled) {
-
- let sort = duplicate(rollData.selectedSort);
-
- let closeTMR = true;
- 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"
- + "
Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
-
- let myReve = duplicate(this.data.data.reve.reve);
- if (rolled.isSuccess) { // Réussite du sort !
- sort.ptreve_reel = coutReve;
- if (rolled.isPart) {
- coutReve = Math.max(Math.ceil(coutReve / 2), 1);
- }
- // Incrémenter/gére le bonus de case
- RdDItemSort.incrementBonusCase(this, sort, rollData.coord);
-
- if (myReve.value > coutReve){
- explications += "
Réussite du sort: " + coutReve + " points de Rêve sont dépensés (Bonus de case : +" + rolled.bonus + "%)";
-
- if (rollData.isSortReserve) {
- // Mise en réserve
- myReve.value--;
- await this.sortMisEnReserve(rollData, sort);
- closeTMR = false;
- }
- }
- else {
- // Todo 0 pts de reve !!!!
- explications += "
Pas assez de rêve";
- mergeObject(rollData, RdDResolutionTable.getResultat("echec"));
- }
- } else {
- if (rolled.isETotal) { // Echec total !
- coutReve *= 2;
- myReve.value = myReve.value - coutReve;
- explications += "
Echec TOTAL du sort : " + coutReve + " Points de Rêve";
- } else {
- coutReve = 0
- explications += "
Echec du sort !";
- }
- }
-
- myReve.value = Math.max(myReve.value - coutReve, 0);
- await this.update({ "data.reve.reve": myReve });
-
- if (myReve.value == 0) { // 0 points de reve
- ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
- closeTMR = true;
- }
- if (closeTMR) {
- this.currentTMR.close(); // Close TMR !
- } else {
- this.currentTMR.maximize(); // Re-display TMR
- }
- return explications
- }
-
/* -------------------------------------------- */
async dormirChateauDormant() {
let message = {
@@ -1324,38 +1249,6 @@ export class RdDActor extends Actor {
}
}
- /* -------------------------------------------- */
- async rollUnSort(coord) {
- let draconicList = this.getDraconicList();
- let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
-
- let rollData = {
- selectedCarac: this.data.data.carac.reve,
- etat: this.data.data.compteurs.etat.value,
- draconicList: draconicList,
- sortList: sortList,
- selectedDraconic: this.getBestDraconic(),
- selectedSort: sortList[0],
- coord: coord,
- coordLabel: TMRUtility.getTMRDescription( coord).label,
- finalLevel: 0,
- diffConditions: 0,
- diffLibre: sortList[0].data.difficulte, // Per default at startup
- coutreve: Array(20).fill().map((item, index) => 1 + index),
- ajustementsConditions: CONFIG.RDD.ajustementsConditions,
- difficultesLibres: CONFIG.RDD.difficultesLibres,
- malusArmureValue: 0,
- surencMalusFlag: false, // A ne pas utiliser pour les sorts
- surencMalusValue: 0,
- surencMalusApply: false,
- isNatation: false,
- useEncForNatation: false
- }
- if ( this.currentTMR) this.currentTMR.minimize(); // Hide
- let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData);
- new RdDRollDialog("sort", html, rollData, this ).render(true);
- }
-
/* -------------------------------------------- */
_createCallbackExperience() {
return {
@@ -1374,16 +1267,137 @@ export class RdDActor extends Actor {
ChatMessage.create(message);
}
+ /* -------------------------------------------- */
+ async rollUnSort(coord) {
+ let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
+ if (!sortList || sortList.length == 0)
+ {
+ ui.notifications.info("Aucun sort disponible!");
+ return;
+ }
+
+ let rollData = {
+ selectedCarac: this.data.data.carac.reve,
+ draconicList: this.getDraconicList(),
+ sortList: sortList,
+ selectedDraconic: this.getBestDraconic(),
+ selectedSort: sortList[0],
+ coord: coord,
+ coordLabel: TMRUtility.getTMRDescription( coord).label,
+ diffLibre: sortList[0].data.difficulte, // Per default at startup
+ coutreve: Array(20).fill().map((item, index) => 1 + index)
+ }
+
+ if ( this.currentTMR) this.currentTMR.minimize(); // Hide
+ const dialog = await RdDRoll.create(this, rollData,
+ {html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html'},
+ {
+ name: 'lancer-un-sort',
+ label: 'Lancer un sort',
+ callbacks: [
+ this._createCallbackExperience(),
+ { action: r => this._rollUnSortResult(r, false) }
+ ]
+ },
+ {
+ name: 'mettre-en-reserve',
+ label: 'Mettre un sort en réserve',
+ callbacks: [
+ this._createCallbackExperience(),
+ { action: r => this._rollUnSortResult(r, true) }
+ ]
+ }
+ );
+ dialog.render(true);
+ }
+
+ async _rollUnSortResult(rollData, isSortReserve = false) {
+ rollData.isSortReserve = isSortReserve;
+ let rolled = rollData.rolled;
+ let sort = rollData.selectedSort;
+ let closeTMR = !rollData.isSortReserve;
+
+ let explications = rollData.isSortReserve
+ ? ("
Mise en réserve du sort en " + rollData.coordLabel + "(" + rollData.coord + ")")
+ : "
Lancement du sort ";
+ explications += sort.name + " : " + Misc.upperFirst(sort.data.draconic)
+ + " pour " + sort.data.ptreve_reel + " points de Rêve"
+ + "
Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
+
+ let depenseReve = sort.data.ptreve_reel;
+ let myReve = duplicate(this.data.data.reve.reve);
+ if (rolled.isSuccess) { // Réussite du sort !
+ //sort.ptreve_reel = coutReve;
+ if (rolled.isPart) {
+ depenseReve = Math.max(Math.floor(depenseReve / 2), 1);
+ }
+ if (rollData.isSortReserve) {
+ depenseReve++;
+ }
+
+ if (myReve.value > depenseReve) {
+ explications += "
Réussite du sort: " + depenseReve + " points de Rêve sont dépensés (Bonus de case en " + rollData.coord + ": +" + rolled.bonus + "%)";
+
+ // Incrémenter/gére le bonus de case
+ RdDItemSort.incrementBonusCase(this, sort, rollData.coord);
+
+ if (rollData.isSortReserve) {
+ await this.sortMisEnReserve(rollData, sort);
+ closeTMR = false;
+ }
+ }
+ else {
+ // Todo 0 pts de reve !!!!
+ depenseReve = 0;
+ explications += "
Pas assez de rêve";
+ mergeObject(rollData, RdDResolutionTable.getResultat("echec"));
+ }
+ } else {
+ if (rolled.isETotal) { // Echec total !
+ depenseReve = Math.max(myReve.value, Math.floor(depenseReve * 1.5))
+ explications += "
Echec TOTAL du sort : " + depenseReve + " Points de Rêve";
+ // TODO: mise en réserve d'un échec total...
+ } else {
+ depenseReve = 0
+ explications += "
Echec du sort !";
+ }
+ }
+
+ myReve.value = Math.max(myReve.value - depenseReve, 0);
+ await this.update({ "data.reve.reve": myReve });
+
+ if (myReve.value == 0) { // 0 points de reve
+ ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
+ closeTMR = true;
+ }
+ if (closeTMR) {
+ this.currentTMR.close(); // Close TMR !
+ } else {
+ this.currentTMR.maximize(); // Re-display TMR
+ }
+ // Final chat message
+ let chatOptions = {
+ content: "Test : " + rollData.selectedCarac.label + " / " + rollData.selectedDraconic.name + " / " + rollData.selectedSort.name + ""
+ + "
Difficultés libre : " + rollData.diffLibre + " / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
+ + RdDResolutionTable.explain(rolled)
+ + explications
+ }
+
+ ChatUtility.chatWithRollMode(chatOptions, this.name)
+ }
+
/* -------------------------------------------- */
- async rollCarac( caracName )
- {
- let rollData = { selectedCarac: this.getCaracByName(caracName) };
+ async rollCarac( caracName ) {
+ let rollData = {
+ selectedCarac: this.getCaracByName(caracName),
+ needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value
+ };
const dialog = await RdDRoll.create(this, rollData,
{html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'},
{
name: 'jet-'+caracName,
- label: 'Lancer : '+rollData.selectedCarac.label,
+ label: 'Jet ' + Grammar.apostrophe('de', rollData.selectedCarac.label),
callbacks: [
this._createCallbackExperience(),
{ action: this._rollCaracResult }
@@ -1410,6 +1424,45 @@ export class RdDActor extends Actor {
ChatUtility.chatWithRollMode(chatOptions, this.name)
}
+ /* -------------------------------------------- */
+ async rollCompetence( name ) {
+ let rollData = {
+ competence: duplicate(RdDUtility.findCompetence( this.data.items, name)),
+ needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value
+ }
+
+ if (rollData.competence.type == 'competencecreature') {
+ // Fake competence pour créature
+ mergeObject(rollData.competence, { data : { defaut_carac: "carac_creature", categorie: "creature" } });
+ rollData.carac = { carac_creature: { label: competence.name, value: competence.data.carac_value } };
+ }
+ else{
+ rollData.carac = this.data.data.carac;
+ }
+ console.log("rollCompetence !!!", rollData.competence);
+
+ const dialog = await RdDRoll.create(this, rollData,
+ {html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'},
+ {
+ name: 'jet-competence',
+ label: 'Jet ' +Grammar.apostrophe('de', name),
+ callbacks: [
+ this._createCallbackExperience(),
+ { action: this._competenceResult }
+ ]
+ }
+ );
+ dialog.render(true);
+ }
+
+ _competenceResult(rollData) {
+ ChatUtility.chatWithRollMode({
+ content: "Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + ""
+ + "
Difficultés libre : " + rollData.diffLibre + " / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
+ + RdDResolutionTable.explain(rollData.rolled)
+ + "
Points de taches : " + rollData.rolled.ptTache + ", ajustement qualité: " + rollData.rolled.ptQualite
+ }, this.name)
+ }
/* -------------------------------------------- */
async rollAppelChance( )
@@ -1525,29 +1578,52 @@ export class RdDActor extends Actor {
this.currentTMR = new RdDTMRDialog(html, this, data, mode);
this.currentTMR.render(true);
}
+
- /* -------------------------------------------- */
- rollArme( armeName, competenceName=undefined ) {
- let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
- if (armeItem ) {
- if ( competenceName == undefined) competenceName = armeItem.data.competence;
- this.rollCompetence( competenceName, armeItem );
- } else {
- this.rollCompetence( armeName ); //Bypass mode!
+ async rollCompetenceCreature( compName ) {
+ let competence = RdDUtility.findCompetence( this.data.items, compName);
+
+ if ( competence.type == 'competencecreature' && competence.data.iscombat ) {
+ armeItem = { name: compName, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
+ this.rollCompetenceCombat(competence, armeItem);
+ }
+ else {
+ this.rollCompetence(name);
}
}
/* -------------------------------------------- */
- async rollCompetence( name, armeItem=undefined, attackerRoll=undefined, attacker = undefined) {
+ rollArme(competenceName, armeName) {
+ let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName));
+ if (armeItem && competenceName == undefined) competenceName = armeItem.data.competence;
+ let competence = RdDUtility.findCompetence(this.data.items, competenceName == undefined? armeName : competenceName);
+
+ if (armeItem==undefined && competence.type == 'competencecreature' && competence.data.iscombat ) {
+ armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
+ }
+
+ if (armeItem || armeName) {
+ this.rollCompetenceCombat( competenceName, armeItem );
+ } else {
+ this.rollCompetence( competence.name );
+ }
+ }
+
+ /* -------------------------------------------- */
+ async rollCompetenceCombat( name, armeItem=undefined, attackerRoll=undefined, attacker = undefined) {
let competence = RdDUtility.findCompetence( this.data.items, name);
- console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
+ if ( competence.type == 'competencecreature' && competence.data.iscombat ) {
+ armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
+ }
+
+ console.log("rollCompetenceCombat !!!", 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,
- forceValue : (this.data.data.carac.force) ? this.data.data.carac.force.value : 0, // Utilisé pour le jet de recul
+ forceValue : attackerRoll ? (this.data.data.carac.force ? this.data.data.carac.force.value : this.data.data.carac.reve.value) : 0, // Utilisé pour le jet de recul
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
attackerRoll: attackerRoll,
finalLevel: 0,
@@ -1561,7 +1637,7 @@ export class RdDActor extends Actor {
encValueForNatation: 0
}
if ( this.type == 'personnage ') {
- rollData.malusArmureValue = (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0;
+ rollData.malusArmureValue = (this.data.data.attributs && this.data.data.attributs.malusarmure) ? this.data.data.attributs.malusarmure.value : 0,
rollData.surencMalusFlag = (this.data.data.compteurs.surenc.value < 0);
rollData.surencMalusValue = this.data.data.compteurs.surenc.value;
rollData.surencMalusApply = false;
@@ -1571,9 +1647,6 @@ export class RdDActor extends Actor {
}
if ( competence.type == 'competencecreature') { // Specific case for Creatures
- if ( competence.data.iscombat ) {
- armeItem = { name: name, data: { dommages: competence.data.dommages, dommagesReels: competence.data.dommages} };
- }
competence.data.defaut_carac = "carac_creature"; // Fake default competence
competence.data.categorie = "creature"; // Fake default competence
rollData.competence = competence;
@@ -1705,17 +1778,21 @@ export class RdDActor extends Actor {
{
let armeItem = this.getOwnedItem(armeId); // Item.data.data !
console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre);
+<<<<<<< HEAD
if (armeItem.type == 'competencecreature') {
this.rollCompetence( armeItem.name, armeItem.data, attackerRoll, attacker);
} else {
this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker);
}
+=======
+ this.rollCompetenceCombat( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker);
+>>>>>>> e2644f1 (Séparation compétences/combat)
}
/* -------------------------------------------- */
esquiverAttaque( attackerRoll, attacker = undefined )
{
- this.rollCompetence( "esquive", undefined, attackerRoll, attacker );
+ this.rollCompetenceCombat( "esquive", undefined, attackerRoll, attacker );
}
/* -------------------------------------------- */
diff --git a/module/grammar.js b/module/grammar.js
new file mode 100644
index 00000000..c840cd94
--- /dev/null
+++ b/module/grammar.js
@@ -0,0 +1,18 @@
+
+const articlesApostrophes = {
+ 'de' : 'd\'',
+ 'le' : 'l\'',
+ 'la' : 'l\''
+}
+export class Grammar {
+
+ static apostrophe(article, word) {
+ if (articlesApostrophes[article] && Grammar.startsWithVoyel(word)) {
+ return articlesApostrophes[article] + word
+ }
+ return article + ' ' + word;
+ }
+ static startsWithVoyel(word) {
+ return word.match(/^[aeiouy]/i)
+ }
+}
\ No newline at end of file
diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js
index f72142e2..534667f3 100644
--- a/module/rdd-resolution-table.js
+++ b/module/rdd-resolution-table.js
@@ -102,9 +102,9 @@ export class RdDResolutionTable {
rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus);
return rollData;
}
-
+
/* -------------------------------------------- */
- static async roll(caracValue, finalLevel, bonus = 0 ) {
+ static async roll(caracValue, finalLevel, bonus = undefined ) {
let chances = this.computeChances(caracValue, finalLevel);
chances.showDice = true;
this.updateChancesWithBonus( chances, bonus);
diff --git a/module/rdd-roll.js b/module/rdd-roll.js
index 73140e5d..3cc84e04 100644
--- a/module/rdd-roll.js
+++ b/module/rdd-roll.js
@@ -34,12 +34,13 @@ export class RdDRoll extends Dialog {
finalLevel: 0,
diffConditions: 0,
diffLibre: 0,
- malusArmureValue: actor.data.data.attributs ? actor.data.data.attributs.malusarmure.value : 0,
- surencMalusFlag: (actor.data.data.compteurs.surenc.value < 0),
- surencMalusValue: actor.data.data.compteurs.surenc.value,
+ malusArmureValue: (actor.type == 'personnage ' && actor.data.data.attributs && actor.data.data.attributs.malusarmure) ? actor.data.data.attributs.malusarmure.value : 0,
+ surencMalusFlag: actor.type == 'personnage ' ? (actor.data.data.compteurs.surenc.value < 0) : false,
+ surencMalusValue: actor.type == 'personnage ' ? actor.data.data.compteurs.surenc.value : 0,
surencMalusApply: false,
- isNatation: false,
- useEncForNatation: false
+ isNatation: rollData.competence ? rollData.competence.name.toLowerCase().includes("natation") : false,
+ useEncForNatation: false,
+ encValueForNatation: actor.encombrementTotal ? Math.floor(actor.encombrementTotal) : 0
},
{ overwrite: false });
}
@@ -74,6 +75,9 @@ export class RdDRoll extends Dialog {
async onAction(action, html) {
await RdDResolutionTable.rollData(this.rollData);
+
+ console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
+
if (action.callbacks)
for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) {
@@ -101,6 +105,7 @@ export class RdDRoll extends Dialog {
// Sort management
if (rollData.selectedSort) {
+ rollData.bonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord ),
//console.log("Toggle show/hide", rollData.selectedSort);
HtmlUtility._showControlWhen("#div-sort-difficulte", RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen("#div-sort-ptreve", RdDItemSort.isCoutVariable(rollData.selectedSort))
@@ -153,6 +158,7 @@ export class RdDRoll extends Dialog {
html.find('#sort').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
+ this.rollData.bonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord );
RdDItemSort.setCoutReveReel(rollData.selectedSort);
//console.log("RdDRollSelectDialog - Sort selection", rollData.selectedSort);
updateRollResult(rollData);
diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js
index 8eaca821..a00fea30 100644
--- a/module/rdd-tmr-dialog.js
+++ b/module/rdd-tmr-dialog.js
@@ -388,7 +388,7 @@ export class RdDTMRDialog extends Dialog {
console.log("declencheSortEnReserve", sortReserve)
const declenchementSort = "Vous avez déclenché le sort " + sortReserve.sort.name
+ " en réserve en " + sortReserve.coord + " (" + TMRUtility.getTMRDescription(sortReserve.coord).label
- + ") avec " + sortReserve.sort.ptreve_reel + " points de Rêve";
+ + ") avec " + sortReserve.sort.data.ptreve_reel + " points de Rêve";
this._tellToGM(declenchementSort);
this.close();
}
diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js
index e0519cc2..12aefdc4 100644
--- a/module/rdd-token-hud.js
+++ b/module/rdd-token-hud.js
@@ -55,7 +55,7 @@ export class RdDTokenHud {
hudCombat.find('label').click(async (event) => {
let armeIndex = event.currentTarget.attributes['data-arme-id'].value;
let arme = armesList[armeIndex];
- actor.rollArme( arme.name, arme.data.competence);
+ actor.rollArme( arme.data.competence, arme.name);
});
}
}