Fix: simplifier l'affichage des jets #517
@ -1670,7 +1670,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _jetEndurance(endurance) {
|
async _jetEndurance(endurance) {
|
||||||
const roll = await RdDDice.roll("1d20", { showDice: true });
|
const roll = await RdDDice.roll("1d20");
|
||||||
let result = {
|
let result = {
|
||||||
roll: roll,
|
roll: roll,
|
||||||
sonne: roll.total > endurance || roll.total == 20 // 20 is always a failure
|
sonne: roll.total > endurance || roll.total == 20 // 20 is always a failure
|
||||||
@ -1683,7 +1683,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async jetVie() {
|
async jetVie() {
|
||||||
let roll = await RdDDice.roll("1d20", { showDice: true });
|
let roll = await RdDDice.roll("1d20");
|
||||||
const actorData = Misc.data(this);
|
const actorData = Misc.data(this);
|
||||||
let msgText = "Jet de Vie : " + roll.total + " / " + actorData.data.sante.vie.value + "<br>";
|
let msgText = "Jet de Vie : " + roll.total + " / " + actorData.data.sante.vie.value + "<br>";
|
||||||
if (roll.total <= actorData.data.sante.vie.value) {
|
if (roll.total <= actorData.data.sante.vie.value) {
|
||||||
@ -1819,7 +1819,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
async _jetDeMoral(situation) {
|
async _jetDeMoral(situation) {
|
||||||
const moralActuel = Misc.toInt(Misc.templateData(this).compteurs.moral.value);
|
const moralActuel = Misc.toInt(Misc.templateData(this).compteurs.moral.value);
|
||||||
const jet = await RdDDice.rollTotal("1d20", { showDice: true });
|
const jet = await RdDDice.rollTotal("1d20");
|
||||||
const difficulte = 10 + moralActuel;
|
const difficulte = 10 + moralActuel;
|
||||||
const succes = jet <= difficulte;
|
const succes = jet <= difficulte;
|
||||||
const jetMoral = {
|
const jetMoral = {
|
||||||
@ -2020,8 +2020,7 @@ export class RdDActor extends Actor {
|
|||||||
selectedCarac: actorData.data.sante.vie,
|
selectedCarac: actorData.data.sante.vie,
|
||||||
carac: actorData.data.carac,
|
carac: actorData.data.carac,
|
||||||
caracValue: actorData.data.sante.vie.max,
|
caracValue: actorData.data.sante.vie.max,
|
||||||
finalLevel: etat + forceAlcool - nbDoses,
|
finalLevel: etat + forceAlcool - nbDoses
|
||||||
showDice: true
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2034,7 +2033,7 @@ export class RdDActor extends Actor {
|
|||||||
ethylisme.value = Math.max(ethylisme.value - 1, -7);
|
ethylisme.value = Math.max(ethylisme.value - 1, -7);
|
||||||
ethylisme.nb_doses = 0;
|
ethylisme.nb_doses = 0;
|
||||||
|
|
||||||
let perte = await RdDDice.rollTotal("1d6", { showDice: true });
|
let perte = await RdDDice.rollTotal("1d6");
|
||||||
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte);
|
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte);
|
||||||
|
|
||||||
if (!ethylisme.jet_moral) {
|
if (!ethylisme.jet_moral) {
|
||||||
@ -2055,8 +2054,7 @@ export class RdDActor extends Actor {
|
|||||||
selectedCarac: actorData.data.carac.volonte,
|
selectedCarac: actorData.data.carac.volonte,
|
||||||
caracValue: actorData.data.carac.volonte.value,
|
caracValue: actorData.data.carac.volonte.value,
|
||||||
ethylisme: ethylisme.value,
|
ethylisme: ethylisme.value,
|
||||||
finalLevel: ethylisme.value + actorData.data.compteurs.moral.value,
|
finalLevel: ethylisme.value + actorData.data.compteurs.moral.value
|
||||||
showDice: true
|
|
||||||
}
|
}
|
||||||
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
|
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
|
||||||
this._appliquerExperienceRollData(ethylismeData.jetVolonte);
|
this._appliquerExperienceRollData(ethylismeData.jetVolonte);
|
||||||
@ -2500,7 +2498,6 @@ export class RdDActor extends Actor {
|
|||||||
selectedCarac: carac,
|
selectedCarac: carac,
|
||||||
competence: competence,
|
competence: competence,
|
||||||
diffLibre: diff,
|
diffLibre: diff,
|
||||||
showDice: true,
|
|
||||||
show: { title: options?.title ?? '' }
|
show: { title: options?.title ?? '' }
|
||||||
};
|
};
|
||||||
RollDataAjustements.calcul(rollData, this);
|
RollDataAjustements.calcul(rollData, this);
|
||||||
@ -3363,7 +3360,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let roll = await RdDDice.roll(formula, { showDice: true });
|
let roll = await RdDDice.roll(formula);
|
||||||
|
|
||||||
// 1 dé fait au minmum la difficulté libre
|
// 1 dé fait au minmum la difficulté libre
|
||||||
if (ReglesOptionelles.isUsing('degat-minimum-malus-libre-simple')) {
|
if (ReglesOptionelles.isUsing('degat-minimum-malus-libre-simple')) {
|
||||||
|
@ -1 +1,4 @@
|
|||||||
export const SYSTEM_RDD = "foundryvtt-reve-de-dragon";
|
export const SYSTEM_RDD = "foundryvtt-reve-de-dragon";
|
||||||
|
|
||||||
|
export const HIDE_DICE = 'hide';
|
||||||
|
export const SHOW_DICE = 'show';
|
||||||
|
@ -7,7 +7,7 @@ import { RdDUtility } from "./rdd-utility.js";
|
|||||||
import { Grammar } from "./grammar.js";
|
import { Grammar } from "./grammar.js";
|
||||||
import { RdDDice } from "./rdd-dice.js";
|
import { RdDDice } from "./rdd-dice.js";
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
import { SYSTEM_RDD } from "./constants.js";
|
import { HIDE_DICE, SHOW_DICE, SHOW_DICE_OPTIONAL, SYSTEM_RDD } from "./constants.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
||||||
@ -145,10 +145,10 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async ajouterNombreAstral(index, showDice = true) {
|
async ajouterNombreAstral(index, showDice = SHOW_DICE_OPTIONAL) {
|
||||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, hideDice: !showDice, rollMode: "selfroll" });
|
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, rollMode: "selfroll" });
|
||||||
const dateFuture = this.getDateFromIndex(index);
|
const dateFuture = this.getDateFromIndex(index);
|
||||||
if (showDice) {
|
if (showDice != HIDE_DICE) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||||
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
|
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
|
||||||
@ -185,7 +185,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rebuildListeNombreAstral(showDice = true) {
|
async rebuildListeNombreAstral(showDice = SHOW_DICE) {
|
||||||
if (Misc.isUniqueConnectedGM()) {
|
if (Misc.isUniqueConnectedGM()) {
|
||||||
console.log("rebuildListeNombreAstral", showDice);
|
console.log("rebuildListeNombreAstral", showDice);
|
||||||
let jourCourant = this.getCurrentDayIndex();
|
let jourCourant = this.getCurrentDayIndex();
|
||||||
@ -324,7 +324,7 @@ export class RdDCalendrier extends Application {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
caracValue: request.carac_vue,
|
caracValue: request.carac_vue,
|
||||||
finalLevel: niveau,
|
finalLevel: niveau,
|
||||||
showDice: false,
|
showDice: HIDE_DICE,
|
||||||
rollMode: "blindroll"
|
rollMode: "blindroll"
|
||||||
};
|
};
|
||||||
await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
@ -333,7 +333,7 @@ export class RdDCalendrier extends Application {
|
|||||||
request.isValid = true;
|
request.isValid = true;
|
||||||
if (!request.rolled.isSuccess) {
|
if (!request.rolled.isSuccess) {
|
||||||
request.isValid = false;
|
request.isValid = false;
|
||||||
nbAstral = await RdDDice.rollTotal("1dhr" + nbAstral, { showDice: true, rollMode: "selfroll" });
|
nbAstral = await RdDDice.rollTotal("1dhr" + nbAstral, { rollMode: "selfroll" });
|
||||||
// Mise à jour des nombres astraux du joueur
|
// Mise à jour des nombres astraux du joueur
|
||||||
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
||||||
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
|
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ChatUtility } from "./chat-utility.js";
|
import { ChatUtility } from "./chat-utility.js";
|
||||||
import { SYSTEM_RDD } from "./constants.js";
|
import { HIDE_DICE, SYSTEM_RDD } from "./constants.js";
|
||||||
import { RdDItemArme } from "./item-arme.js";
|
import { RdDItemArme } from "./item-arme.js";
|
||||||
import { RdDItemCompetence } from "./item-competence.js";
|
import { RdDItemCompetence } from "./item-competence.js";
|
||||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||||
@ -1195,7 +1195,7 @@ export class RdDCombat {
|
|||||||
let resistRoll = await RdDResolutionTable.rollData({
|
let resistRoll = await RdDResolutionTable.rollData({
|
||||||
caracValue: resistance,
|
caracValue: resistance,
|
||||||
finalLevel: - dmg,
|
finalLevel: - dmg,
|
||||||
showDice: false
|
showDice: HIDE_DICE
|
||||||
});
|
});
|
||||||
if (!resistRoll.rolled.isSuccess) {
|
if (!resistRoll.rolled.isSuccess) {
|
||||||
let perteResistance = (dmg - arme.data.resistance_magique)
|
let perteResistance = (dmg - arme.data.resistance_magique)
|
||||||
@ -1210,7 +1210,7 @@ export class RdDCombat {
|
|||||||
let resistRoll = await RdDResolutionTable.rollData({
|
let resistRoll = await RdDResolutionTable.rollData({
|
||||||
caracValue: resistance,
|
caracValue: resistance,
|
||||||
finalLevel: - dmg,
|
finalLevel: - dmg,
|
||||||
showDice: false
|
showDice: HIDE_DICE
|
||||||
});
|
});
|
||||||
if (resistRoll.rolled.isSuccess) { // Perte de résistance
|
if (resistRoll.rolled.isSuccess) { // Perte de résistance
|
||||||
defenderRoll.show.deteriorationArme = 'resiste';
|
defenderRoll.show.deteriorationArme = 'resiste';
|
||||||
@ -1226,7 +1226,7 @@ export class RdDCombat {
|
|||||||
let desarme = await RdDResolutionTable.rollData({
|
let desarme = await RdDResolutionTable.rollData({
|
||||||
caracValue: this.defender.getForce(),
|
caracValue: this.defender.getForce(),
|
||||||
finalLevel: Misc.toInt(defenderRoll.competence.data.niveau) - dmg,
|
finalLevel: Misc.toInt(defenderRoll.competence.data.niveau) - dmg,
|
||||||
showDice: false
|
showDice: HIDE_DICE
|
||||||
});
|
});
|
||||||
defenderRoll.show.desarme = desarme.rolled.isEchec;
|
defenderRoll.show.desarme = desarme.rolled.isEchec;
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,6 @@ export class RdDCommands {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
caracValue: carac,
|
caracValue: carac,
|
||||||
finalLevel: diff,
|
finalLevel: diff,
|
||||||
showDice: true,
|
|
||||||
diviseurSignificative: significative ? 2 : 1,
|
diviseurSignificative: significative ? 2 : 1,
|
||||||
show: { title: "Table de résolution" }
|
show: { title: "Table de résolution" }
|
||||||
};
|
};
|
||||||
@ -301,7 +300,7 @@ export class RdDCommands {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollDeDraconique(msg) {
|
async rollDeDraconique(msg) {
|
||||||
let ddr = await RdDDice.rollTotal("1dr + 7", { showDice: true });
|
let ddr = await RdDDice.rollTotal("1dr + 7");
|
||||||
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr}`);
|
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ChatUtility } from "./chat-utility.js";
|
import { ChatUtility } from "./chat-utility.js";
|
||||||
import { SYSTEM_RDD } from "./constants.js";
|
import { HIDE_DICE, SHOW_DICE, SHOW_DICE_OPTIONAL, SYSTEM_RDD } from "./constants.js";
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
|
|
||||||
function img(src) {
|
function img(src) {
|
||||||
@ -123,6 +123,7 @@ export class RdDDice {
|
|||||||
CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
|
CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
|
||||||
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
|
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
|
||||||
}
|
}
|
||||||
|
|
||||||
static onReady() {
|
static onReady() {
|
||||||
if (game.modules.get("dice-so-nice")?.active) {
|
if (game.modules.get("dice-so-nice")?.active) {
|
||||||
if (game.settings.get("core", "noCanvas")) {
|
if (game.settings.get("core", "noCanvas")) {
|
||||||
@ -131,17 +132,16 @@ export class RdDDice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async roll(formula, options = { showDice: false, rollMode: undefined }) {
|
static async roll(formula, options = { showDice: SHOW_DICE, rollMode: undefined }) {
|
||||||
const roll = new Roll(formula);
|
const roll = new Roll(formula);
|
||||||
await roll.evaluate({ async: true });
|
await roll.evaluate({ async: true });
|
||||||
if (!options.hideDice) {
|
if (options.showDice != HIDE_DICE) {
|
||||||
roll.showDice = options.showDice;
|
await this.showDiceSoNice(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
||||||
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
|
||||||
}
|
}
|
||||||
return roll;
|
return roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async rollTotal(formula, options = { showDice: false, hideDice: false }) {
|
static async rollTotal(formula, options = { showDice: HIDE_DICE}) {
|
||||||
const roll = await RdDDice.roll(formula, options);
|
const roll = await RdDDice.roll(formula, options);
|
||||||
return roll.total;
|
return roll.total;
|
||||||
}
|
}
|
||||||
@ -159,14 +159,6 @@ export class RdDDice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
static async show(roll, rollMode) {
|
|
||||||
if (roll.showDice || game.settings.get(SYSTEM_RDD, "dice-so-nice") == true) {
|
|
||||||
await this.showDiceSoNice(roll, rollMode);
|
|
||||||
}
|
|
||||||
return roll;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async showDiceSoNice(roll, rollMode) {
|
static async showDiceSoNice(roll, rollMode) {
|
||||||
if (game.modules.get("dice-so-nice")?.active) {
|
if (game.modules.get("dice-so-nice")?.active) {
|
||||||
|
@ -106,17 +106,6 @@ Hooks.once("init", async function () {
|
|||||||
default: RdDCalendrier.createCalendrierPos(),
|
default: RdDCalendrier.createCalendrierPos(),
|
||||||
type: Object
|
type: Object
|
||||||
});
|
});
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
game.settings.register(SYSTEM_RDD, "dice-so-nice", {
|
|
||||||
name: "Montrer les dés pour toutes les jets",
|
|
||||||
hint: "Utilise Dice So Nice pour tous les jets de dés possibles. Décocher pour limiter à la table de résolution",
|
|
||||||
scope: "client",
|
|
||||||
config: true,
|
|
||||||
default: false,
|
|
||||||
type: Boolean
|
|
||||||
});
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
|
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
|
||||||
name: "Supprimer les dialogues de combat",
|
name: "Supprimer les dialogues de combat",
|
||||||
|
Loading…
Reference in New Issue
Block a user