Fixed so effects are only applied to correct tokens (#1439)

This commit is contained in:
WBHarry 2025-12-18 23:55:25 +01:00 committed by GitHub
parent 0936b46926
commit 27fe83d906
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 11 deletions

View file

@ -5,8 +5,7 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
actions: { actions: {
requestSpotlight: this.requestSpotlight, requestSpotlight: this.requestSpotlight,
toggleSpotlight: this.toggleSpotlight, toggleSpotlight: this.toggleSpotlight,
setActionTokens: this.setActionTokens, setActionTokens: this.setActionTokens
openCountdowns: this.openCountdowns
} }
}; };
@ -57,7 +56,10 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
const adversaries = context.turns?.filter(x => x.isNPC) ?? []; const adversaries = context.turns?.filter(x => x.isNPC) ?? [];
const characters = context.turns?.filter(x => !x.isNPC) ?? []; const characters = context.turns?.filter(x => !x.isNPC) ?? [];
const spotlightQueueEnabled = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.SpotlightRequestQueue); const spotlightQueueEnabled = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.SpotlightRequestQueue
);
const spotlightRequests = characters const spotlightRequests = characters
?.filter(x => !x.isNPC && spotlightQueueEnabled) ?.filter(x => !x.isNPC && spotlightQueueEnabled)
@ -71,7 +73,9 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
Object.assign(context, { Object.assign(context, {
actionTokens: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).actionTokens, actionTokens: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).actionTokens,
adversaries, adversaries,
characters: characters?.filter(x => !x.isNPC).filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0), characters: characters
?.filter(x => !x.isNPC)
.filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0),
spotlightRequests spotlightRequests
}); });
} }
@ -162,8 +166,10 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
if (this.viewed.turn !== toggleTurn) { if (this.viewed.turn !== toggleTurn) {
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns; const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
if (combatant.actor.type === 'character') { if (combatant.actor.type === 'character') {
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id, await updateCountdowns(
CONFIG.DH.GENERAL.countdownProgressionTypes.characterSpotlight.id); CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id,
CONFIG.DH.GENERAL.countdownProgressionTypes.characterSpotlight.id
);
} else { } else {
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id); await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id);
} }

View file

@ -84,6 +84,7 @@ export const BPModifiers = {
increaseDamage: { increaseDamage: {
sort: 2, sort: 2,
description: 'DAGGERHEART.CONFIG.BPModifiers.increaseDamage.description', description: 'DAGGERHEART.CONFIG.BPModifiers.increaseDamage.description',
effectTargetTypes: ['adversary'],
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.BPModifiers.increaseDamage.effect.name', name: 'DAGGERHEART.CONFIG.BPModifiers.increaseDamage.effect.name',

View file

@ -28,6 +28,7 @@ export default class DhpCombat extends Combat {
...effect, ...effect,
name: game.i18n.localize(effect.name), name: game.i18n.localize(effect.name),
description: game.i18n.localize(effect.description), description: game.i18n.localize(effect.description),
effectTargetTypes: grouping.effectTargetTypes ?? [],
flags: { flags: {
[`${CONFIG.DH.id}.${CONFIG.DH.FLAGS.combatToggle}`]: { [`${CONFIG.DH.id}.${CONFIG.DH.FLAGS.combatToggle}`]: {
category: toggle.category, category: toggle.category,
@ -45,11 +46,7 @@ export default class DhpCombat extends Combat {
for (let actor of actors) { for (let actor of actors) {
await actor.createEmbeddedDocuments( await actor.createEmbeddedDocuments(
'ActiveEffect', 'ActiveEffect',
effects.map(effect => ({ effects.filter(x => x.effectTargetTypes.includes(actor.type))
...effect,
name: game.i18n.localize(effect.name),
description: game.i18n.localize(effect.description)
}))
); );
} }
} else { } else {