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() { static init() {
Hooks.on("deleteActiveEffect", (actor, effect, options) => actor.onDeleteActiveEffect(effect, options)); Hooks.on("deleteActiveEffect", (actor, effect, options) => actor.onDeleteActiveEffect(effect, options));
Hooks.on("createActiveEffect", (actor, effect, options) => actor.onCreateActiveEffect(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() { getProtectionNaturelle() {
return Misc.toInt(this.data.data.attributs.protection.value); return Misc.toInt(this.data.data.attributs.protection.value);
} }
/* -------------------------------------------- */
getEtatGeneral() { getEtatGeneral() {
return this.data.data.compteurs.etat.value; return this.data.data.compteurs.etat?.value ?? 0;
} }
getMalusArmure() { getMalusArmure() {
return this.data.data.attributs?.malusarmure?.value ?? 0; return this.data.data.attributs?.malusarmure?.value ?? 0;
@ -211,7 +211,7 @@ export class RdDActor extends Actor {
return Math.floor(this.encTotal ?? 0); return Math.floor(this.encTotal ?? 0);
} }
getSurenc() { getSurenc() {
return this.data.data.compteurs?.surenc?.value ?? 0; return this.data.data.compteurs.surenc?.value ?? 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
loadCompendiumNames() { loadCompendiumNames() {
@ -869,11 +869,6 @@ export class RdDActor extends Actor {
return resume; return resume;
} }
/* -------------------------------------------- */
getEtatGeneral() {
return this.data.data.compteurs?.etat?.value ?? 0;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
computeEtatGeneral() { computeEtatGeneral() {
let data = this.data.data; 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); state += RdDUtility.currentFatigueMalus(data.sante.fatigue.value, data.sante.endurance.max);
} }
// Ajout de l'éthylisme // 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; data.compteurs.etat.value = state;
if (data.compteurs && data.compteurs.surenc) { if (data.compteurs && data.compteurs.surenc) {

View File

@ -13,10 +13,10 @@ export class RdDCarac {
return selectedCarac?.label?.toLowerCase()?.match(/r(e|ê)ve(( |-)actuel)?/); return selectedCarac?.label?.toLowerCase()?.match(/r(e|ê)ve(( |-)actuel)?/);
} }
static isIgnoreEtatGeneral(selectedCarac) { static isIgnoreEtatGeneral(selectedCarac, competence) {
return !selectedCarac || return !selectedCarac ||
RdDCarac.isChance(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); rollData.finalLevel = this._computeFinalLevel(rollData);
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); 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)); HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData));
// Sort management // Sort management

View File

@ -49,7 +49,7 @@ export const referenceAjustements = {
getValue: (rollData, actor) => RdDBonus.find(rollData.surpriseDefenseur).attaque, getValue: (rollData, actor) => RdDBonus.find(rollData.surpriseDefenseur).attaque,
}, },
etat: { etat: {
isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac), isUsed: (rollData, actor) => !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence),
getLabel: (rollData, actor) => 'Etat général', getLabel: (rollData, actor) => 'Etat général',
getValue: (rollData, actor) => actor.getEtatGeneral() 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 = [ const rddStatusEffects = [
{ id: 'sonne', rdd: true, label: 'Sonné', icon: 'icons/svg/stoned.svg' }, { 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 statusDemiSurprise = new Set(['sonne', 'prone', 'restrain']);
const statusSurpriseTotale = new Set(['unconscious', 'blind']); const statusSurpriseTotale = new Set(['unconscious', 'blind']);
export class StatusEffects { export class StatusEffects {
static init() { static init() {
StatusEffects.setCoreStatusId(rddPrivateStatusEffects); StatusEffects.setCoreStatusId([demiReveStatusEffect]);
StatusEffects.setCoreStatusId(rddStatusEffects); StatusEffects.setCoreStatusId(rddStatusEffects);
StatusEffects.setMandatoryRdd();
const defaultUseStatusEffect = CONFIG.statusEffects.map(it => it.id).join(); const defaultUseStatusEffect = CONFIG.statusEffects.map(it => it.id).join();
game.settings.register("foundryvtt-reve-de-dragon", "use-status-effects", { game.settings.register("foundryvtt-reve-de-dragon", "use-status-effects", {
name: "use-status-effects", name: "use-status-effects",
@ -41,8 +41,7 @@ export class StatusEffects {
if (statusSurpriseTotale.has(id)) { if (statusSurpriseTotale.has(id)) {
return 2; return 2;
} }
const status = (isCombat ? statusDemiSurpriseCombat : statusDemiSurprise); return statusDemiSurprise.has(id) || (isCombat && id == demiReveStatusEffect.id) ? 1 : 0;
return status.has(id) ? 1 : 0;
} }
static statusId(effectData) { static statusId(effectData) {
@ -55,6 +54,10 @@ export class StatusEffects {
it["flags.core.statusId"] = it.id; 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() { static _getUseStatusEffects() {
const setting = game.settings.get("foundryvtt-reve-de-dragon", "use-status-effects"); const setting = game.settings.get("foundryvtt-reve-de-dragon", "use-status-effects");
@ -89,7 +92,7 @@ class StatusEffectsSettings extends FormApplication {
mergeObject(options, { mergeObject(options, {
id: "status-effects-settings", id: "status-effects-settings",
template: "systems/foundryvtt-reve-de-dragon/templates/status-effects-settings.html", template: "systems/foundryvtt-reve-de-dragon/templates/status-effects-settings.html",
height: "auto", height: "800",
width: 350, width: 350,
minimizable: false, minimizable: false,
closeOnSubmit: true, closeOnSubmit: true,

View File

@ -1341,7 +1341,7 @@ display: inline-flex;
} }
#logo { #logo {
content : url("img/logo.png"); content : url(img/logo.png);
width: 100px; width: 80px;
height: 48px; height: 68px;
} }

View File

@ -17,6 +17,21 @@
<div class="flexrow"> <div class="flexrow">
<span>{{data.blessures.resume}}</span> <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>
</div> </div>
</header> </header>
@ -83,7 +98,6 @@
<span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span> <span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" <input class="resource-content" type="checkbox" name="data.sante.sonne.value"
value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} /> 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>
<li class="competence flexrow list-item" data-attribute="etat"> <li class="competence flexrow list-item" data-attribute="etat">
<span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span> <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"> <label class="ctn-sonne">
Sonné : Sonné :
<input class="resource-content data-sante-sonne" type="checkbox" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} /> <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> </label>
</li> </li>
<li> <li>
@ -76,11 +75,11 @@
<span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span> <span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span>
</div> </div>
<div> <div>
{{#if data.surprise}}{{data.surprise}}! {{/if}}
{{#if actor.effects}} {{#if actor.effects}}
{{data.surprise}}!
{{#each actor.effects as |effect key|}} {{#each actor.effects as |effect key|}}
<span id="effect-{{effect.flags.core.status.statusId}} "> <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> </span>
{{/each}} {{/each}}
{{#if data.isGM}} {{#if data.isGM}}