MCPcopy Create free account
hub / github.com/MrPrimate/ddb-proxy / getClassModifiers

Function getClassModifiers

filterModifiers.js:77–96  ·  view source on GitHub ↗

* Gets all class modifiers for a given character * This filters out all modifiers that do not have an entry in the class features passed in * For multiclassing characters, it checks if the given class is the starting class or a multiclass, * then the `.availableToMulticlass` is queried if this

(data, classFeatures, isStartingClass = false)

Source from the content-addressed store, hash-verified

75 * @param {*} classLevel level requirement up to which the class features should be extracted
76 */
77function getClassModifiers(data, classFeatures, isStartingClass = false) {
78 const modifiers = data.modifiers.class.filter(classModifier => {
79 // check the class from which this modifier came
80 const componentId = classModifier.componentId;
81 //const feature = classFeatures.find(feature => feature.id === componentId || chosenOptions.includes(feature.id));
82 const feature = classFeatures.find(feature => feature.id === componentId);
83 if (feature !== undefined) {
84 const isFeatureAvailable = classModifier.availableToMulticlass ? true : isStartingClass;
85 console.log(
86 `${isFeatureAvailable ? " [ AVAIL]" : " [UNAVAIL]"} Modifier found: ${classModifier.friendlyTypeName} (${
87 classModifier.friendlySubtypeName
88 })`
89 );
90 return isFeatureAvailable;
91 }
92 return false;
93 });
94
95 return modifiers;
96}
97
98function getClassOptionModifiers(data) {
99

Callers 1

filterModifiersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected