Bloquage des status-effects "obligatoires"

This commit is contained in:
Vincent Vandemeulebrouck 2021-01-13 16:32:25 +01:00
parent 78ca5b9ee1
commit 87412968d0

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,