D&D: class passives + subclasses for the five caster classes

Adds signature class passives for Druid/Bard/Sorcerer/Warlock/Paladin in
dnd_passives.go, each riding an existing CombatModifiers channel so a
playable caster is no longer mechanically empty: Druid Wild Resilience
(damage reduction), Bard Bardic Inspiration (initiative), Sorcerer Innate
Sorcery (CHA-scaled pre-combat burst), Warlock Agonizing Blast (+10%
damage), Paladin Divine Smite (level-scaled burst).

Adds 15 subclasses (3 per caster, registry now 30) using canonical 5e
archetype names, with passive-only L5/7/10/15 effects in
applySubclassPassives — consistent with the majority of the original
fifteen, no new resource pools or active abilities. subclassesForClass is
now non-empty for casters, so the L5 !subclass prompt and sheet display
light up through the existing generic plumbing.

Tests: TestApplyClassPassives extended to all ten classes and the new
channels; TestSubclassRegistry_* updated to expect 30 entries across all
ten classes.
This commit is contained in:
prosolis
2026-05-14 15:18:29 -07:00
parent 6ef8b9fd0a
commit d6ea08bba6
5 changed files with 480 additions and 14 deletions

View File

@@ -39,6 +39,28 @@ var dndClassAbilities = map[DnDClass]DnDClassAbility{
Name: "Hunter's Mark",
Description: "You read your prey's weak points: +5% damage and +1 to attack rolls.",
},
// Open5e caster scaffold — one signature passive each, riding existing
// CombatModifiers channels the same way the original five do.
ClassDruid: {
Name: "Wild Resilience",
Description: "The wild lends you its toughness: incoming damage is reduced 5%.",
},
ClassBard: {
Name: "Bardic Inspiration",
Description: "Quick wit keeps you a step ahead: +1 to your initiative each round.",
},
ClassSorcerer: {
Name: "Innate Sorcery",
Description: "Raw magic spills out as the fight begins, dealing immediate damage scaled by your Charisma.",
},
ClassWarlock: {
Name: "Agonizing Blast",
Description: "Your pact-fueled eldritch power adds +10% to all damage you deal.",
},
ClassPaladin: {
Name: "Divine Smite",
Description: "You channel a burst of radiant power on engagement, dealing flat damage that grows with your level.",
},
}
// applyRacePassives sets the combat-impacting flags from the player's race.
@@ -85,5 +107,22 @@ func applyClassPassives(stats *CombatStats, mods *CombatModifiers, c *DnDCharact
case ClassRanger:
mods.DamageBonus += 0.05
stats.AttackBonus++
case ClassDruid:
// Wild Resilience — multiplicative, so it stacks cleanly with the
// subclass DamageReduct riders. DamageReduct is initialized to 1.0
// by DerivePlayerStats before passives run.
mods.DamageReduct *= 0.95
case ClassBard:
mods.InitiativeBias += 1
case ClassSorcerer:
// Innate Sorcery — pre-combat burst, CHA-scaled like the Sorcerer's
// spellcasting stat. Floors at the flat 3 for low-CHA builds.
mods.FlatDmgStart += 3 + abilityModifier(c.CHA)
case ClassWarlock:
mods.DamageBonus += 0.10
case ClassPaladin:
// Divine Smite — radiant burst on engage, scaling with level so it
// stays relevant against tougher foes.
mods.FlatDmgStart += 4 + c.Level/2
}
}