V1.23.0: every subclass, 43 species, the Artificer, and the road to level 20
- 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>
This commit is contained in:
@@ -7,7 +7,7 @@ const { CLASSES } = require('./data/classes');
|
||||
const { SKILLS } = require('./data/skills');
|
||||
const { resourceState } = require('./classResources');
|
||||
const { CR_XP, XP_THRESHOLDS, COUNT_MULTIPLIERS, LEVEL_XP } = require('./data/xp');
|
||||
const { FULL_CASTER_SLOTS, HALF_CASTER_SLOTS, PACT_SLOTS, CASTER_KIND, MAX_SLOT_LEVEL } = require('./data/spellSlots');
|
||||
const { FULL_CASTER_SLOTS, HALF_CASTER_SLOTS, PACT_SLOTS, CASTER_KIND, CLASS_SLOT_TABLES, MAX_SLOT_LEVEL } = require('./data/spellSlots');
|
||||
|
||||
const ABILITIES = ['STR', 'DEX', 'CON', 'INT', 'WIS', 'CHA'];
|
||||
|
||||
@@ -19,20 +19,18 @@ function proficiencyBonus(level) {
|
||||
return 2 + Math.floor((level - 1) / 4);
|
||||
}
|
||||
|
||||
// Half-Elf's flexible +1/+1 lands on whichever two abilities the player picked
|
||||
// (halfElfBonusAbilities), on top of the fixed +2 CHA in the species table.
|
||||
function speciesAbilityBonus(ability, species, halfElfBonusAbilities = []) {
|
||||
// A species' fixed bonus, plus whatever the player chose for its flexible
|
||||
// bonuses ({ ability: amount }: a Half-Elf's +1/+1, a Goblin's +2/+1...).
|
||||
// Choices count only for a species that has some to make.
|
||||
function speciesAbilityBonus(ability, species, choices = {}) {
|
||||
const speciesData = species ? SPECIES[species] : null;
|
||||
if (!speciesData) return 0;
|
||||
let bonus = speciesData.abilityBonuses[ability] || 0;
|
||||
if (species === 'HALF_ELF' && halfElfBonusAbilities.includes(ability)) {
|
||||
bonus += 1;
|
||||
}
|
||||
return bonus;
|
||||
const chosen = speciesData.flexible ? Number((choices || {})[ability]) || 0 : 0;
|
||||
return (speciesData.abilityBonuses[ability] || 0) + chosen;
|
||||
}
|
||||
|
||||
function finalAbilityScore(rolledScore, ability, species, halfElfBonusAbilities = []) {
|
||||
return rolledScore + speciesAbilityBonus(ability, species, halfElfBonusAbilities);
|
||||
function finalAbilityScore(rolledScore, ability, species, choices = {}) {
|
||||
return rolledScore + speciesAbilityBonus(ability, species, choices);
|
||||
}
|
||||
|
||||
function speciesSpeed(species) {
|
||||
@@ -150,7 +148,8 @@ function spellSlotsFor(characterClass, level) {
|
||||
const [count, slotLevel] = PACT_SLOTS[row];
|
||||
return { kind, restoresOn: 'SHORT', max: Array.from({ length: slotLevel }, (_, i) => (i === slotLevel - 1 ? count : 0)) };
|
||||
}
|
||||
return { kind, restoresOn: 'LONG', max: [...(kind === 'FULL' ? FULL_CASTER_SLOTS : HALF_CASTER_SLOTS)[row]] };
|
||||
const table = CLASS_SLOT_TABLES[characterClass] || (kind === 'FULL' ? FULL_CASTER_SLOTS : HALF_CASTER_SLOTS);
|
||||
return { kind, restoresOn: 'LONG', max: [...table[row]] };
|
||||
}
|
||||
|
||||
// The slot tracker: for each slot level the character has, how many slots
|
||||
@@ -299,15 +298,13 @@ function computeCharacterSheet(character, skillProficiencies = [], saveProficien
|
||||
intScore = 10,
|
||||
wisScore = 10,
|
||||
chaScore = 10,
|
||||
halfElfBonusAbility1 = null,
|
||||
halfElfBonusAbility2 = null,
|
||||
speciesBonusChoices = {},
|
||||
armorBonus = 0,
|
||||
speedOverride = null,
|
||||
spellSlotsUsed = [],
|
||||
hitDiceUsed = 0,
|
||||
} = character;
|
||||
|
||||
const halfElfBonusAbilities = [halfElfBonusAbility1, halfElfBonusAbility2].filter(Boolean);
|
||||
const rolled = { STR: strScore, DEX: dexScore, CON: conScore, INT: intScore, WIS: wisScore, CHA: chaScore };
|
||||
|
||||
const gear = activeGear(character);
|
||||
@@ -317,7 +314,7 @@ function computeCharacterSheet(character, skillProficiencies = [], saveProficien
|
||||
const abilities = {};
|
||||
for (const ability of ABILITIES) {
|
||||
// A score never drops below 1, whatever is weighing the character down.
|
||||
const final = Math.max(1, finalAbilityScore(rolled[ability], ability, species, halfElfBonusAbilities) + fromGear(ability));
|
||||
const final = Math.max(1, finalAbilityScore(rolled[ability], ability, species, speciesBonusChoices) + fromGear(ability));
|
||||
abilities[ability] = {
|
||||
rolled: rolled[ability],
|
||||
final,
|
||||
|
||||
Reference in New Issue
Block a user