mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-08 06:56:12 +01:00
Added duration to all tier1 adversaries
This commit is contained in:
parent
0ba17117ea
commit
3d672baddf
22 changed files with 337 additions and 144 deletions
|
|
@ -186,4 +186,13 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
else durationDescription.classList.remove('visible');
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
_processFormData(event, form, formData) {
|
||||
const submitData = super._processFormData(event, form, formData);
|
||||
if (submitData.start && !submitData.start.time) submitData.start.time = '0';
|
||||
else if (!submitData) submitData.start = null;
|
||||
|
||||
return submitData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { AdversaryBPPerEncounter } from '../../config/encounterConfig.mjs';
|
||||
import { expireActiveEffects } from '../../helpers/utils.mjs';
|
||||
|
||||
export default class DhCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
||||
static DEFAULT_OPTIONS = {
|
||||
|
|
@ -177,6 +178,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
|||
if (autoPoints) {
|
||||
update.system.actionTokens = Math.max(combatant.system.actionTokens - 1, 0);
|
||||
}
|
||||
|
||||
if (combatant.actor) expireActiveEffects(combatant.actor, [CONFIG.DH.GENERAL.activeEffectDurations.act.id]);
|
||||
}
|
||||
|
||||
await this.viewed.update({
|
||||
|
|
|
|||
|
|
@ -789,6 +789,10 @@ export const activeEffectDurations = {
|
|||
id: 'temporary',
|
||||
label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.temporary'
|
||||
},
|
||||
act: {
|
||||
id: 'act',
|
||||
label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.act'
|
||||
},
|
||||
scene: {
|
||||
id: 'scene',
|
||||
label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.scene'
|
||||
|
|
|
|||
|
|
@ -491,6 +491,12 @@ export function refreshIsAllowed(allowedTypes, typeToCheck) {
|
|||
}
|
||||
}
|
||||
|
||||
function expireActiveEffectIsAllowed(allowedTypes, typeToCheck) {
|
||||
if (typeToCheck === CONFIG.DH.GENERAL.activeEffectDurations.act.id) return true;
|
||||
|
||||
return refreshIsAllowed(allowedTypes, typeToCheck);
|
||||
}
|
||||
|
||||
export function expireActiveEffects(actor, allowedTypes = null) {
|
||||
const shouldExpireEffects = game.settings.get(
|
||||
CONFIG.DH.id,
|
||||
|
|
@ -506,7 +512,7 @@ export function expireActiveEffects(actor, allowedTypes = null) {
|
|||
const { temporary, custom } = CONFIG.DH.GENERAL.activeEffectDurations;
|
||||
if ([temporary.id, custom.id].includes(effect.system.duration.type)) return false;
|
||||
|
||||
return refreshIsAllowed(allowedTypes, effect.system.duration.type);
|
||||
return expireActiveEffectIsAllowed(allowedTypes, effect.system.duration.type);
|
||||
})
|
||||
.map(x => x.id);
|
||||
|
||||
|
|
@ -527,6 +533,8 @@ export function htmlToText(html) {
|
|||
|
||||
export function getIconVisibleActiveEffects(effects) {
|
||||
return effects.filter(effect => {
|
||||
if (!(effect instanceof game.system.api.documents.DhActiveEffect)) return true;
|
||||
|
||||
const alwaysShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.ALWAYS;
|
||||
const conditionalShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.CONDITIONAL && !effect.transfer; // TODO: system specific logic
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue