New source found from dndbeyond.com

This commit is contained in:
David Kruger 2025-06-25 01:00:21 -07:00
parent 0b403376c5
commit 2c657770de
6 changed files with 25 additions and 10 deletions

View File

@ -437,6 +437,13 @@ export function getUniqueClassFeatures(charClass) {
export function getVisibileClassFeatures(charClass) { export function getVisibileClassFeatures(charClass) {
return charClass.visibleClassFeatures; return charClass.visibleClassFeatures;
} }
/**
*
* @param charClass
*/
export function getHigherLevelClassFeatures(charClass) {
return charClass.higherLevelClassFeatures;
}
/** /**
* *
* @param charClass * @param charClass

View File

@ -145,11 +145,14 @@ export function deriveClassFeatureGroups(charClass, classFeatures, appContext) {
} }
return acc; return acc;
}, []); }, []);
const higherLevelFeatures = classFeatures.filter((feature) => ClassFeatureAccessors.getRequiredLevel(feature) > getLevel(charClass) &&
(appContext === null || !ClassFeatureUtils.getHideInContext(feature, appContext)));
return { return {
activeFeatures, activeFeatures,
visibleFeatures, visibleFeatures,
orderedFeatures, orderedFeatures,
uniqueFeatures, uniqueFeatures,
higherLevelFeatures,
}; };
} }
/** /**

View File

@ -62,11 +62,11 @@ export function generateBaseCharClass(charClass, optionalClassFeatures, allClass
featureSpells.push(...OptionAccessors.getSpells(option)); 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 // 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 //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); 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, actions,
enablesDedicatedWeapon, enablesDedicatedWeapon,
enablesHexWeapon, enablesHexWeapon,

View File

@ -217,7 +217,7 @@ export function getCastLevelRange(spell, spellCasterInfo, ruleData) {
...spellCasterInfo.availableSpellLevels, ...spellCasterInfo.availableSpellLevels,
...spellCasterInfo.availablePactMagicLevels, ...spellCasterInfo.availablePactMagicLevels,
].filter((level) => level >= getLevel(spell)); ].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); endLevel = Math.max(getLevel(spell), ...availableLevels);
if (limitedUse && getDataOriginType(spell) === DataOriginTypeEnum.CLASS_FEATURE) { if (limitedUse && getDataOriginType(spell) === DataOriginTypeEnum.CLASS_FEATURE) {
const dataOrigin = getDataOrigin(spell); const dataOrigin = getDataOrigin(spell);

View File

@ -79,12 +79,20 @@ export const InputField: FC<InputFieldProps> = ({
const intValue = parseInt(e.target.value); const intValue = parseInt(e.target.value);
// If entered value is below the minimum, reset to minimum // 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); setValue(inputProps.min);
} }
// If entered value is above the maximum and no initialValue exists, reset to maximum // 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); setValue(inputProps.max);
} }

View File

@ -257,11 +257,8 @@ export default class ClassManager extends React.PureComponent<Props, State> {
visibleClassFeatures visibleClassFeatures
).filter((feature) => ClassFeatureUtils.getRequiredLevel(feature) <= level); ).filter((feature) => ClassFeatureUtils.getRequiredLevel(feature) <= level);
const classFeatures = ClassUtils.getClassFeatures(charClass); const atHigherLevelsClassFeatures = ClassUtils.deriveOrderedClassFeatures(
const orderedClassFeatures = ClassUtils.getHigherLevelClassFeatures(charClass)
ClassUtils.deriveOrderedClassFeatures(classFeatures);
const atHigherLevelsClassFeatures = orderedClassFeatures.filter(
(feature) => ClassFeatureUtils.getRequiredLevel(feature) > level
); );
return ( return (