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