build_list_available_spells
Retrieve the spells a character can access for a chosen tradition, limited by their current maximum rank, with real per-rank spell slot counts and cantrip indicators.
Instructions
Spells of the given tradition at or below the highest rank the character can currently access, plus (new) the character's actual spell slot counts by rank for their level, when their class has one.
Rank cap resolution, in order: an explicitly-passed `max_rank` always
wins (needed for a caster archetype/dedication, where `character.class`
itself isn't the caster and so has no row in `class_spell_slots` at
all); otherwise the character class's own real slot table (see
`_class_spell_slots`) if it has one -- this replaces the standard
full-caster `ceil(level/2)` heuristic with the class's actual
progression, which matters for Magus/Summoner specifically (both delayed
relative to full casters, and non-monotonic -- they only ever hold 2
active ranks at once); if neither applies (the character's class isn't
a recognized caster at all), falls back to the `ceil(level/2)`
heuristic same as before, since a caller may still be probing a
non-standard tradition/dedication combination this project can't
resolve on its own.
`spell_slots` in the result is the real per-rank slot table when the
class has one, else `None` (honestly "not known," not a guess) --
resolves the previous "spell slots aren't modeled at all" gap for every
class with real ingested data.
Cantrips are stored in the source data with `level: 1` (they
auto-heighten to half the caster's level) rather than rank 0, so they'd
otherwise be indistinguishable from true 1st-rank slotted spells --
each result is tagged `is_cantrip` to keep that mechanical distinction
visible (cantrips are at-will, leveled spells consume slots).
`include_legacy` (default False): excludes pre-Remaster/OGL-flagged
spells unless set. See `_legacy_filter_sql`.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_rank | No | ||
| character | Yes | ||
| tradition | Yes | ||
| include_legacy | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||