mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 04:31:07 +01:00
.
This commit is contained in:
parent
410fd19438
commit
378c6b4c67
8 changed files with 381 additions and 249 deletions
|
|
@ -459,7 +459,19 @@ export const allArmorFeatures = () => {
|
|||
...armorFeatures,
|
||||
...Object.keys(homebrewFeatures).reduce((acc, key) => {
|
||||
const feature = homebrewFeatures[key];
|
||||
acc[key] = { ...feature, label: feature.name };
|
||||
const actionEffects = [];
|
||||
const actions = feature.actions.map(action => {
|
||||
const effects = action.effects.map(effect => feature.effects.find(x => x.id === effect._id));
|
||||
actionEffects.push(...effects);
|
||||
return {
|
||||
...action,
|
||||
effects: effects,
|
||||
type: action.type
|
||||
};
|
||||
});
|
||||
const effects = feature.effects.filter(effect => !actionEffects.some(x => x.id === effect.id));
|
||||
|
||||
acc[key] = { ...feature, label: feature.name, effects, actions };
|
||||
return acc;
|
||||
}, {})
|
||||
};
|
||||
|
|
@ -1414,11 +1426,24 @@ export const weaponFeatures = {
|
|||
export const allWeaponFeatures = () => {
|
||||
const homebrewFeatures = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).itemFeatures
|
||||
.weaponFeatures;
|
||||
|
||||
return {
|
||||
...weaponFeatures,
|
||||
...Object.keys(homebrewFeatures).reduce((acc, key) => {
|
||||
const feature = homebrewFeatures[key];
|
||||
acc[key] = { ...feature, label: feature.name };
|
||||
const actionEffects = [];
|
||||
const actions = feature.actions.map(action => {
|
||||
const effects = action.effects.map(effect => feature.effects.find(x => x.id === effect._id));
|
||||
actionEffects.push(...effects);
|
||||
return {
|
||||
...action,
|
||||
effects: effects,
|
||||
type: action.type
|
||||
};
|
||||
});
|
||||
const effects = feature.effects.filter(effect => !actionEffects.some(x => x.id === effect.id));
|
||||
|
||||
acc[key] = { ...feature, label: feature.name, effects, actions };
|
||||
return acc;
|
||||
}, {})
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue