diff --git a/module/actor.js b/module/actor.js index f931bb56..a1d42ac5 100644 --- a/module/actor.js +++ b/module/actor.js @@ -31,7 +31,6 @@ export class RdDActor extends Actor { static init() { Hooks.on("deleteActiveEffect", (actor, effect, options) => actor.onDeleteActiveEffect(effect, options)); Hooks.on("createActiveEffect", (actor, effect, options) => actor.onCreateActiveEffect(effect, options)); - Hooks.on("updateToken", (scene, token, data, options) => { RdDActor.onUpdateToken(scene, token, data, options) }); } /* -------------------------------------------- */ @@ -201,8 +200,9 @@ export class RdDActor extends Actor { getProtectionNaturelle() { return Misc.toInt(this.data.data.attributs.protection.value); } + /* -------------------------------------------- */ getEtatGeneral() { - return this.data.data.compteurs.etat.value; + return this.data.data.compteurs.etat?.value ?? 0; } getMalusArmure() { return this.data.data.attributs?.malusarmure?.value ?? 0; @@ -211,7 +211,7 @@ export class RdDActor extends Actor { return Math.floor(this.encTotal ?? 0); } getSurenc() { - return this.data.data.compteurs?.surenc?.value ?? 0; + return this.data.data.compteurs.surenc?.value ?? 0; } /* -------------------------------------------- */ loadCompendiumNames() { @@ -869,11 +869,6 @@ export class RdDActor extends Actor { return resume; } - /* -------------------------------------------- */ - getEtatGeneral() { - return this.data.data.compteurs?.etat?.value ?? 0; - } - /* -------------------------------------------- */ computeEtatGeneral() { let data = this.data.data; @@ -889,7 +884,7 @@ export class RdDActor extends Actor { state += RdDUtility.currentFatigueMalus(data.sante.fatigue.value, data.sante.endurance.max); } // Ajout de l'éthylisme - state += Math.min(0, (data.compteurs?.ethylisme?.value ?? 0)); + state += Math.min(0, (data.compteurs.ethylisme?.value ?? 0)); data.compteurs.etat.value = state; if (data.compteurs && data.compteurs.surenc) { diff --git a/module/rdd-carac.js b/module/rdd-carac.js index 921bbb6e..ae9cdf26 100644 --- a/module/rdd-carac.js +++ b/module/rdd-carac.js @@ -13,10 +13,10 @@ export class RdDCarac { return selectedCarac?.label?.toLowerCase()?.match(/r(e|ê)ve(( |-)actuel)?/); } - static isIgnoreEtatGeneral(selectedCarac) { + static isIgnoreEtatGeneral(selectedCarac, competence) { return !selectedCarac || RdDCarac.isChance(selectedCarac) || - RdDCarac.isReve(selectedCarac); + (RdDCarac.isReve(selectedCarac) && !competence); } /** diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 6b998e44..de2f3b05 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -210,7 +210,7 @@ export class RdDRoll extends Dialog { rollData.finalLevel = this._computeFinalLevel(rollData); HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); - HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac)); + HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence)); HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData)); // Sort management diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 5eff690d..1929f7ef 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -49,7 +49,7 @@ export const referenceAjustements = { getValue: (rollData, actor) => RdDBonus.find(rollData.surpriseDefenseur).attaque, }, etat: { - isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac), + isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence), getLabel: (rollData, actor) => 'Etat général', getValue: (rollData, actor) => actor.getEtatGeneral() }, diff --git a/module/status-effects.js b/module/status-effects.js index cf420867..b8e6f572 100644 --- a/module/status-effects.js +++ b/module/status-effects.js @@ -1,17 +1,17 @@ +const demiReveStatusEffect = { id: 'demi-reve', rdd: true, label: 'Demi-rêve', icon: 'systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg' }; const rddStatusEffects = [ { id: 'sonne', rdd: true, label: 'Sonné', icon: 'icons/svg/stoned.svg' }, + demiReveStatusEffect ]; -const demiReveStatusEffect = { id: 'demi-reve', rdd: true, label: 'Demi-rêve', icon: 'systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg' }; -const rddPrivateStatusEffects = [demiReveStatusEffect,]; -const statusDemiSurpriseCombat = new Set(['sonne', 'demi-reve', 'prone', 'restrain']); const statusDemiSurprise = new Set(['sonne', 'prone', 'restrain']); const statusSurpriseTotale = new Set(['unconscious', 'blind']); export class StatusEffects { static init() { - StatusEffects.setCoreStatusId(rddPrivateStatusEffects); + StatusEffects.setCoreStatusId([demiReveStatusEffect]); StatusEffects.setCoreStatusId(rddStatusEffects); + StatusEffects.setMandatoryRdd(); const defaultUseStatusEffect = CONFIG.statusEffects.map(it => it.id).join(); game.settings.register("foundryvtt-reve-de-dragon", "use-status-effects", { name: "use-status-effects", @@ -41,8 +41,7 @@ export class StatusEffects { if (statusSurpriseTotale.has(id)) { return 2; } - const status = (isCombat ? statusDemiSurpriseCombat : statusDemiSurprise); - return status.has(id) ? 1 : 0; + return statusDemiSurprise.has(id) || (isCombat && id == demiReveStatusEffect.id) ? 1 : 0; } static statusId(effectData) { @@ -55,6 +54,10 @@ export class StatusEffects { it["flags.core.statusId"] = it.id; }); } + static setMandatoryRdd() { + CONFIG.statusEffects.filter(it => statusDemiSurprise.has(it.id) || statusSurpriseTotale.has(it.id)) + .forEach(it => it.rdd = true); + } static _getUseStatusEffects() { const setting = game.settings.get("foundryvtt-reve-de-dragon", "use-status-effects"); @@ -89,7 +92,7 @@ class StatusEffectsSettings extends FormApplication { mergeObject(options, { id: "status-effects-settings", template: "systems/foundryvtt-reve-de-dragon/templates/status-effects-settings.html", - height: "auto", + height: "800", width: 350, minimizable: false, closeOnSubmit: true, diff --git a/styles/simple.css b/styles/simple.css index 06cfc90d..6eb17d5c 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1341,7 +1341,7 @@ display: inline-flex; } #logo { - content : url("img/logo.png"); - width: 100px; - height: 48px; + content : url(img/logo.png); + width: 80px; + height: 68px; } \ No newline at end of file diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index e98568dd..12e5a346 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -17,7 +17,22 @@