mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fixed so active effects can handle expressions again (#368)
This commit is contained in:
parent
6e87e4dad0
commit
1d75b08087
3 changed files with 19 additions and 18 deletions
10
lang/en.json
10
lang/en.json
|
|
@ -777,7 +777,7 @@
|
||||||
"WeaponFeature": {
|
"WeaponFeature": {
|
||||||
"barrier": {
|
"barrier": {
|
||||||
"name": "Barrier",
|
"name": "Barrier",
|
||||||
"description": "+{armorScore} to Armor Score; -1 to Evasion"
|
"description": "Gain your character's Tier + 1 to Armor Score; -1 to Evasion"
|
||||||
},
|
},
|
||||||
"bonded": {
|
"bonded": {
|
||||||
"name": "Bonded",
|
"name": "Bonded",
|
||||||
|
|
@ -893,7 +893,7 @@
|
||||||
},
|
},
|
||||||
"paired": {
|
"paired": {
|
||||||
"name": "Paired",
|
"name": "Paired",
|
||||||
"description": "+{bonusDamage} to primary weapon damage to targets within Melee range"
|
"description": "Add your character's Tier + 1 to primary weapon damage against targets within Melee range"
|
||||||
},
|
},
|
||||||
"parry": {
|
"parry": {
|
||||||
"name": "Parry",
|
"name": "Parry",
|
||||||
|
|
@ -913,7 +913,7 @@
|
||||||
},
|
},
|
||||||
"protective": {
|
"protective": {
|
||||||
"name": "Protective",
|
"name": "Protective",
|
||||||
"description": "+{tier} to Armor Score"
|
"description": "Add your character's Tier to your Armor Score"
|
||||||
},
|
},
|
||||||
"quick": {
|
"quick": {
|
||||||
"name": "Quick",
|
"name": "Quick",
|
||||||
|
|
@ -962,10 +962,6 @@
|
||||||
"timebending": {
|
"timebending": {
|
||||||
"name": "Timebending",
|
"name": "Timebending",
|
||||||
"description": "You can choose the target of your attack after making your attack roll."
|
"description": "You can choose the target of your attack after making your attack roll."
|
||||||
},
|
|
||||||
"versatile": {
|
|
||||||
"name": "Versatile",
|
|
||||||
"description": "This weapon can also be used with these statistics—{characterTrait}, {range}, {damage}."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ export const weaponFeatures = {
|
||||||
{
|
{
|
||||||
key: 'system.bonuses.damage.primaryWeapon.bonus',
|
key: 'system.bonuses.damage.primaryWeapon.bonus',
|
||||||
mode: 2,
|
mode: 2,
|
||||||
value: '@system.levelData.levels.current'
|
value: '@system.levelData.level.current'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1261,15 +1261,6 @@ export const weaponFeatures = {
|
||||||
timebending: {
|
timebending: {
|
||||||
label: 'DAGGERHEART.CONFIG.WeaponFeature.timebending.name',
|
label: 'DAGGERHEART.CONFIG.WeaponFeature.timebending.name',
|
||||||
description: 'DAGGERHEART.CONFIG.WeaponFeature.timebending.description'
|
description: 'DAGGERHEART.CONFIG.WeaponFeature.timebending.description'
|
||||||
},
|
|
||||||
versatile: {
|
|
||||||
label: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.name',
|
|
||||||
description: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.description'
|
|
||||||
// versatile: {
|
|
||||||
// characterTrait: '',
|
|
||||||
// range: '',
|
|
||||||
// damage: ''
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,24 @@ export default class DhActiveEffect extends ActiveEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
static applyField(model, change, field) {
|
static applyField(model, change, field) {
|
||||||
change.value = itemAbleRollParse(change.value, model, change.effect.parent);
|
change.value = this.effectSafeEval(itemAbleRollParse(change.value, model, change.effect.parent));
|
||||||
super.applyField(model, change, field);
|
super.applyField(model, change, field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Altered Foundry safeEval to allow non-numeric returns */
|
||||||
|
static effectSafeEval(expression) {
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-new-func
|
||||||
|
const evl = new Function('sandbox', `with (sandbox) { return ${expression}}`);
|
||||||
|
result = evl(Roll.MATH_PROXY);
|
||||||
|
} catch (err) {
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
async toChat(origin) {
|
async toChat(origin) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const systemData = {
|
const systemData = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue