Merge branch 'minor-fixes' into 'v1.2'

Minor fixes

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!112
This commit is contained in:
Leratier Bretonnien 2021-01-13 18:10:22 +00:00
commit 4fd09b526a
8 changed files with 39 additions and 28 deletions

View File

@ -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) {

View File

@ -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);
}
/**

View File

@ -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

View File

@ -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()
},

View File

@ -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,

View File

@ -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;
}

View File

@ -17,7 +17,22 @@
<div class="flexrow">
<span>{{data.blessures.resume}}</span>
</div>
</div>
<div class="flexrow">
{{#if data.surprise}}{{data.surprise}}! {{/if}}
{{#if actor.effects}}
{{#each actor.effects as |effect key|}}
<span id="effect-{{effect.flags.core.status.statusId}} ">
<img class="button-effect-img" src="{{effect.icon}}" alt="{{effect.label}}" width="24" height="24" />
</span>
{{/each}}
{{#if data.isGM}}
<span id="enlever-tous-effets"><a>(enlever tout)</a></span>
{{/if}}
{{else}}
Aucun effet actif
{{/if}}
</div>
</div>
</div>
</header>
@ -83,7 +98,6 @@
<span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value"
value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
<img class="button-effect-img" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
</li>
<li class="competence flexrow list-item" data-attribute="etat">
<span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span>

View File

@ -42,7 +42,6 @@
<label class="ctn-sonne">
Sonné :
<input class="resource-content data-sante-sonne" type="checkbox" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
<img class="button-effect-img" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
</label>
</li>
<li>
@ -76,11 +75,11 @@
<span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span>
</div>
<div>
{{#if data.surprise}}{{data.surprise}}! {{/if}}
{{#if actor.effects}}
{{data.surprise}}!
{{#each actor.effects as |effect key|}}
<span id="effect-{{effect.flags.core.status.statusId}} ">
<img class="button-effect-img" src="{{effect.icon}}" alt="{{effect.label}}" width="16" height="16" />
<img class="button-effect-img" src="{{effect.icon}}" alt="{{effect.label}}" width="24" height="24" />
</span>
{{/each}}
{{#if data.isGM}}