Liste des ajustements
Après le travail sur les ChatMessage, centraliser les difficultés pour les dialog-roll afin d'afficher tous les ajustements sous forme de tooltips Les ajustements à améliorer: * malus armure * sur-encombrement * encombrement total + fix regression tâches + fix méditation isisPuritication
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RollDataAjustements as RollDataAjustements } from "./rolldata-ajustements.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDBonus } from "./rdd-bonus.js";
|
||||
import { RdDCombat } from "./rdd-combat.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
|
||||
/**
|
||||
@ -93,76 +91,16 @@ export class RdDResolutionTable {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async buildRollDataHtml(rollData, template = 'chat-resultat-general.html') {
|
||||
rollData.ajustements = RdDResolutionTable._buildAjustements(rollData);
|
||||
rollData.show = rollData.show || {};
|
||||
|
||||
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
|
||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||
ChatUtility.chatWithRollMode(
|
||||
{ content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template) },
|
||||
actor?.userName ?? game.user.name)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayRollData(rollData, userName, template = 'chat-resultat-general.html') {
|
||||
|
||||
ChatUtility.chatWithRollMode(
|
||||
{ content: await RdDResolutionTable.buildRollDataHtml(rollData, template) },
|
||||
userName)
|
||||
}
|
||||
|
||||
static _buildAjustements(rollData) {
|
||||
let list = [];
|
||||
if (rollData.competence) {
|
||||
list.push({ label: rollData.competence.name, value: rollData.competence.data.niveau });
|
||||
}
|
||||
if (rollData.tactique) {
|
||||
const surprise = RdDBonus.find(rollData.tactique);
|
||||
list.push({ label: surprise.descr, value: surprise.attaque });
|
||||
}
|
||||
if (rollData.surpriseDefenseur) {
|
||||
const surprise = RdDBonus.find(rollData.surpriseDefenseur);
|
||||
list.push({ label: surprise.descr, value: surprise.attaque });
|
||||
}
|
||||
if (rollData.diffLibre != undefined) {
|
||||
const label = 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: 'Etat', value: rollData.etat });
|
||||
}
|
||||
if (rollData.selectedCarac?.label == 'Volonté' && rollData.moral != undefined) {
|
||||
list.push({ label: 'Moral', value: rollData.moral });
|
||||
}
|
||||
if (RdDResolutionTable.isAjustementAstrologique(rollData)) {
|
||||
list.push({ label: 'Astrologique', value: rollData.ajustementAstrologique ?? 0 });
|
||||
}
|
||||
if (rollData.rolled.bonus && rollData.selectedSort) {
|
||||
list.push({ descr: `Bonus de case: ${rollData.rolled.bonus}%` });
|
||||
}
|
||||
if (rollData.diviseur > 1) {
|
||||
list.push({ descr: `Facteur significative ×${RdDResolutionTable._getFractionHtml(rollData.diviseur)}` });
|
||||
}
|
||||
if (RdDCombat.isAttaqueFinesse(rollData.attackerRoll)) {
|
||||
list.push({ descr: 'Attaque particulière en finesse' });
|
||||
}
|
||||
if (rollData.needParadeSignificative) {
|
||||
const catAttaque = RdDItemArme.getNomCategorieParade(rollData.attackerRoll.arme);
|
||||
const catParade = RdDItemArme.getNomCategorieParade(rollData.arme);
|
||||
list.push({ descr: `${catAttaque} vs ${catParade}` });
|
||||
}
|
||||
if (rollData.surprise) {
|
||||
list.push({ descr: RdDBonus.find(rollData.surprise).descr });
|
||||
}
|
||||
return list;
|
||||
}
|
||||
static _getFractionHtml(diviseur) {
|
||||
if (!diviseur || diviseur <= 1) return undefined;
|
||||
switch (diviseur || 1) {
|
||||
case 2: return '½';
|
||||
case 4: return '¼';
|
||||
default: return '1/' + diviseur;
|
||||
}
|
||||
static async buildRollDataHtml(rollData, actor, template = 'chat-resultat-general.html') {
|
||||
rollData.show = rollData.show || {};
|
||||
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -182,7 +120,7 @@ export class RdDResolutionTable {
|
||||
rolled.caracValue = caracValue;
|
||||
rolled.finalLevel = finalLevel;
|
||||
rolled.bonus = bonus;
|
||||
rolled.factorHtml = RdDResolutionTable._getFractionHtml(diviseur);
|
||||
rolled.factorHtml = Misc.getFractionHtml(diviseur);
|
||||
return rolled;
|
||||
}
|
||||
|
||||
@ -225,10 +163,10 @@ export class RdDResolutionTable {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isAjustementAstrologique(rollData) {
|
||||
if (rollData.selectedCarac && rollData.selectedCarac.label.toLowerCase().includes('chance')) {
|
||||
if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) {
|
||||
return true;
|
||||
}
|
||||
if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
|
||||
if (rollData.selectedSort?.data.isrituel) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -323,12 +261,12 @@ export class RdDResolutionTable {
|
||||
/* -------------------------------------------- */
|
||||
static buildHTMLResults(caracValue, levelValue) {
|
||||
let cell = this.computeChances(caracValue, levelValue);
|
||||
cell.epart = cell.epart>99? 'N/A' : cell.epart;
|
||||
cell.etotal = cell.etotal>100? 'N/A' : cell.etotal;
|
||||
cell.epart = cell.epart > 99 ? 'N/A' : cell.epart;
|
||||
cell.etotal = cell.etotal > 100 ? 'N/A' : cell.etotal;
|
||||
cell.score = Math.min(cell.score, 99);
|
||||
|
||||
return `
|
||||
<span class="span-valeur competence-label">
|
||||
<span class="table-proba-reussite competence-label">
|
||||
Particulière: <span class="rdd-roll-part">${cell.part}</span>
|
||||
- Significative: <span class="rdd-roll-sign">${cell.sign}</span>
|
||||
- Réussite: <span class="rdd-roll-norm">${cell.score}</span>
|
||||
|
Reference in New Issue
Block a user