Corrections sur les ajustements
- le malus de sur-encombrement est correctement calculé (dans la zone d'état) - par défaut, le sur-encombrement est appliqué - le sur-encombrement est affiché sur les actions physiques - l'encombrement s'applique à agilité/dérobée, avec natation/acrobatie (par défaut) - le moral est géré dans le noeud 'use' du rollData - le moral est associé aux actions physiques
This commit is contained in:
parent
7698147e97
commit
9992b64cae
@ -1292,7 +1292,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
isSurenc() {
|
||||
return this.isPersonnage() ? (this.system.compteurs.surenc.value < 0) : false
|
||||
return this.isPersonnage() ? (this.computeMalusSurEncombrement() < 0) : false
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1303,6 +1303,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
return Math.min(0, this.getEncombrementMax() - Math.ceil(Number(this.getEncTotal())));
|
||||
}
|
||||
|
||||
getMessageSurEncombrement() {
|
||||
return this.computeMalusSurEncombrement() < 0 ? "Sur-Encombrement!" : "";
|
||||
}
|
||||
@ -1337,17 +1338,15 @@ export class RdDActor extends Actor {
|
||||
async computeEncombrementTotalEtMalusArmure() {
|
||||
if (!this.pack) {
|
||||
await this.computeMalusArmure();
|
||||
return this.computeEncombrement();
|
||||
this.encTotal = this.items.map(it => it.getEncTotal()).reduce(Misc.sum(), 0);
|
||||
if (!this.isVehicule()) {
|
||||
this.system.compteurs.surenc.value = this.computeMalusSurEncombrement();
|
||||
}
|
||||
return this.encTotal;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeEncombrement() {
|
||||
this.encTotal = this.items.map(it => it.getEncTotal()).reduce(Misc.sum(), 0);
|
||||
return this.encTotal;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeMalusArmure() {
|
||||
if (this.isPersonnage()) {
|
||||
@ -1419,9 +1418,6 @@ export class RdDActor extends Actor {
|
||||
state += Math.min(0, (compteurs.ethylisme?.value ?? 0));
|
||||
|
||||
compteurs.etat.value = state;
|
||||
if (compteurs?.surenc) {
|
||||
compteurs.surenc.value = this.computeMalusSurEncombrement();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2273,7 +2269,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async _appliquerAppelMoral(rollData) {
|
||||
if (!this.isPersonnage()) return;
|
||||
if (!rollData.useMoral) return;
|
||||
if (!rollData.use.moral) return;
|
||||
if (rollData.rolled.isEchec ||
|
||||
(rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) {
|
||||
rollData.perteMoralEchec = rollData.moral <= -3 ? 'dissolution' : 'perte';
|
||||
|
@ -52,6 +52,11 @@ export class RdDCarac {
|
||||
return selectedCarac?.label?.toLowerCase()?.match(/r(e|ê)ve(( |-)actuel)?/);
|
||||
}
|
||||
|
||||
static isActionPhysique(selectedCarac) {
|
||||
return !selectedCarac ||
|
||||
selectedCarac?.label.match(/(Apparence|Force|Agilité|Dextérité|Vue|Ouïe|Odorat-Goût|Empathie|Dérobée|Mêlée|Tir|Lancer)/);
|
||||
}
|
||||
|
||||
static isIgnoreEtatGeneral(rollData) {
|
||||
const selectedCarac = rollData.selectedCarac;
|
||||
return !selectedCarac ||
|
||||
|
@ -38,28 +38,27 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _setDefaultOptions(actor, rollData) {
|
||||
const actorData = actor.system
|
||||
let defaultRollData = {
|
||||
alias: actor.name,
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: actor.getEtatGeneral(),
|
||||
moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */
|
||||
carac: actorData.carac,
|
||||
carac: actor.system.carac,
|
||||
finalLevel: 0,
|
||||
diffConditions: 0,
|
||||
diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
|
||||
malusArmureValue: actor.getMalusArmure(),
|
||||
surencMalusValue: actor.computeMalusSurEncombrement(),
|
||||
useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
|
||||
perteMoralEchec: false, /* Pour l'affichage dans le chat */
|
||||
use: {
|
||||
moral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
|
||||
libre: true,
|
||||
conditions: true,
|
||||
surenc: false,
|
||||
encTotal: false
|
||||
surenc: actor.isSurenc(),
|
||||
encTotal: true
|
||||
},
|
||||
isMalusEncombrementTotal: rollData.competence ? RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) : 0,
|
||||
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
malusArmureValue: actor.getMalusArmure(),
|
||||
surencMalusValue: actor.computeMalusSurEncombrement(),
|
||||
encTotal: actor.getEncTotal(),
|
||||
ajustementAstrologique: actor.ajustementAstrologique(),
|
||||
surprise: actor.getSurprise(false),
|
||||
@ -68,8 +67,8 @@ export class RdDRoll extends Dialog {
|
||||
forceDiceResult: -1
|
||||
}
|
||||
// Mini patch :Ajout du rêve actuel
|
||||
if ( actorData.type == "personnage") {
|
||||
defaultRollData.carac["reve-actuel"] = actorData.reve.reve
|
||||
if ( actor.system.type == "personnage") {
|
||||
defaultRollData.carac["reve-actuel"] = actor.system.reve.reve
|
||||
}
|
||||
|
||||
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
|
||||
@ -260,10 +259,10 @@ export class RdDRoll extends Dialog {
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('.appel-moral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */
|
||||
this.rollData.useMoral = !this.rollData.useMoral;
|
||||
this.rollData.use.moral = !this.rollData.use.moral;
|
||||
const appelMoral = html.find('.icon-appel-moral')[0];
|
||||
const tooltip = html.find('.tooltipAppelAuMoralText')[0];
|
||||
if (this.rollData.useMoral) {
|
||||
if (this.rollData.use.moral) {
|
||||
if (this.rollData.moral > 0) {
|
||||
tooltip.innerHTML = "Appel au moral";
|
||||
appelMoral.src = "/systems/foundryvtt-reve-de-dragon/icons/moral-heureux.svg";
|
||||
@ -334,8 +333,9 @@ export class RdDRoll extends Dialog {
|
||||
RollDataAjustements.calcul(rollData, this.actor);
|
||||
rollData.finalLevel = this._computeFinalLevel(rollData);
|
||||
|
||||
HtmlUtility._showControlWhen($(".use-encTotal"), rollData.ajustements.encTotal.visible);
|
||||
HtmlUtility._showControlWhen($(".use-surenc"), rollData.ajustements.surenc.visible);
|
||||
HtmlUtility._showControlWhen($(".use-encTotal"), rollData.ajustements.encTotal.visible && RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac));
|
||||
HtmlUtility._showControlWhen($(".use-surenc"), rollData.ajustements.surenc.visible && RdDCarac.isActionPhysique(rollData.selectedCarac));
|
||||
HtmlUtility._showControlWhen($(".utilisation-moral"), rollData.use.appelAuMoral);
|
||||
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
|
||||
HtmlUtility._showControlWhen($(".divAppelAuMoral"), rollData.use.appelAuMoral);
|
||||
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData));
|
||||
|
@ -14,6 +14,7 @@ import { RdDPossession } from "./rdd-possession.js";
|
||||
import { RdDNameGen } from "./rdd-namegen.js";
|
||||
import { RdDConfirm } from "./rdd-confirm.js";
|
||||
import { RdDCalendrier } from "./rdd-calendrier.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// This table starts at 0 -> niveau -10
|
||||
|
@ -62,8 +62,8 @@ export const referenceAjustements = {
|
||||
getValue: (rollData, actor) => actor.getMalusArmure()
|
||||
},
|
||||
encTotal: {
|
||||
isVisible: (rollData, actor) => RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
isUsed: (rollData, actor) => rollData.use.encTotal,
|
||||
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
isUsed: (rollData, actor) => RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use.encTotal,
|
||||
getLabel: (rollData, actor) => 'Encombrement total',
|
||||
getValue: (rollData, actor) => -actor.getEncTotal()
|
||||
},
|
||||
@ -74,8 +74,8 @@ export const referenceAjustements = {
|
||||
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
|
||||
},
|
||||
moral: {
|
||||
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.useMoral,
|
||||
isUsed: (rollData, actor) => rollData.useMoral,
|
||||
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use.moral,
|
||||
isUsed: (rollData, actor) => rollData.use.moral,
|
||||
getLabel: (rollData, actor) => 'Appel au moral',
|
||||
getValue: (rollData, actor) => 1
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#if useMoral}}
|
||||
{{#if use.moral}}
|
||||
<span>
|
||||
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}}
|
||||
{{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!.
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="flexrow use-encTotal">
|
||||
<label>
|
||||
Appliquer l'encombrement comme malus ({{encTotal}})
|
||||
<input class="attribute-value use-encTotal" type="checkbox" {{#if use.encTotal}}checked{{/if}}/>
|
||||
Appliquer l'encombrement comme malus ({{encTotal}}) ?
|
||||
</label>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="flexrow">
|
||||
<div class="flexrow utilisation-moral">
|
||||
<label class="diffMoral">Moral: {{#if (gt moral 0)}}+{{/if}}{{moral}}</label>
|
||||
<div class="tooltipAppelAuMoral divAppelAuMoral">
|
||||
<a class="appel-moral">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="flexrow use-surenc">
|
||||
<label>
|
||||
<input class="attribute-value use-surenc" type="checkbox" {{#if useMalusSurenc}}checked{{/if}}/>
|
||||
Appliquer le sur-encombrement
|
||||
<input class="attribute-value use-surenc" type="checkbox" {{#if use.surenc}}checked{{/if}}/>
|
||||
</label>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user