" +
- "Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}" }
- );
+ content : `
Bienvenue dans le Rêve des Dragons !
+ Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}
+ La commande /aide
dans le chat permet de voir les commandes spécifiques à Rêve de Dragon.
+ ` });
}
/* -------------------------------------------- */
@@ -232,6 +234,8 @@ Hooks.once("renderApplication", () => {
/* -------------------------------------------- */
Hooks.once("ready", function() {
+ // préparation des lignes de commandes
+ RdDCommands.init();
/* -------------------------------------------- */
/* Affiche/Init le calendrier */
let calendrier = new RdDCalendrier();
@@ -271,11 +275,15 @@ Hooks.on("preCreateToken", (scene, tokenData, options) => {
/* Foundry VTT Initialization */
/* -------------------------------------------- */
Hooks.on("chatMessage", (html, content, msg) => {
- let regExp = /(\S+)/g;
- let commands = content.match(regExp);
-
- return RdDUtility.processChatCommand( commands, content, msg );
-} );
+ if (content[0] == '/') {
+ let regExp = /(\S+)/g;
+ let commands = content.toLowerCase().match(regExp);
+ if (game.system.rdd.commands.processChatCommand(commands, content, msg)){
+ return false;
+ }
+ }
+ return true;
+});
/* -------------------------------------------- */
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js
index b65ad195..e9cd6f05 100644
--- a/module/rdd-resolution-table.js
+++ b/module/rdd-resolution-table.js
@@ -70,7 +70,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */
static getResultat(code) {
- let resultat = reussites.filter(r => code == r.code);
+ let resultat = reussites.find(r => code == r.code);
if (resultat == undefined) {
resultat = reussites.find(r => r.code == "error");
}
@@ -88,14 +88,64 @@ export class RdDResolutionTable {
return message;
}
- static explainRollData(rollData) {
- let message = "
Difficultés
libre: " + rollData.diffLibre + " / conditions: " + Misc.toSignedString(rollData.diffConditions)
- + " / état: " + rollData.etat;
- message += RdDResolutionTable.explain(rollData.rolled)
- if (rollData.selectedCarac == rollData.carac.volonte) {
- message += " / moral: " + rollData.moral;
+ static async explainRollDataV2(rollData, template = 'chat-resultat-rdd.html') {
+ rollData.ajustements = RdDResolutionTable._buildAjustements(rollData);
+ rollData.show = rollData.show || {};
+
+ let html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
+ return html;
+ }
+
+ static _buildAjustements(rollData) {
+ let list = [];
+ if (rollData.competence) {
+ list.push({ label: rollData.competence.name, value: rollData.competence.data.niveau});
}
- return message;
+ if (rollData.diffLibre != undefined) {
+ const label = rollData.selectedSort ? rollData.selectedSort.name : 'libre';
+ list.push({ label: label, value: rollData.diffLibre });
+ }
+ if (rollData.diffConditions != undefined) {
+ list.push({ label: 'conditions', value: rollData.diffConditions });
+ }
+ if (rollData.etat != undefined) {
+ list.push({ label: 'état', value: rollData.etat });
+ }
+ if (rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté') {
+ list.push({ label: 'moral', value: rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté' ? rollData.moral : undefined });
+ }
+ if (RdDResolutionTable.isAjustementAstrologique(rollData)) {
+ list.push({ label: 'astrologique', value: rollData.ajustementAstrologique||0 });
+ }
+ if (rollData.rolled.bonus && rollData.selectedSort) {
+ list.push({ label: 'Bonus de case', value: rollData.rolled.bonus, unit: '%' });
+ }
+ return list;
+ }
+
+ static explainRollData(rollData) {
+ let parts = RdDResolutionTable._buildAjustementsList(rollData);
+ let message = parts.length > 0 ? "
Difficulté " + parts.reduce((a, b) => a + ' / ' + b) : "";
+
+ return message+ RdDResolutionTable.explain(rollData.rolled)
+ }
+
+
+ static _buildAjustementsList(rollData) {
+ let parts = [];
+ if (rollData.diffLibre != undefined) {
+ parts.push(`
libre: ${rollData.diffLibre} `);
+ }
+ if (rollData.diffConditions != undefined) {
+ parts.push(`conditions: ${Misc.toSignedString(rollData.diffConditions)}`);
+ }
+ if (rollData.etat != undefined) {
+ parts.push(`état: ${rollData.etat}`);
+ }
+ if (rollData.selectedCarac != undefined && rollData.moral != undefined && rollData.selectedCarac.label == 'Volonté') {
+ parts.push(`moral: ${rollData.moral}`);
+ }
+ return parts;
}
/* -------------------------------------------- */
@@ -156,6 +206,16 @@ export class RdDResolutionTable {
return duplicate(this.resolutionTable[caracValue][difficulte + 10]);
}
+ static isAjustementAstrologique(rollData) {
+ if (rollData.selectedCarac && rollData.selectedCarac.label.toLowerCase().includes('chance')) {
+ return true;
+ }
+ if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
+ return true;
+ }
+ return false;
+ }
+
/* -------------------------------------------- */
static isEchec(rollData) {
switch (rollData.surprise) {
diff --git a/module/rdd-roll-resolution.js b/module/rdd-roll-resolution.js
index da37e502..ceb7073d 100644
--- a/module/rdd-roll-resolution.js
+++ b/module/rdd-roll-resolution.js
@@ -2,6 +2,7 @@ import { ChatUtility } from "./chat-utility.js";
import { Misc } from "./misc.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
+const titleTableDeResolution = 'Table de résolution';
/**
* Extend the base Dialog entity to select roll parameters
* @extends {Dialog}
@@ -10,16 +11,18 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
export class RdDRollResolution extends Dialog {
/* -------------------------------------------- */
- static async open() {
- let rollData = RdDRollResolution._prepareDefaultOptions();
+ static async open(rollData = {selectedCarac:10}) {
+ RdDRollResolution._setDefaultOptions(rollData);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData);
const dialog = new RdDRollResolution(rollData, html);
dialog.render(true);
}
/* -------------------------------------------- */
- static _prepareDefaultOptions() {
- let rollData = {
+ static _setDefaultOptions(rollData) {
+
+ let defRollData = {
+ show: {title: titleTableDeResolution, points:true},
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: 0,
@@ -29,18 +32,19 @@ export class RdDRollResolution extends Dialog {
diffConditions: 0,
diffLibre: 0
}
+ mergeObject(rollData, defRollData, {overwrite: false});
for (let i = 1; i < 21; i++) {
rollData.carac[i] = { type: "number", value: i, label: i }
+ if (rollData.selectedCarac == i) {
+ rollData.selectedCarac = rollData.carac[i];
+ }
}
- rollData.selectedCarac = rollData.carac[10];
- return rollData;
}
/* -------------------------------------------- */
constructor(rollData, html) {
-
let conf = {
- title: 'Lancer les dés',
+ title: titleTableDeResolution,
content: html,
buttons: {
'lancer': { label: 'Lancer les dés', callback: html => this.onAction(html) }
@@ -55,9 +59,7 @@ export class RdDRollResolution extends Dialog {
async onAction(html) {
await RdDResolutionTable.rollData(this.rollData);
console.log("RdDRollResolution -=>", this.rollData, this.rollData.rolled);
- const message = {
- content: "Table de résolution: " + RdDResolutionTable.explainRollData(this.rollData)
- };
+ const message = { content: await RdDResolutionTable.explainRollDataV2(this.rollData)};
ChatUtility.chatWithRollMode(message, game.user.name)
}
@@ -117,9 +119,4 @@ export class RdDRollResolution extends Dialog {
_computeDiffLibre(rollData) {
return Misc.toInt(rollData.diffLibre);
}
-
- /* -------------------------------------------- */
- _getTitle(rollData) {
- return 'Table de résolution';
- }
}
diff --git a/module/rdd-roll.js b/module/rdd-roll.js
index 1d24f6b9..8230efe2 100644
--- a/module/rdd-roll.js
+++ b/module/rdd-roll.js
@@ -121,7 +121,7 @@ export class RdDRoll extends Dialog {
HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte);
HtmlUtility._showControlWhen($("#etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
- HtmlUtility._showControlWhen($("#ajust-astrologique"), dialog._isAjustementAstrologique(rollData));
+ HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData));
// Sort management
if (rollData.selectedSort) {
@@ -176,7 +176,7 @@ export class RdDRoll extends Dialog {
});
html.find('#draconic').change((event) => {
let draconicKey = Misc.toInt(event.currentTarget.value);
- this.rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac
+ this.rollData.competence = rollData.draconicList[draconicKey]; // Update the selectedCarac
//console.log("RdDRollSelectDialog","CARAC CLICKED !!!", rollData);
updateRollResult(rollData);
});
@@ -229,7 +229,7 @@ export class RdDRoll extends Dialog {
const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0;
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
- const ajustementChance = this._isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
+ const ajustementChance = RdDResolutionTable.isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
// Gestion malus armure
const malusArmureValue = this._computeMalusArmure(rollData);
@@ -240,22 +240,12 @@ export class RdDRoll extends Dialog {
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique;
}
- _isAjustementAstrologique(rollData) {
- if (rollData.selectedCarac.label.toLowerCase().includes('chance')) {
- return true;
- }
- if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
- return true;
- }
- return false;
- }
-
_computeDiffCompetence(rollData) {
if (rollData.competence) {
return Misc.toInt(rollData.competence.data.niveau);
}
if (rollData.draconicList) {
- return Misc.toInt(rollData.selectedDraconic.data.niveau);
+ return Misc.toInt(rollData.competence.data.niveau);
}
return 0;
}
@@ -288,7 +278,7 @@ export class RdDRoll extends Dialog {
return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveau
}
if (rollData.draconicList) {
- return rollData.selectedDraconic.name + " - " + rollData.selectedSort.name;
+ return rollData.competence.name + " - " + rollData.selectedSort.name;
}
return rollData.selectedCarac.label;
}
diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js
index 134665d5..8bebbf2d 100644
--- a/module/rdd-tmr-dialog.js
+++ b/module/rdd-tmr-dialog.js
@@ -145,7 +145,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async gererTourbillon( value ) {
- this.nbFatigue += value;
+ this.nbFatigue += 1;
await this.actor.reveActuelIncDec( -value );
if ( !this.currentRencontre.tourbillonDirection ) {
this.currentRencontre.tourbillonDirection = TMRUtility.getDirectionPattern();
@@ -158,7 +158,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
async gererTourbillonRouge( ) {
- this.nbFatigue += 4; // 4 cases -> 4 pts de fatigue
+ this.nbFatigue += 1;
await this.actor.reveActuelIncDec( -2 ); // -2 pts de Reve a chaque itération
if ( !this.currentRencontre.tourbillonDirection ) {
this.currentRencontre.tourbillonDirection = TMRUtility.getDirectionPattern();
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 46031101..bab53c0d 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -891,17 +891,6 @@ export class RdDUtility {
});
}
- /* -------------------------------------------- */
- /* Display help for /table */
- static displayHelpTable( msg )
- {
- msg.content = "";
- for (let [name, tableData] of Object.entries(table2func)) {
- msg.content += "
" + tableData.descr;
- }
- ChatMessage.create( msg );
- }
-
/* -------------------------------------------- */
static afficherDemandePayer(som1, som2) {
som1 = (som1) ? som1.toLowerCase() : "0d";
@@ -922,38 +911,4 @@ export class RdDUtility {
msgPayer += "
Payer "
ChatMessage.create( { content: msgPayer } );
}
-
- /* -------------------------------------------- */
- /* Manage chat commands */
- static processChatCommand( commands, content, msg ) {
- // Setup new message's visibility
- let rollMode = game.settings.get("core", "rollMode");
- if (["gmroll", "blindroll"].includes(rollMode)) msg["whisper"] = ChatMessage.getWhisperRecipients("GM");
- if (rollMode === "blindroll") msg["blind"] = true;
- msg["type"] = 0;
-
- let command = commands[0];
-
- // Roll on a table
- if (command === "/table") {
- if ( commands[1] ) {
- let tableName = commands[1].toLowerCase();
- table2func[tableName].func();
- } else {
- this.displayHelpTable( msg );
- }
- return false
- } else if (command === "/tmrr") {
- TMRUtility.getRencontre(commands[1], commands[2] )
- return false
- } else if (command === "/tmra") {
- TMRUtility.getTMRAleatoire( )
- return false
- } else if (command === "/payer") {
- RdDUtility.afficherDemandePayer( commands[1], commands[2] )
- return false
- }
-
- return true;
- }
}
diff --git a/styles/simple.css b/styles/simple.css
index 71bfe4f6..e190cb0d 100644
--- a/styles/simple.css
+++ b/styles/simple.css
@@ -86,6 +86,9 @@
margin: 0;
padding: 0;
}
+.strong-text{
+ font-weight: bold;
+}
.tabs .item.active, .blessures-list li ul li:first-child:hover, a:hover {
text-shadow: 1px 0px 0px #ff6600;
@@ -364,6 +367,35 @@ table {border: 1px solid #7a7971;}
z-index: 9999;
display: block;
}
+.rdd-roll-part{
+ align-items: center;
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3));
+}
+.rdd-roll-sign{
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(30deg, rgba(61, 55, 93, 0.3), rgba(178, 179, 196, 0.3), rgba(59, 62, 63, 0.6), rgba(206, 204, 199, 0.3), rgba(61, 46, 49, 0.3));
+}
+.rdd-roll-norm{
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(30deg, rgba(7, 76, 0, 0.3), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.1), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.3));
+}
+.rdd-roll-echec{
+ border-radius: 6px; padding: 3px;
+ background-image: linear-gradient(150deg, rgba(255, 0, 0, 0.3), rgba(255, 200, 128, 0.05),rgba(255, 200, 128, 0.1), rgba(255,10,0,0.3));
+}
+.rdd-roll-epart{
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6));
+}
+.rdd-roll-etotal{
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(150deg, rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7));
+}
+.rdd-need-significative{
+ border-radius: 6px; padding: 3px;
+ background:linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2));
+}
.table-resolution-carac {
background-color: yellow;
@@ -1180,22 +1212,25 @@ display: inline-flex;
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
- width: 360px;
- background-color: rgba(30, 25, 20, 0.9);
text-align: center;
padding: 5px 0;
border-radius: 6px;
-
+
/* Position the tooltip text */
position: absolute;
z-index: 1;
- top: 30px;
- left: -30%;
-
+
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
+}
+.tooltiptext-fatigue{
+ width: 360px;
+ top: 30px;
+ left: -30%;
+
+ background-color: rgba(30, 25, 20, 0.9);
border-image: url(img/ui/bg_control.jpg) 21 repeat;
border-image-slice: 6 6 6 6 fill;
border-image-width: 6px 6px 6px 6px;
@@ -1203,6 +1238,13 @@ display: inline-flex;
border-radius: 0px;
}
+.tooltiptext-ajustements {
+ width: 150px;
+ top: 30px;
+ background: rgba(220,220,210,0.9);
+ font-size: 0.8rem;
+}
+
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index e7805231..5efded6b 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -31,7 +31,7 @@
Fatigue
-
- {{{data.fatigue.html}}}
+ {{{data.fatigue.html}}}
/ {{data.sante.fatigue.max}}
+
@@ -65,7 +65,7 @@
Pour {{selectedSort.data.ptreve_reel}} points de rêve en {{coordLabel}} ({{coord}})
+