Skip to content

Commit c96e1a4

Browse files
committed
Make sure inline weapon effects last until end of scene
1 parent dc8a2f8 commit c96e1a4

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

module/helpers/inline-effects.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ function createStatusAnchor(effectValue, status, config) {
8585
return anchor;
8686
}
8787

88+
/**
89+
* @typedef InlineEffectConfiguration
90+
* @property {String} name
91+
* @property {FUEffectDuration} event e:
92+
* @property {Number} interval i:
93+
* @property {String} tracking t:
94+
*/
95+
8896
/**
8997
* @param match
9098
* @returns {InlineEffectConfiguration}

module/helpers/inline-weapon.mjs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,21 @@ function createAlterDamageTypeEffect(weapon, type, label) {
112112
key = 'system.data.damage.type';
113113
}
114114
const localizedDamageType = game.i18n.localize(`FU.Damage${StringUtils.capitalize(type)}`);
115+
let changes = [];
116+
if (key) {
117+
changes.push({
118+
key: key,
119+
mode: CONST.ACTIVE_EFFECT_MODES.OVERRIDE,
120+
value: type,
121+
});
122+
}
115123

116124
return {
117125
fuid: `alter-damage-type-${type}`,
118126
name: label ? `${label} (${localizedDamageType})` : game.i18n.format('FU.InlineWeaponActiveEffectName', { damageType: localizedDamageType }),
119127
img: type === 'untyped' ? 'icons/svg/circle.svg' : `systems/projectfu/styles/static/affinities/${type}.svg`,
120128
transfer: false,
121-
changes: key
122-
? [
123-
{
124-
key: key,
125-
mode: CONST.ACTIVE_EFFECT_MODES.OVERRIDE,
126-
value: type,
127-
},
128-
]
129-
: [],
129+
changes: changes,
130130
};
131131
}
132132

@@ -151,6 +151,7 @@ async function applyEffectToWeapon(actor, sourceInfo, choices, config) {
151151
const effectData = createAlterDamageTypeEffect(weapon, choice, config.name);
152152
// The name is modified
153153
config.name = effectData.name;
154+
config.event = 'endOfScene';
154155

155156
Effects.applyEffect(weapon, effectData, sourceInfo, config).then((effect) => {
156157
console.info(`Created effect: ${effect.uuid} on weapon uuid: ${weapon.uuid}`);

module/pipelines/effects.mjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,6 @@ function isStatusEffect(id) {
312312
return id in Effects.STATUS_EFFECTS || id in Effects.BOONS_AND_BANES;
313313
}
314314

315-
/**
316-
* @typedef InlineEffectConfiguration
317-
* @property {String} name
318-
* @property {String} event e:
319-
* @property {Number} interval i:
320-
* @property {String} tracking t:
321-
*/
322-
323315
/**
324316
* A helper function to toggle a status effect on an Actor.
325317
* Designed based off TokenDocument#toggleActiveEffect to properly interact with token hud.

0 commit comments

Comments
 (0)