Merge branch 'main' into development

This commit is contained in:
WBHarry 2026-01-22 20:59:32 +01:00
commit 68b35970f2
9 changed files with 43 additions and 14 deletions

View file

@ -2535,6 +2535,7 @@
"itemFeatures": "Item Features",
"nrChoices": "# Moves Per Rest",
"resetMovesTitle": "Reset {type} Downtime Moves",
"resetItemFeaturesTitle": "Reset {type}",
"resetMovesText": "Are you sure you want to reset?",
"FIELDS": {
"maxFear": { "label": "Max Fear" },

View file

@ -36,7 +36,8 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
addItem: this.addItem,
editItem: this.editItem,
removeItem: this.removeItem,
resetMoves: this.resetMoves,
resetDowntimeMoves: this.resetDowntimeMoves,
resetItemFeatures: this.resetItemFeatures,
addDomain: this.addDomain,
toggleSelectedDomain: this.toggleSelectedDomain,
deleteDomain: this.deleteDomain,
@ -232,7 +233,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
this.render();
}
static async resetMoves(_, target) {
static async resetDowntimeMoves(_, target) {
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.SETTINGS.Homebrew.resetMovesTitle', {
@ -266,7 +267,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
...move,
name: game.i18n.localize(move.name),
description: game.i18n.localize(move.description),
actions: move.actions.reduce((acc, key) => {
actions: Object.keys(move.actions).reduce((acc, key) => {
const action = move.actions[key];
acc[key] = {
...action,
@ -293,6 +294,31 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
this.render();
}
static async resetItemFeatures(_, target) {
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.SETTINGS.Homebrew.resetItemFeaturesTitle', {
type: game.i18n.localize(`DAGGERHEART.GENERAL.${target.dataset.type}`)
})
},
content: game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.resetMovesText')
});
if (!confirmed) return;
await this.settings.updateSource({
[`itemFeatures.${target.dataset.type}`]: Object.keys(
this.settings.itemFeatures[target.dataset.type]
).reduce((acc, key) => {
acc[`-=${key}`] = null;
return acc;
}, {})
});
this.render();
}
static async addDomain(event) {
event.preventDefault();
const content = new foundry.data.fields.StringField({

View file

@ -42,8 +42,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
this.combats
.find(x => x.active)
?.system?.extendedBattleToggles?.reduce((acc, toggle) => (acc ?? 0) + toggle.category, null) ?? null;
const maxBP = CONFIG.DH.ENCOUNTER.BaseBPPerEncounter(context.characters.length) + modifierBP;
const currentBP = AdversaryBPPerEncounter(context.adversaries, context.characters);
const maxBP = CONFIG.DH.ENCOUNTER.BaseBPPerEncounter(context.allCharacters.length) + modifierBP;
const currentBP = AdversaryBPPerEncounter(context.adversaries, context.allCharacters);
Object.assign(context, {
fear: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear),
@ -73,9 +73,8 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
Object.assign(context, {
actionTokens: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).actionTokens,
adversaries,
characters: characters
?.filter(x => !x.isNPC)
.filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0),
allCharacters: characters,
characters: characters.filter(x => !spotlightQueueEnabled || x.system.spotlight.requestOrderIndex == 0),
spotlightRequests
});
}

View file

@ -76,6 +76,8 @@ export default class DhEffectsDisplay extends HandlebarsApplicationMixin(Applica
};
toggleHidden(token, focused) {
if (!this.element) return;
const effects = DhEffectsDisplay.getTokenEffects(focused ? token : null);
this.element.hidden = effects.length === 0;

View file

@ -241,6 +241,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
hasHealing: this.hasHealing,
hasEffect: this.hasEffect,
hasSave: this.hasSave,
onSave: this.save?.damageMod,
isDirect: !!this.damage?.direct,
selectedRollMode: game.settings.get('core', 'rollMode'),
data: this.getRollData(),

View file

@ -607,7 +607,7 @@ export default class DhpActor extends Actor {
if (!updates.length) return;
const hpDamage = updates.find(u => u.key === CONFIG.DH.GENERAL.healingTypes.hitPoints.id);
if (hpDamage) {
if (hpDamage?.value) {
hpDamage.value = this.convertDamageToThreshold(hpDamage.value);
if (
this.type === 'character' &&

View file

@ -188,7 +188,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
config = foundry.utils.deepClone(this.system);
config.event = event;
if (this.system.onSave) {
if (config.hasSave) {
const pendingingSaves = targets.filter(t => t.saved.success === null);
if (pendingingSaves.length) {
const confirm = await foundry.applications.api.DialogV2.confirm({

View file

@ -10,7 +10,7 @@
<legend>
{{localize "DAGGERHEART.APPLICATIONS.Downtime.longRest.title"}}
<a data-action="addItem" data-type="longRest"><i class="fa-solid fa-plus"></i></a>
<a data-action="resetMoves" data-type="longRest"><i class="fa-solid fa-arrow-rotate-left"></i></a>
<a data-action="resetDowntimeMoves" data-type="longRest"><i class="fa-solid fa-arrow-rotate-left"></i></a>
</legend>
<div class="form-group setting-group-field">
@ -31,7 +31,7 @@
<legend>
{{localize "DAGGERHEART.APPLICATIONS.Downtime.shortRest.title"}}
<a data-action="addItem" data-type="shortRest"><i class="fa-solid fa-plus"></i></a>
<a data-action="resetMoves" data-type="shortRest"><i class="fa-solid fa-arrow-rotate-left"></i></a>
<a data-action="resetDowntimeMoves" data-type="shortRest"><i class="fa-solid fa-arrow-rotate-left"></i></a>
</legend>
<div class="form-group setting-group-field">

View file

@ -8,7 +8,7 @@
<legend>
{{localize "DAGGERHEART.GENERAL.weaponFeatures"}}
<a data-action="addItem" data-type="weaponFeatures"><i class="fa-solid fa-plus"></i></a>
<a data-action="resetMoves" data-type="weaponFeatures"><i class="fa-solid fa-arrow-rotate-left"></i></a>
<a data-action="resetItemFeatures" data-type="weaponFeatures"><i class="fa-solid fa-arrow-rotate-left"></i></a>
</legend>
<div class="settings-items">
@ -22,7 +22,7 @@
<legend>
{{localize "DAGGERHEART.GENERAL.armorFeatures"}}
<a data-action="addItem" data-type="armorFeatures"><i class="fa-solid fa-plus"></i></a>
<a data-action="resetMoves" data-type="armorFeatures"><i class="fa-solid fa-arrow-rotate-left"></i></a>
<a data-action="resetItemFeatures" data-type="armorFeatures"><i class="fa-solid fa-arrow-rotate-left"></i></a>
</legend>
<div class="settings-items">