New source found from dndbeyond.com
This commit is contained in:
parent
0b403376c5
commit
2c657770de
@ -437,6 +437,13 @@ export function getUniqueClassFeatures(charClass) {
|
||||
export function getVisibileClassFeatures(charClass) {
|
||||
return charClass.visibleClassFeatures;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charClass
|
||||
*/
|
||||
export function getHigherLevelClassFeatures(charClass) {
|
||||
return charClass.higherLevelClassFeatures;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charClass
|
||||
|
@ -145,11 +145,14 @@ export function deriveClassFeatureGroups(charClass, classFeatures, appContext) {
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
const higherLevelFeatures = classFeatures.filter((feature) => ClassFeatureAccessors.getRequiredLevel(feature) > getLevel(charClass) &&
|
||||
(appContext === null || !ClassFeatureUtils.getHideInContext(feature, appContext)));
|
||||
return {
|
||||
activeFeatures,
|
||||
visibleFeatures,
|
||||
orderedFeatures,
|
||||
uniqueFeatures,
|
||||
higherLevelFeatures,
|
||||
};
|
||||
}
|
||||
/**
|
||||
|
@ -62,11 +62,11 @@ export function generateBaseCharClass(charClass, optionalClassFeatures, allClass
|
||||
featureSpells.push(...OptionAccessors.getSpells(option));
|
||||
});
|
||||
});
|
||||
const { activeFeatures, visibleFeatures, orderedFeatures, uniqueFeatures } = deriveClassFeatureGroups(charClass, updatedFeatures, appContext);
|
||||
const { activeFeatures, visibleFeatures, orderedFeatures, uniqueFeatures, higherLevelFeatures } = deriveClassFeatureGroups(charClass, updatedFeatures, appContext);
|
||||
// do any class features or modifiers enable hex, pact or dedicated weapons
|
||||
//TODO eventually should just be able to use modifiers here and not have to check class feature names
|
||||
const { enablesHexWeapon, enablesPactWeapon, enablesDedicatedWeapon } = deriveDedicatedHexAndPactWeaponEnabled(updatedFeatures, classModifiers);
|
||||
return Object.assign(Object.assign({}, charClass), { activeId: deriveActiveId(charClass), spells: SpellGenerators.updateClassSpells(featureSpells, classSpells), modifiers: classModifiers, featureSpells, classFeatures: updatedFeatures, optionalClassFeatures, activeClassFeatures: activeFeatures, visibleClassFeatures: visibleFeatures, orderedClassFeatures: orderedFeatures, uniqueClassFeatures: uniqueFeatures, feats,
|
||||
return Object.assign(Object.assign({}, charClass), { activeId: deriveActiveId(charClass), spells: SpellGenerators.updateClassSpells(featureSpells, classSpells), modifiers: classModifiers, featureSpells, classFeatures: updatedFeatures, optionalClassFeatures, activeClassFeatures: activeFeatures, visibleClassFeatures: visibleFeatures, orderedClassFeatures: orderedFeatures, uniqueClassFeatures: uniqueFeatures, higherLevelClassFeatures: higherLevelFeatures, feats,
|
||||
actions,
|
||||
enablesDedicatedWeapon,
|
||||
enablesHexWeapon,
|
||||
|
@ -217,7 +217,7 @@ export function getCastLevelRange(spell, spellCasterInfo, ruleData) {
|
||||
...spellCasterInfo.availableSpellLevels,
|
||||
...spellCasterInfo.availablePactMagicLevels,
|
||||
].filter((level) => level >= getLevel(spell));
|
||||
startLevel = Math.max(getLevel(spell), Math.min(...availableLevels));
|
||||
startLevel = Math.max(getLevel(spell), availableLevels.length > 0 ? Math.min(...availableLevels) : 0);
|
||||
endLevel = Math.max(getLevel(spell), ...availableLevels);
|
||||
if (limitedUse && getDataOriginType(spell) === DataOriginTypeEnum.CLASS_FEATURE) {
|
||||
const dataOrigin = getDataOrigin(spell);
|
||||
|
@ -79,12 +79,20 @@ export const InputField: FC<InputFieldProps> = ({
|
||||
const intValue = parseInt(e.target.value);
|
||||
|
||||
// If entered value is below the minimum, reset to minimum
|
||||
if (!isNaN(intValue) && inputProps?.min && intValue < inputProps?.min) {
|
||||
if (
|
||||
!isNaN(intValue) &&
|
||||
inputProps?.min !== undefined &&
|
||||
intValue < inputProps.min
|
||||
) {
|
||||
setValue(inputProps.min);
|
||||
}
|
||||
|
||||
// If entered value is above the maximum and no initialValue exists, reset to maximum
|
||||
if (!isNaN(intValue) && inputProps?.max && intValue > inputProps?.max) {
|
||||
if (
|
||||
!isNaN(intValue) &&
|
||||
inputProps?.max !== undefined &&
|
||||
intValue > inputProps.max
|
||||
) {
|
||||
setValue(inputProps.max);
|
||||
}
|
||||
|
||||
|
@ -257,11 +257,8 @@ export default class ClassManager extends React.PureComponent<Props, State> {
|
||||
visibleClassFeatures
|
||||
).filter((feature) => ClassFeatureUtils.getRequiredLevel(feature) <= level);
|
||||
|
||||
const classFeatures = ClassUtils.getClassFeatures(charClass);
|
||||
const orderedClassFeatures =
|
||||
ClassUtils.deriveOrderedClassFeatures(classFeatures);
|
||||
const atHigherLevelsClassFeatures = orderedClassFeatures.filter(
|
||||
(feature) => ClassFeatureUtils.getRequiredLevel(feature) > level
|
||||
const atHigherLevelsClassFeatures = ClassUtils.deriveOrderedClassFeatures(
|
||||
ClassUtils.getHigherLevelClassFeatures(charClass)
|
||||
);
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user