Merge branch 'v1.5-fix-dice' into 'v1.5'
Fix: simplifier l'affichage des jets See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!300
This commit is contained in:
commit
583a34495c
@ -1670,7 +1670,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
async _jetEndurance(endurance) {
|
||||
const roll = await RdDDice.roll("1d20", { showDice: true });
|
||||
const roll = await RdDDice.roll("1d20");
|
||||
let result = {
|
||||
roll: roll,
|
||||
sonne: roll.total > endurance || roll.total == 20 // 20 is always a failure
|
||||
@ -1683,7 +1683,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetVie() {
|
||||
let roll = await RdDDice.roll("1d20", { showDice: true });
|
||||
let roll = await RdDDice.roll("1d20");
|
||||
const actorData = Misc.data(this);
|
||||
let msgText = "Jet de Vie : " + roll.total + " / " + actorData.data.sante.vie.value + "<br>";
|
||||
if (roll.total <= actorData.data.sante.vie.value) {
|
||||
@ -1819,7 +1819,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
async _jetDeMoral(situation) {
|
||||
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 succes = jet <= difficulte;
|
||||
const jetMoral = {
|
||||
@ -2020,8 +2020,7 @@ export class RdDActor extends Actor {
|
||||
selectedCarac: actorData.data.sante.vie,
|
||||
carac: actorData.data.carac,
|
||||
caracValue: actorData.data.sante.vie.max,
|
||||
finalLevel: etat + forceAlcool - nbDoses,
|
||||
showDice: true
|
||||
finalLevel: etat + forceAlcool - nbDoses
|
||||
},
|
||||
}
|
||||
|
||||
@ -2034,7 +2033,7 @@ export class RdDActor extends Actor {
|
||||
ethylisme.value = Math.max(ethylisme.value - 1, -7);
|
||||
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);
|
||||
|
||||
if (!ethylisme.jet_moral) {
|
||||
@ -2055,8 +2054,7 @@ export class RdDActor extends Actor {
|
||||
selectedCarac: actorData.data.carac.volonte,
|
||||
caracValue: actorData.data.carac.volonte.value,
|
||||
ethylisme: ethylisme.value,
|
||||
finalLevel: ethylisme.value + actorData.data.compteurs.moral.value,
|
||||
showDice: true
|
||||
finalLevel: ethylisme.value + actorData.data.compteurs.moral.value
|
||||
}
|
||||
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
|
||||
this._appliquerExperienceRollData(ethylismeData.jetVolonte);
|
||||
@ -2500,7 +2498,6 @@ export class RdDActor extends Actor {
|
||||
selectedCarac: carac,
|
||||
competence: competence,
|
||||
diffLibre: diff,
|
||||
showDice: true,
|
||||
show: { title: options?.title ?? '' }
|
||||
};
|
||||
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
|
||||
if (ReglesOptionelles.isUsing('degat-minimum-malus-libre-simple')) {
|
||||
|
@ -1 +1,4 @@
|
||||
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 { RdDDice } from "./rdd-dice.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/'
|
||||
@ -145,10 +145,10 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouterNombreAstral(index, showDice = true) {
|
||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, hideDice: !showDice, rollMode: "selfroll" });
|
||||
async ajouterNombreAstral(index, showDice = SHOW_DICE_OPTIONAL) {
|
||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, rollMode: "selfroll" });
|
||||
const dateFuture = this.getDateFromIndex(index);
|
||||
if (showDice) {
|
||||
if (showDice != HIDE_DICE) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||
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()) {
|
||||
console.log("rebuildListeNombreAstral", showDice);
|
||||
let jourCourant = this.getCurrentDayIndex();
|
||||
@ -324,7 +324,7 @@ export class RdDCalendrier extends Application {
|
||||
let rollData = {
|
||||
caracValue: request.carac_vue,
|
||||
finalLevel: niveau,
|
||||
showDice: false,
|
||||
showDice: HIDE_DICE,
|
||||
rollMode: "blindroll"
|
||||
};
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
@ -333,7 +333,7 @@ export class RdDCalendrier extends Application {
|
||||
request.isValid = true;
|
||||
if (!request.rolled.isSuccess) {
|
||||
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
|
||||
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
||||
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
@ -1195,7 +1195,7 @@ export class RdDCombat {
|
||||
let resistRoll = await RdDResolutionTable.rollData({
|
||||
caracValue: resistance,
|
||||
finalLevel: - dmg,
|
||||
showDice: false
|
||||
showDice: HIDE_DICE
|
||||
});
|
||||
if (!resistRoll.rolled.isSuccess) {
|
||||
let perteResistance = (dmg - arme.data.resistance_magique)
|
||||
@ -1210,7 +1210,7 @@ export class RdDCombat {
|
||||
let resistRoll = await RdDResolutionTable.rollData({
|
||||
caracValue: resistance,
|
||||
finalLevel: - dmg,
|
||||
showDice: false
|
||||
showDice: HIDE_DICE
|
||||
});
|
||||
if (resistRoll.rolled.isSuccess) { // Perte de résistance
|
||||
defenderRoll.show.deteriorationArme = 'resiste';
|
||||
@ -1226,7 +1226,7 @@ export class RdDCombat {
|
||||
let desarme = await RdDResolutionTable.rollData({
|
||||
caracValue: this.defender.getForce(),
|
||||
finalLevel: Misc.toInt(defenderRoll.competence.data.niveau) - dmg,
|
||||
showDice: false
|
||||
showDice: HIDE_DICE
|
||||
});
|
||||
defenderRoll.show.desarme = desarme.rolled.isEchec;
|
||||
}
|
||||
|
@ -291,7 +291,6 @@ export class RdDCommands {
|
||||
let rollData = {
|
||||
caracValue: carac,
|
||||
finalLevel: diff,
|
||||
showDice: true,
|
||||
diviseurSignificative: significative ? 2 : 1,
|
||||
show: { title: "Table de résolution" }
|
||||
};
|
||||
@ -301,7 +300,7 @@ export class RdDCommands {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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}`);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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";
|
||||
|
||||
function img(src) {
|
||||
@ -123,6 +123,7 @@ export class RdDDice {
|
||||
CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
|
||||
CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
|
||||
}
|
||||
|
||||
static onReady() {
|
||||
if (game.modules.get("dice-so-nice")?.active) {
|
||||
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);
|
||||
await roll.evaluate({ async: true });
|
||||
if (!options.hideDice) {
|
||||
roll.showDice = options.showDice;
|
||||
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
||||
if (options.showDice != HIDE_DICE) {
|
||||
await this.showDiceSoNice(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
||||
}
|
||||
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);
|
||||
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) {
|
||||
if (game.modules.get("dice-so-nice")?.active) {
|
||||
|
@ -106,17 +106,6 @@ Hooks.once("init", async function () {
|
||||
default: RdDCalendrier.createCalendrierPos(),
|
||||
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", {
|
||||
name: "Supprimer les dialogues de combat",
|
||||
|
Loading…
Reference in New Issue
Block a user