
In LotFP a couple of the demi-human classes (Dwarfs and Halflings) have an additional +1 to the ability modifier (not the stat itself), what would be the best way to implement this with the existing ability modifier code from the LotFP character sheet? There is an attr_class variable that indicates what the class is. // Ability modifiers
['Cha', 'Con', 'Dex', 'Int', 'Str', 'Wis'].forEach(ability => {
on(`sheet:opened change:${ability.toLowerCase()}`, () => {
getAttrs([ability.toLowerCase()], v => {
const value = parseInt(v[ability.toLowerCase()]) || 10,
setting = {};
if (value <= 1) setting[`${ability}Mod`] = -4;
else if (value <= 3) setting[`${ability}Mod`] = -3;
else if (value <= 5) setting[`${ability}Mod`] = -2;
else if (value <= 8) setting[`${ability}Mod`] = -1;
else if (value <= 12) setting[`${ability}Mod`] = 0;
else if (value <= 15) setting[`${ability}Mod`] = 1;
else if (value <= 17) setting[`${ability}Mod`] = 2;
else if (value <= 19) setting[`${ability}Mod`] = 3;
else setting[`${ability}Mod`] = 4;
setAttrs(setting);
});
});
});