- All 123 official subclasses (2014 books and the 2024 Player's Handbook), each with its book and features up to level 20; one file per class - The builder has a subclass step after the class: pick one, let a die suggest one, or decide later; its gifts arrive at the class's choice level - 2024 updates (Wild Heart, Warrior of the Elements) offer a one-click switch - The Road Ahead: a level 1-20 timeline on every sheet and in the builder - 33 new species (2024 Aasimar and Goliath, Monsters of the Multiverse) with chosen +2/+1 or +1/+1/+1 bonuses; species roll is now a d8 by family - The Artificer: class, half-caster slots from level 1, features, Flash of Genius - Class tables and counters run to level 20; a fifth Boon, Resolve Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
3.2 KiB
JavaScript
85 lines
3.2 KiB
JavaScript
// Subclasses: the path a character takes within their class, one file per
|
||
// class. Every official subclass is here (2014 books, and the 2024 Player’s
|
||
// Handbook where it brought a new one), as listed at
|
||
// dungeonsanddragonsfan.com/all-dnd-5e-classes-subclasses-complete-guide.
|
||
//
|
||
// Each entry is { key, name, source, edition, replaces?, summary, features }.
|
||
// - `key` is unique across all classes; it is what Character.subclass holds.
|
||
// - `source` is the book, `edition` '2014' or '2024'.
|
||
// - `replaces` names the 2014 subclass a 2024 one updates (Wild Heart for the
|
||
// Totem Warrior). A character on the old one can switch to the new.
|
||
// - `features` are by character level, in the same shape as LEVEL_FEATURES
|
||
// (levelFeatures.js): each becomes a line of the special abilities, and an
|
||
// `upgrade` rewrites the line that already has its name. A subclass's gifts
|
||
// from before its class chooses (a cleric domain's 1st-level ones) arrive
|
||
// with the choice. None of it feeds the calculation engine.
|
||
//
|
||
// The first subclass of each class is the path every character of that class
|
||
// followed before subclasses could be chosen (the Champion fighter, the Life
|
||
// cleric...), and the one a campaign without subclasses gives everybody. Its
|
||
// lines are word for word what the class tables used to write, so sheets
|
||
// written back then still match.
|
||
|
||
// The level at which a class chooses.
|
||
const SUBCLASS_LEVEL = {
|
||
ARTIFICER: 3,
|
||
BARBARIAN: 3,
|
||
BARD: 3,
|
||
CLERIC: 2,
|
||
DRUID: 2,
|
||
FIGHTER: 3,
|
||
MONK: 3,
|
||
PALADIN: 3,
|
||
RANGER: 3,
|
||
ROGUE: 3,
|
||
SORCERER: 3,
|
||
WARLOCK: 3,
|
||
WIZARD: 2,
|
||
};
|
||
|
||
const SUBCLASSES = {
|
||
ARTIFICER: require('./artificer'),
|
||
BARBARIAN: require('./barbarian'),
|
||
BARD: require('./bard'),
|
||
CLERIC: require('./cleric'),
|
||
DRUID: require('./druid'),
|
||
FIGHTER: require('./fighter'),
|
||
MONK: require('./monk'),
|
||
PALADIN: require('./paladin'),
|
||
RANGER: require('./ranger'),
|
||
ROGUE: require('./rogue'),
|
||
SORCERER: require('./sorcerer'),
|
||
WARLOCK: require('./warlock'),
|
||
WIZARD: require('./wizard'),
|
||
};
|
||
|
||
function subclassesOf(characterClass) {
|
||
return SUBCLASSES[characterClass] || [];
|
||
}
|
||
|
||
// One subclass of a class by its key; null when the class has no such subclass.
|
||
function findSubclass(characterClass, key) {
|
||
return subclassesOf(characterClass).find((subclass) => subclass.key === key) || null;
|
||
}
|
||
|
||
function subclassName(characterClass, key) {
|
||
const subclass = findSubclass(characterClass, key);
|
||
return subclass ? subclass.name : null;
|
||
}
|
||
|
||
// The path a class followed before subclasses could be chosen.
|
||
function defaultSubclass(characterClass) {
|
||
return subclassesOf(characterClass)[0] || null;
|
||
}
|
||
|
||
// The 2024 subclass that updates this one, if there is one.
|
||
function newerVersionOf(characterClass, key) {
|
||
return subclassesOf(characterClass).find((subclass) => subclass.replaces === key) || null;
|
||
}
|
||
|
||
// What a list of subclasses to choose from shows of each: everything but the
|
||
// features.
|
||
const subclassSummary = ({ key, name, summary, source, edition, replaces = null }) => ({ key, name, summary, source, edition, replaces });
|
||
|
||
module.exports = { SUBCLASS_LEVEL, SUBCLASSES, subclassesOf, findSubclass, subclassName, defaultSubclass, newerVersionOf, subclassSummary };
|