Fixed translations. Fixed actions without Effects causing errors in Homebrew ItemFeatures

This commit is contained in:
WBHarry 2026-04-25 18:35:22 +02:00
parent 607ee3b580
commit 702c9e0b6a
6 changed files with 10 additions and 9 deletions

View file

@ -188,8 +188,9 @@ export default class SettingFeatureConfig extends HandlebarsApplicationMixin(App
if (type === 'effect') {
const move = foundry.utils.getProperty(this.settings, this.movePath);
for (const action of move.actions) {
const remainingEffects = action.effects.filter(x => x._id !== id);
if (action.effects.length !== remainingEffects.length) {
const actionEffects = action.effects ?? [];
const remainingEffects = actionEffects.filter(x => x._id !== id);
if (actionEffects.length !== remainingEffects.length) {
await action.update({
effects: remainingEffects.map(x => {
const { _id, ...rest } = x;

View file

@ -172,8 +172,8 @@ export const typeConfig = {
key: 'system.secondary',
label: 'DAGGERHEART.UI.ItemBrowser.subtype',
choices: [
{ value: false, label: 'DAGGERHEART.ITEMS.Weapon.primaryWeapon' },
{ value: true, label: 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon' }
{ value: false, label: 'DAGGERHEART.ITEMS.Weapon.primaryWeapon.short' },
{ value: true, label: 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.short' }
]
},
{

View file

@ -453,7 +453,7 @@ export const allArmorFeatures = () => {
const feature = homebrewFeatures[key];
const actions = feature.actions.map(action => ({
...action,
effects: action.effects.map(effect => feature.effects.find(x => x.id === effect._id)),
effects: action.effects?.map(effect => feature.effects.find(x => x.id === effect._id))??[],
type: action.type
}));
const actionEffects = actions.flatMap(a => a.effects);
@ -1389,7 +1389,7 @@ export const allWeaponFeatures = () => {
const actions = feature.actions.map(action => ({
...action,
effects: action.effects.map(effect => feature.effects.find(x => x.id === effect._id)),
effects: action.effects?.map(effect => feature.effects.find(x => x.id === effect._id))??[],
type: action.type
}));
const actionEffects = actions.flatMap(a => a.effects);

View file

@ -28,7 +28,7 @@ export default class DHWeapon extends AttachableItem {
equipped: new fields.BooleanField({ initial: false }),
//SETTINGS
secondary: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon' }),
secondary: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.full' }),
burden: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.burden,

View file

@ -7,7 +7,7 @@
<legend>{{localize tabs.settings.label}}</legend>
<span>{{localize "DAGGERHEART.GENERAL.Tiers.singular"}}</span>
{{formInput systemFields.tier value=source.system.tier}}
<span>{{localize "DAGGERHEART.ITEMS.Weapon.secondaryWeapon"}}</span>
<span>{{localize "DAGGERHEART.ITEMS.Weapon.secondaryWeapon.full"}}</span>
{{formInput systemFields.secondary value=source.system.secondary}}
<span>{{localize "DAGGERHEART.GENERAL.Trait.single"}}</span>
{{formInput systemFields.attack.fields.roll.fields.trait value=document.system.attack.roll.trait name="system.attack.roll.trait" label="DAGGERHEART.GENERAL.Trait.single" localize=true}}

View file

@ -66,7 +66,7 @@
{{#if (and combats.length user.isGM)}}
<div class="encounter-battlepoints" data-tooltip="#battlepoints#" data-combat-id="{{combat.id}}">
{{battlepoints.current}}/{{battlepoints.max}} BP{{#if battlepoints.hasModifierBP}}*{{/if}}
{{battlepoints.current}}/{{battlepoints.max}} {{localize "DAGGERHEART.GENERAL.Battlepoints.short"}}{{#if battlepoints.hasModifierBP}}*{{/if}}
</div>
{{/if}}