mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Introduced a adversary category split for BP calculation and CombatTracker display based on token disposition
This commit is contained in:
parent
abd7824c96
commit
3f9f4fac17
4 changed files with 24 additions and 4 deletions
|
|
@ -406,7 +406,11 @@
|
||||||
"giveSpotlight": "Give The Spotlight",
|
"giveSpotlight": "Give The Spotlight",
|
||||||
"requestingSpotlight": "Requesting The Spotlight",
|
"requestingSpotlight": "Requesting The Spotlight",
|
||||||
"requestSpotlight": "Request The Spotlight",
|
"requestSpotlight": "Request The Spotlight",
|
||||||
"openCountdowns": "Countdowns"
|
"openCountdowns": "Countdowns",
|
||||||
|
"adversaryCategories": {
|
||||||
|
"friendly": "Friendly",
|
||||||
|
"neutral": "Neutral"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"CompendiumBrowserSettings": {
|
"CompendiumBrowserSettings": {
|
||||||
"title": "Enable Compendiums",
|
"title": "Enable Compendiums",
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,12 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
||||||
async _prepareTrackerContext(context, options) {
|
async _prepareTrackerContext(context, options) {
|
||||||
await super._prepareTrackerContext(context, options);
|
await super._prepareTrackerContext(context, options);
|
||||||
|
|
||||||
const adversaries = context.turns?.filter(x => x.isNPC) ?? [];
|
const npcs = context.turns?.filter(x => x.isNPC) ?? [];
|
||||||
|
const adversaries = npcs.filter(x => x.disposition === CONST.TOKEN_DISPOSITIONS.HOSTILE);
|
||||||
|
const friendlies = npcs.filter(x => x.disposition === CONST.TOKEN_DISPOSITIONS.FRIENDLY);
|
||||||
|
const neutrals = npcs.filter(x =>
|
||||||
|
[CONST.TOKEN_DISPOSITIONS.SECRET, CONST.TOKEN_DISPOSITIONS.NEUTRAL].includes(x.disposition)
|
||||||
|
);
|
||||||
const characters = context.turns?.filter(x => !x.isNPC) ?? [];
|
const characters = context.turns?.filter(x => !x.isNPC) ?? [];
|
||||||
const spotlightQueueEnabled = game.settings.get(
|
const spotlightQueueEnabled = game.settings.get(
|
||||||
CONFIG.DH.id,
|
CONFIG.DH.id,
|
||||||
|
|
@ -75,6 +80,8 @@ 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,
|
||||||
|
friendlies,
|
||||||
|
neutrals,
|
||||||
allCharacters: characters,
|
allCharacters: characters,
|
||||||
characters: characters.filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0),
|
characters: characters.filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0),
|
||||||
spotlightRequests
|
spotlightRequests
|
||||||
|
|
@ -129,7 +136,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
|
||||||
active: index === combat.turn,
|
active: index === combat.turn,
|
||||||
canPing: combatant.sceneId === canvas.scene?.id && game.user.hasPermission('PING_CANVAS'),
|
canPing: combatant.sceneId === canvas.scene?.id && game.user.hasPermission('PING_CANVAS'),
|
||||||
type: combatant.actor?.system?.type,
|
type: combatant.actor?.system?.type,
|
||||||
img: await this._getCombatantThumbnail(combatant)
|
img: await this._getCombatantThumbnail(combatant),
|
||||||
|
disposition: combatant.token.disposition
|
||||||
};
|
};
|
||||||
|
|
||||||
turn.css = [turn.active ? 'active' : null, hidden ? 'hide' : null, isDefeated ? 'defeated' : null].filterJoin(
|
turn.css = [turn.active ? 'active' : null, hidden ? 'hide' : null, isDefeated ? 'defeated' : null].filterJoin(
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,9 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
async getBattlepointHTML(combatId) {
|
async getBattlepointHTML(combatId) {
|
||||||
const combat = game.combats.get(combatId);
|
const combat = game.combats.get(combatId);
|
||||||
const adversaries =
|
const adversaries =
|
||||||
combat.turns?.filter(x => x.actor?.isNPC)?.map(x => ({ ...x.actor, type: x.actor.system.type })) ?? [];
|
combat.turns
|
||||||
|
?.filter(x => x.actor?.isNPC && x.token.disposition === CONST.TOKEN_DISPOSITIONS.HOSTILE)
|
||||||
|
?.map(x => ({ ...x.actor, type: x.actor.system.type })) ?? [];
|
||||||
const characters = combat.turns?.filter(x => !x.isNPC && x.actor) ?? [];
|
const characters = combat.turns?.filter(x => !x.isNPC && x.actor) ?? [];
|
||||||
|
|
||||||
const nrCharacters = characters.length;
|
const nrCharacters = characters.length;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@
|
||||||
{{#if (gt this.characters.length 0)}}
|
{{#if (gt this.characters.length 0)}}
|
||||||
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.GENERAL.Character.plural") turns=this.characters}}
|
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.GENERAL.Character.plural") turns=this.characters}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if (gt this.friendlies.length 0)}}
|
||||||
|
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.APPLICATIONS.CombatTracker.adversaryCategories.friendly") turns=this.friendlies}}
|
||||||
|
{{/if}}
|
||||||
|
{{#if (gt this.neutrals.length 0)}}
|
||||||
|
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.APPLICATIONS.CombatTracker.adversaryCategories.neutral") turns=this.neutrals}}
|
||||||
|
{{/if}}
|
||||||
{{#if (gt this.adversaries.length 0)}}
|
{{#if (gt this.adversaries.length 0)}}
|
||||||
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.GENERAL.Adversary.plural") turns=this.adversaries}}
|
{{> 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.GENERAL.Adversary.plural") turns=this.adversaries}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue