forked from public/foundryvtt-reve-de-dragon
		
	Bloquage des status-effects "obligatoires"
This commit is contained in:
		| @@ -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, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user