@archivist-gg/dnd5e 0.3.13 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/background/background.codec.js +5 -5
  2. package/dist/background/background.parser.js +4 -4
  3. package/dist/background/background.schema.js +3 -3
  4. package/dist/{chunk-ZMJQUZQH.js → chunk-2JSQE3DD.js} +11 -0
  5. package/dist/{chunk-Q6UOHCCT.js → chunk-2UDSN6VW.js} +1 -1
  6. package/dist/chunk-3LWMFYKS.js +57 -0
  7. package/dist/{chunk-MUIU7RZ3.js → chunk-3MGQFFNE.js} +1 -1
  8. package/dist/{chunk-T5GZBKIQ.js → chunk-3VZZDKRA.js} +114 -27
  9. package/dist/{chunk-BRGLDWUP.js → chunk-5MXFW4O3.js} +7 -3
  10. package/dist/{chunk-RQNJXADQ.js → chunk-6EI737IO.js} +1 -1
  11. package/dist/{chunk-EL6QPF6I.js → chunk-7ATNGKBS.js} +1 -1
  12. package/dist/{chunk-XY6X2APM.js → chunk-7Q2VPKCD.js} +17 -0
  13. package/dist/{chunk-4SLOJXJ4.js → chunk-7QN7XSAK.js} +1 -1
  14. package/dist/{chunk-MC5YJ4PB.js → chunk-AZRGFUSR.js} +1 -1
  15. package/dist/{chunk-HJQNK3J5.js → chunk-B3DP42OM.js} +1 -4
  16. package/dist/{chunk-JNNNBEUH.js → chunk-DOXSFYLH.js} +7 -2
  17. package/dist/{chunk-X7VZY4ON.js → chunk-FANQVQ3D.js} +2 -2
  18. package/dist/{chunk-PX25R3DK.js → chunk-G6PBI2BU.js} +1 -1
  19. package/dist/chunk-HTYMW5CH.js +228 -0
  20. package/dist/{chunk-VDPRBUU5.js → chunk-JCMUVZIK.js} +1 -1
  21. package/dist/{chunk-Q5XTEYHD.js → chunk-JSM6JFZR.js} +15 -8
  22. package/dist/chunk-KR6JF3BF.js +14 -0
  23. package/dist/{chunk-J53ERF6K.js → chunk-LF5AGJA4.js} +1 -1
  24. package/dist/{chunk-XJRNEQPD.js → chunk-MBX25B6D.js} +1 -1
  25. package/dist/{chunk-5KGV6TF7.js → chunk-OFCSP6MT.js} +1 -1
  26. package/dist/{chunk-QEO7LYTG.js → chunk-ONTGZR5T.js} +127 -71
  27. package/dist/{chunk-MWCCGPG3.js → chunk-OOSRUJBI.js} +3 -2
  28. package/dist/{chunk-LVX6TQ3R.js → chunk-PKX6TGRE.js} +2 -2
  29. package/dist/{chunk-QSBJ6NEM.js → chunk-PQZ4LM4Z.js} +1 -1
  30. package/dist/chunk-PXVNAY7T.js +84 -0
  31. package/dist/chunk-QH36K2PU.js +158 -0
  32. package/dist/{chunk-M2OWVAZG.js → chunk-QZSWN2KT.js} +1 -1
  33. package/dist/{chunk-6ZY3U6BQ.js → chunk-RYLXAYIQ.js} +1 -1
  34. package/dist/{chunk-UE6LKRXQ.js → chunk-T6QIF5XR.js} +16 -0
  35. package/dist/{chunk-4BZ47YJ4.js → chunk-TULQ4FFX.js} +32 -11
  36. package/dist/{chunk-PLOSP4XQ.js → chunk-UUBJCNQU.js} +11 -2
  37. package/dist/{chunk-DPM6V7YX.js → chunk-VRV3NNTA.js} +1 -1
  38. package/dist/{chunk-R2V5LN3I.js → chunk-Y5VVP73C.js} +1 -1
  39. package/dist/{chunk-FPGXFD2M.js → chunk-YD2VAHA6.js} +2 -2
  40. package/dist/{chunk-G7ED5H2G.js → chunk-YKL6SHRJ.js} +1 -1
  41. package/dist/class/class.codec.js +6 -6
  42. package/dist/class/class.parser.js +5 -5
  43. package/dist/class/class.schema.d.ts +8 -0
  44. package/dist/class/class.schema.js +4 -4
  45. package/dist/class/class.standard-array.d.ts +16 -0
  46. package/dist/class/class.standard-array.js +20 -0
  47. package/dist/class/class.types.d.ts +3 -0
  48. package/dist/dnd/amount-text.d.ts +38 -0
  49. package/dist/dnd/amount-text.js +13 -0
  50. package/dist/dnd/resource-words.d.ts +4 -0
  51. package/dist/dnd/resource-words.js +30 -0
  52. package/dist/feat/feat.codec.js +5 -5
  53. package/dist/feat/feat.parser.js +4 -4
  54. package/dist/feat/feat.schema.d.ts +25 -0
  55. package/dist/feat/feat.schema.js +3 -3
  56. package/dist/index.js +332 -70
  57. package/dist/monster/monster.parser.js +5 -5
  58. package/dist/monster/monster.schema.js +4 -4
  59. package/dist/optional-feature/optional-feature.codec.js +5 -4
  60. package/dist/optional-feature/optional-feature.parser.js +4 -3
  61. package/dist/optional-feature/optional-feature.schema.d.ts +26 -0
  62. package/dist/optional-feature/optional-feature.schema.js +3 -2
  63. package/dist/pc/pc.additional-spells.js +2 -2
  64. package/dist/pc/pc.amount-bindings.d.ts +32 -0
  65. package/dist/pc/pc.amount-bindings.js +23 -0
  66. package/dist/pc/pc.decision-engine.d.ts +3 -0
  67. package/dist/pc/pc.decision-engine.js +14 -13
  68. package/dist/pc/pc.entry-overrides.js +3 -3
  69. package/dist/pc/pc.equipment.js +6 -5
  70. package/dist/pc/pc.feature-effects.d.ts +12 -0
  71. package/dist/pc/pc.feature-effects.js +1 -1
  72. package/dist/pc/pc.infusions.d.ts +9 -1
  73. package/dist/pc/pc.infusions.js +3 -3
  74. package/dist/pc/pc.member-choices.d.ts +90 -0
  75. package/dist/pc/pc.member-choices.js +32 -0
  76. package/dist/pc/pc.parser.js +1 -1
  77. package/dist/pc/pc.pools.d.ts +7 -0
  78. package/dist/pc/pc.pools.js +5 -3
  79. package/dist/pc/pc.proficiencies.js +13 -12
  80. package/dist/pc/pc.proficiency-query.js +6 -0
  81. package/dist/pc/pc.recalc.js +75 -58
  82. package/dist/pc/pc.resolver.d.ts +2 -1
  83. package/dist/pc/pc.resolver.js +13 -12
  84. package/dist/pc/pc.rest.js +4 -4
  85. package/dist/pc/pc.schema.d.ts +29 -2
  86. package/dist/pc/pc.schema.js +1 -1
  87. package/dist/pc/pc.types.d.ts +45 -2
  88. package/dist/pc/pc.weapon-grant.d.ts +15 -0
  89. package/dist/pc/pool-layout.d.ts +3 -9
  90. package/dist/pc/pool-layout.js +1 -3
  91. package/dist/pc/resource-equivalents.d.ts +44 -0
  92. package/dist/pc/spell-source.js +4 -9
  93. package/dist/race/race.codec.js +6 -6
  94. package/dist/race/race.parser.js +5 -5
  95. package/dist/race/race.schema.js +4 -4
  96. package/dist/schemas/choice-schema.js +2 -2
  97. package/dist/schemas/feature-effect-schema.d.ts +25 -0
  98. package/dist/schemas/feature-effect-schema.js +1 -1
  99. package/dist/schemas/feature-schema.js +3 -3
  100. package/dist/spell/spell.codec.js +2 -2
  101. package/dist/spell/spell.parser.d.ts +6 -1
  102. package/dist/spell/spell.parser.js +5 -3
  103. package/dist/spell/spell.types.d.ts +10 -0
  104. package/dist/subclass/subclass.codec.js +6 -6
  105. package/dist/subclass/subclass.parser.js +5 -5
  106. package/dist/subclass/subclass.schema.js +4 -4
  107. package/dist/types/choice.d.ts +5 -0
  108. package/dist/types/feature-effect.d.ts +6 -0
  109. package/dist/types/optional-feature.types.d.ts +5 -0
  110. package/dist/types/selection-pool.d.ts +2 -2
  111. package/package.json +1 -1
@@ -1,9 +1,28 @@
1
+ import {
2
+ amountBindingsFor
3
+ } from "../chunk-PXVNAY7T.js";
4
+ import "../chunk-KR6JF3BF.js";
5
+ import {
6
+ computeConditionEffects
7
+ } from "../chunk-MYY2C5MB.js";
1
8
  import {
2
9
  collectChosenAbilityPoints,
3
10
  collectChosenProficiencies
4
- } from "../chunk-QEO7LYTG.js";
11
+ } from "../chunk-ONTGZR5T.js";
5
12
  import "../chunk-2LULMQTF.js";
6
13
  import "../chunk-H5PTKYXL.js";
14
+ import {
15
+ assembleEffectFeatures,
16
+ computeFeatureEffects,
17
+ foldsNow,
18
+ selfEffectsOf
19
+ } from "../chunk-TULQ4FFX.js";
20
+ import "../chunk-TOM66P2P.js";
21
+ import "../chunk-KU3YLF6D.js";
22
+ import {
23
+ featPickSites,
24
+ poolMemberSitesOf
25
+ } from "../chunk-HTYMW5CH.js";
7
26
  import {
8
27
  resourceLevelFor
9
28
  } from "../chunk-KSTV7J2U.js";
@@ -13,6 +32,9 @@ import {
13
32
  effectiveSpellcastingAbility,
14
33
  resolveSpellcasting
15
34
  } from "../chunk-DPUJDOKV.js";
35
+ import {
36
+ legacyAsiBranch
37
+ } from "../chunk-LBEXLN6I.js";
16
38
  import {
17
39
  toDefenseSlug
18
40
  } from "../chunk-XJ2F2WO6.js";
@@ -21,49 +43,36 @@ import {
21
43
  computeAppliedBonuses,
22
44
  computeSlotsAndAttacks,
23
45
  emptyAppliedBonuses
24
- } from "../chunk-Q5XTEYHD.js";
46
+ } from "../chunk-JSM6JFZR.js";
47
+ import "../chunk-3LWMFYKS.js";
25
48
  import "../chunk-YDGMBMYI.js";
26
- import {
27
- assembleEffectFeatures,
28
- computeFeatureEffects,
29
- foldsNow,
30
- selfEffectsOf
31
- } from "../chunk-4BZ47YJ4.js";
32
- import "../chunk-TOM66P2P.js";
33
- import "../chunk-KU3YLF6D.js";
49
+ import "../chunk-EJP263OP.js";
34
50
  import "../chunk-RLGQ5PZZ.js";
35
- import "../chunk-T5GZBKIQ.js";
51
+ import "../chunk-3VZZDKRA.js";
36
52
  import "../chunk-W6GC6OKK.js";
37
- import "../chunk-HJQNK3J5.js";
53
+ import "../chunk-B3DP42OM.js";
38
54
  import {
39
55
  diceColumnAt,
40
56
  unarmedDieColumnFor
41
57
  } from "../chunk-IUAAXXNO.js";
42
58
  import "../chunk-YHYTW5QA.js";
43
- import "../chunk-DPM6V7YX.js";
59
+ import "../chunk-VRV3NNTA.js";
44
60
  import "../chunk-PVCEA4HZ.js";
45
- import {
46
- legacyAsiBranch
47
- } from "../chunk-LBEXLN6I.js";
48
- import {
49
- computeConditionEffects
50
- } from "../chunk-MYY2C5MB.js";
51
- import "../chunk-EJP263OP.js";
52
- import "../chunk-ZUQW5VBZ.js";
53
61
  import "../chunk-IHE6KVC3.js";
54
62
  import "../chunk-HHBD4SQ6.js";
55
63
  import "../chunk-A54HHCWW.js";
56
64
  import "../chunk-LHZXYFBU.js";
65
+ import "../chunk-YBLDE5CG.js";
66
+ import "../chunk-ZUQW5VBZ.js";
57
67
  import "../chunk-LVQLWRCU.js";
58
68
  import "../chunk-CM5CWO4K.js";
59
- import "../chunk-ZCTUYGNV.js";
60
- import "../chunk-YBLDE5CG.js";
61
69
  import {
62
- evaluateMaxFormula,
63
- isValidMaxFormula
64
- } from "../chunk-EVMUJYUD.js";
70
+ resolveAmountText
71
+ } from "../chunk-QH36K2PU.js";
72
+ import "../chunk-EVMUJYUD.js";
65
73
  import "../chunk-VTTA2ALZ.js";
66
- import "../chunk-XY6X2APM.js";
74
+ import "../chunk-ZCTUYGNV.js";
75
+ import "../chunk-7Q2VPKCD.js";
67
76
  import "../chunk-ZDAEGJH4.js";
68
77
  import "../chunk-3TM34RSJ.js";
69
78
  import {
@@ -198,14 +207,9 @@ function hpLevelCount(classes) {
198
207
  function multiclassMaxHP(classes, conMod) {
199
208
  return Math.max(1, hitDiceAverageSum(classes) + conMod * hpLevelCount(classes));
200
209
  }
201
- function resolveRiderAmount(amount, bindings) {
202
- if (!amount.includes("{")) return amount;
203
- const formula = amount.replace(/\{prof_bonus\}/g, "{prof}");
204
- if (!isValidMaxFormula(formula)) return amount;
205
- return String(evaluateMaxFormula(formula, bindings));
206
- }
207
210
  function resolveDamageRider(rider, rowDamageType, bindings) {
208
- const out = { ...rider, amount: resolveRiderAmount(rider.amount, bindings) };
211
+ const { owner, ...rest } = rider;
212
+ const out = { ...rest, amount: resolveAmountText(rider.amount, bindings(owner)) };
209
213
  if (rider.damage_type !== void 0 && !isChosenDamageType(rider.damage_type)) {
210
214
  const resolved = isCanonicalDamageType(rider.damage_type) ? rider.damage_type : rowDamageType;
211
215
  if (resolved) out.damage_type = resolved;
@@ -359,17 +363,17 @@ function collectClassFeatAbilityPoints(resolved) {
359
363
  const stripRef = (ref) => ref.replace(/^\[\[/, "").replace(/\]\]$/, "");
360
364
  const featBySlug = /* @__PURE__ */ new Map();
361
365
  for (const f of resolved.feats) featBySlug.set(f.slug, f);
362
- for (const c of resolved.classes) {
363
- for (const atLevel of Object.values(c.choices)) {
364
- const block = atLevel;
365
- if (!block) continue;
366
- const featRef = block.feat;
367
- if (typeof featRef !== "string") continue;
368
- const feat = featBySlug.get(stripRef(featRef));
366
+ const sites = featPickSites(resolved.classes, poolMemberSitesOf(resolved), (ci) => {
367
+ var _a2, _b2, _c, _d;
368
+ return (_d = (_c = (_b2 = (_a2 = resolved.classes) == null ? void 0 : _a2[ci]) == null ? void 0 : _b2.entity) == null ? void 0 : _c.slug) != null ? _d : null;
369
+ });
370
+ for (const site of sites) {
371
+ {
372
+ const feat = featBySlug.get(stripRef(site.slug));
369
373
  if (!feat) continue;
370
374
  for (const ch of (_a = feat.choices) != null ? _a : []) {
371
375
  if (ch.kind !== "ability-points") continue;
372
- const raw = block[`feat:${ch.id}`];
376
+ const raw = site.read(ch.id);
373
377
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
374
378
  let left = ch.points;
375
379
  for (const ab of ABILITY_KEYS) {
@@ -545,7 +549,18 @@ function recalc(resolved, registry) {
545
549
  const overrides = (_a = resolved.definition.overrides) != null ? _a : {};
546
550
  const chosenProfs = collectChosenProficiencies(resolved);
547
551
  const { features: effectFeatures, activeBuffs } = assembleEffectFeatures(resolved);
548
- const featureEffects = computeFeatureEffects(effectFeatures, { activeBuffs, levelFor: (src) => resourceLevelFor(src, resolved) });
552
+ const tableDiceFor = (src, column, level) => {
553
+ var _a2;
554
+ const cls = src.kind === "class" ? resolved.classes.find((c) => {
555
+ var _a3;
556
+ return ((_a3 = c.entity) == null ? void 0 : _a3.slug) === src.slug;
557
+ }) : src.kind === "subclass" ? resolved.classes.find((c) => {
558
+ var _a3;
559
+ return ((_a3 = c.subclass) == null ? void 0 : _a3.slug) === src.slug;
560
+ }) : void 0;
561
+ return cls ? diceColumnAt((_a2 = cls.entity) == null ? void 0 : _a2.table, level, column) : null;
562
+ };
563
+ const featureEffects = computeFeatureEffects(effectFeatures, { activeBuffs, levelFor: (src) => resourceLevelFor(src, resolved), tableDiceFor });
549
564
  const profsForApply = computeProficiencies(resolved);
550
565
  for (const t of chosenProfs.tools) {
551
566
  if (!profsForApply.tools.specific.includes(t)) profsForApply.tools.specific.push(t);
@@ -619,17 +634,30 @@ function recalc(resolved, registry) {
619
634
  for (const ab of chosenProfs.saves) saveProfs.add(ab);
620
635
  const saves = {};
621
636
  const saveBreakdowns = {};
637
+ const activeSaveBonusTerms = featureEffects.save_bonus_terms.filter((t) => {
638
+ var _a2;
639
+ return t.inactiveWhile === "incapacitated" ? !conditionEffects.actions_disabled : t.inactiveWhile === "unconscious" ? !((_a2 = resolved.state.conditions) != null ? _a2 : []).includes("unconscious") : true;
640
+ });
622
641
  for (const ab of ABILITY_KEYS) {
623
642
  const override = (_f = overrides.saves) == null ? void 0 : _f[ab];
624
643
  const prof = (_g = override == null ? void 0 : override.proficient) != null ? _g : saveProfs.has(ab);
625
- const derivedBonus = savingThrow(scores[ab], prof, proficiencyBonus) + applied.save_bonus + conditionEffects.d20_test_penalty;
644
+ const featureTerms = [];
645
+ for (const t of activeSaveBonusTerms) {
646
+ if (t.saves.length > 0 && !t.saves.includes(ab)) continue;
647
+ const amount = Math.max(t.minimum, mods[t.ability]);
648
+ const prior = featureTerms.find((x) => x.source === t.label);
649
+ if (prior === void 0) featureTerms.push({ source: t.label, amount });
650
+ else if (amount > prior.amount) prior.amount = amount;
651
+ }
652
+ const derivedBonus = savingThrow(scores[ab], prof, proficiencyBonus) + applied.save_bonus + featureTerms.reduce((sum, t) => sum + t.amount, 0) + conditionEffects.d20_test_penalty;
626
653
  const bonus = (_h = override == null ? void 0 : override.bonus) != null ? _h : derivedBonus;
627
654
  saves[ab] = { bonus, proficient: prof };
628
655
  saveBreakdowns[ab] = [
629
656
  { source: ab.toUpperCase(), amount: mods[ab] },
630
657
  ...prof ? [{ source: "Proficiency", amount: proficiencyBonus }] : [],
631
- ...applied.save_bonus ? [{ source: "Equipment", amount: applied.save_bonus }] : [],
632
- ...conditionEffects.d20_test_penalty ? [{ source: "Conditions", amount: conditionEffects.d20_test_penalty }] : []
658
+ ...applied.save_terms.map((t) => ({ ...t })),
659
+ ...featureTerms,
660
+ ...conditionEffects.d20_test_penalty ? [{ source: `Exhaustion ${conditionEffects.exhaustion_level}`, amount: conditionEffects.d20_test_penalty }] : []
633
661
  ];
634
662
  }
635
663
  const profSet = /* @__PURE__ */ new Set([
@@ -835,18 +863,7 @@ function recalc(resolved, registry) {
835
863
  ))
836
864
  };
837
865
  const attackRows = [...(_U = derivedEquipment == null ? void 0 : derivedEquipment.attacks) != null ? _U : [], buildUnarmedRow(mods, proficiencyBonus, resolveUnarmedStrike(resolved))];
838
- const riderBindings = {
839
- level: totalLevel,
840
- class_level: totalLevel,
841
- prof: proficiencyBonus,
842
- str_mod: mods.str,
843
- dex_mod: mods.dex,
844
- con_mod: mods.con,
845
- int_mod: mods.int,
846
- wis_mod: mods.wis,
847
- cha_mod: mods.cha,
848
- columns: {}
849
- };
866
+ const riderBindings = (owner) => amountBindingsFor(owner, resolved, { proficiencyBonus, mods, spellcastingClasses });
850
867
  return {
851
868
  totalLevel,
852
869
  proficiencyBonus,
@@ -4,6 +4,7 @@ import type { BackgroundEntity } from "@archivist-gg/dnd5e/background/background
4
4
  import type { FeatEntity } from "@archivist-gg/dnd5e/feat/feat.types";
5
5
  import type { Ability } from "@archivist-gg/dnd5e";
6
6
  import type { Character, ChoiceValue, ResolvedCharacter, ResolvedClass, ResolvedFeature, ResolvedSpell, FeatVia } from "./pc.types.js";
7
+ import { type PoolMemberSite } from "./pc.member-choices.js";
7
8
  export interface ResolveResult {
8
9
  character: ResolvedCharacter;
9
10
  warnings: string[];
@@ -126,7 +127,7 @@ export declare function collectChosenGrantedFeatures(character: Character, class
126
127
  getByTypeAndSlug(type: string, slug: string): {
127
128
  data: Record<string, unknown>;
128
129
  } | undefined;
129
- }, race?: RaceEntity | null, background?: BackgroundEntity | null): ResolvedFeature[];
130
+ }, race?: RaceEntity | null, background?: BackgroundEntity | null, memberSites?: PoolMemberSite[]): ResolvedFeature[];
130
131
  /**
131
132
  * `character.additional_features` → ResolvedFeatures (the DM-grant path).
132
133
  *
@@ -10,33 +10,34 @@ import {
10
10
  dedupeResolvedSpells,
11
11
  resolveOriginFeat,
12
12
  stripSlug
13
- } from "../chunk-QEO7LYTG.js";
13
+ } from "../chunk-ONTGZR5T.js";
14
14
  import "../chunk-2LULMQTF.js";
15
15
  import "../chunk-H5PTKYXL.js";
16
- import "../chunk-KSTV7J2U.js";
17
- import "../chunk-DPUJDOKV.js";
18
- import "../chunk-4BZ47YJ4.js";
16
+ import "../chunk-TULQ4FFX.js";
19
17
  import "../chunk-TOM66P2P.js";
20
18
  import "../chunk-KU3YLF6D.js";
19
+ import "../chunk-HTYMW5CH.js";
20
+ import "../chunk-KSTV7J2U.js";
21
+ import "../chunk-DPUJDOKV.js";
22
+ import "../chunk-LBEXLN6I.js";
21
23
  import "../chunk-RLGQ5PZZ.js";
22
- import "../chunk-T5GZBKIQ.js";
24
+ import "../chunk-3VZZDKRA.js";
23
25
  import "../chunk-W6GC6OKK.js";
24
- import "../chunk-HJQNK3J5.js";
26
+ import "../chunk-B3DP42OM.js";
25
27
  import "../chunk-IUAAXXNO.js";
26
28
  import "../chunk-YHYTW5QA.js";
27
- import "../chunk-DPM6V7YX.js";
29
+ import "../chunk-VRV3NNTA.js";
28
30
  import "../chunk-PVCEA4HZ.js";
29
- import "../chunk-LBEXLN6I.js";
30
- import "../chunk-ZUQW5VBZ.js";
31
31
  import "../chunk-IHE6KVC3.js";
32
32
  import "../chunk-LHZXYFBU.js";
33
+ import "../chunk-YBLDE5CG.js";
34
+ import "../chunk-ZUQW5VBZ.js";
33
35
  import "../chunk-LVQLWRCU.js";
34
36
  import "../chunk-CM5CWO4K.js";
35
- import "../chunk-ZCTUYGNV.js";
36
- import "../chunk-YBLDE5CG.js";
37
37
  import "../chunk-EVMUJYUD.js";
38
38
  import "../chunk-VTTA2ALZ.js";
39
- import "../chunk-XY6X2APM.js";
39
+ import "../chunk-ZCTUYGNV.js";
40
+ import "../chunk-7Q2VPKCD.js";
40
41
  import "../chunk-ZDAEGJH4.js";
41
42
  import "../chunk-3TM34RSJ.js";
42
43
  import "../chunk-PDJSUH24.js";
@@ -5,18 +5,18 @@ import "../chunk-DPUJDOKV.js";
5
5
  import {
6
6
  effectiveItemCharges,
7
7
  effectiveItemRecovery
8
- } from "../chunk-T5GZBKIQ.js";
8
+ } from "../chunk-3VZZDKRA.js";
9
9
  import "../chunk-W6GC6OKK.js";
10
- import "../chunk-HJQNK3J5.js";
10
+ import "../chunk-B3DP42OM.js";
11
11
  import "../chunk-IUAAXXNO.js";
12
- import "../chunk-ZUQW5VBZ.js";
13
12
  import "../chunk-IHE6KVC3.js";
14
13
  import "../chunk-LHZXYFBU.js";
14
+ import "../chunk-ZUQW5VBZ.js";
15
15
  import "../chunk-LVQLWRCU.js";
16
16
  import "../chunk-CM5CWO4K.js";
17
- import "../chunk-ZCTUYGNV.js";
18
17
  import "../chunk-EVMUJYUD.js";
19
18
  import "../chunk-VTTA2ALZ.js";
19
+ import "../chunk-ZCTUYGNV.js";
20
20
  import "../chunk-3TM34RSJ.js";
21
21
  import "../chunk-PDJSUH24.js";
22
22
  import "../chunk-WELIKLZF.js";
@@ -411,6 +411,33 @@ export declare const characterSchema: z.ZodObject<{
411
411
  vulnerabilities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
412
412
  condition_immunities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
413
413
  }, z.core.$strip>>;
414
+ sheet: z.ZodOptional<z.ZodObject<{
415
+ layout: z.ZodOptional<z.ZodObject<{
416
+ saves: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
417
+ section: "section";
418
+ }>>>;
419
+ }, z.core.$strip>>;
420
+ favorites: z.ZodOptional<z.ZodArray<z.ZodString>>;
421
+ filters: z.ZodOptional<z.ZodObject<{
422
+ actions: z.ZodOptional<z.ZodObject<{
423
+ show: z.ZodOptional<z.ZodArray<z.ZodString>>;
424
+ hide: z.ZodOptional<z.ZodArray<z.ZodString>>;
425
+ }, z.core.$strip>>;
426
+ passive: z.ZodOptional<z.ZodObject<{
427
+ show: z.ZodOptional<z.ZodArray<z.ZodString>>;
428
+ hide: z.ZodOptional<z.ZodArray<z.ZodString>>;
429
+ }, z.core.$strip>>;
430
+ }, z.core.$strip>>;
431
+ pools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
432
+ show: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
433
+ known: "known";
434
+ granted: "granted";
435
+ "not-known": "not-known";
436
+ }>>>;
437
+ off: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
438
+ folded: z.ZodOptional<z.ZodArray<z.ZodString>>;
439
+ }, z.core.$strip>>>;
440
+ }, z.core.$strip>>;
414
441
  state: z.ZodObject<{
415
442
  hp: z.ZodObject<{
416
443
  current: z.ZodNumber;
@@ -432,19 +459,19 @@ export declare const characterSchema: z.ZodObject<{
432
459
  }, z.core.$strip>>;
433
460
  concentration: z.ZodDefault<z.ZodNullable<z.ZodString>>;
434
461
  conditions: z.ZodDefault<z.ZodArray<z.ZodEnum<{
462
+ incapacitated: "incapacitated";
463
+ unconscious: "unconscious";
435
464
  poisoned: "poisoned";
436
465
  grappled: "grappled";
437
466
  paralyzed: "paralyzed";
438
467
  petrified: "petrified";
439
468
  prone: "prone";
440
469
  restrained: "restrained";
441
- unconscious: "unconscious";
442
470
  charmed: "charmed";
443
471
  frightened: "frightened";
444
472
  blinded: "blinded";
445
473
  deafened: "deafened";
446
474
  stunned: "stunned";
447
- incapacitated: "incapacitated";
448
475
  invisible: "invisible";
449
476
  }>>>;
450
477
  exhaustion: z.ZodDefault<z.ZodNumber>;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  characterOverridesShape,
3
3
  characterSchema
4
- } from "../chunk-UE6LKRXQ.js";
4
+ } from "../chunk-T6QIF5XR.js";
5
5
  import "../chunk-S7REMWW4.js";
6
6
  export {
7
7
  characterOverridesShape,
@@ -251,6 +251,28 @@ export interface CharacterState {
251
251
  /** @deprecated SP5: removed; per-entry attuned flag is canonical. Tolerated until Task 4 parser migration strips it. */
252
252
  attuned_items?: string[];
253
253
  }
254
+ /** Per-character sheet state (phases AF and SL): layout and Actions/Passive view choices. Mirrors `sheetStateSchema`. */
255
+ export interface SheetViewFilter {
256
+ show?: string[];
257
+ hide?: string[];
258
+ }
259
+ /** PT (spec §7): one pool tab's view: what Show keeps, the facet values un-ticked (by facet id), the folded groups. */
260
+ export interface SheetPoolView {
261
+ show?: "known" | "granted" | "not-known";
262
+ off?: Record<string, string[]>;
263
+ folded?: string[];
264
+ }
265
+ export interface CharacterSheetState {
266
+ layout?: {
267
+ saves?: "section";
268
+ };
269
+ favorites?: string[];
270
+ filters?: {
271
+ actions?: SheetViewFilter;
272
+ passive?: SheetViewFilter;
273
+ };
274
+ pools?: Record<string, SheetPoolView>;
275
+ }
254
276
  export interface Character {
255
277
  name: string;
256
278
  edition: Edition;
@@ -309,6 +331,7 @@ export interface Character {
309
331
  vulnerabilities?: string[];
310
332
  condition_immunities?: string[];
311
333
  };
334
+ sheet?: CharacterSheetState;
312
335
  state: CharacterState;
313
336
  }
314
337
  /** R4-G7 T8 RIDER-23 (F-FEATSRC) · the slot that granted a feat: a class's `choices[<level>].feat` pick, or a 2024
@@ -321,6 +344,15 @@ export type FeatVia = {
321
344
  } | {
322
345
  kind: "background";
323
346
  slug: string;
347
+ }
348
+ /** D2b-A (design §2.2 step 6): a feat a POOL MEMBER grants (Lessons of the First Ones' Origin feat). `slug` is the
349
+ * member's note slug and `name` its display name; `classSlug` / `level` are the pool's class and anchor level. */
350
+ | {
351
+ kind: "pool";
352
+ slug: string;
353
+ name: string;
354
+ classSlug: string;
355
+ level: number;
324
356
  };
325
357
  export type FeatureSource = {
326
358
  kind: "class";
@@ -463,8 +495,9 @@ export interface ResolvedPool {
463
495
  * 2026-09-05 with `grep -rn "pool\.layout" packages/obsidian/src`, one line) and reads
464
496
  * authored-then-derived-then-default before handing the string to the `PoolTab` constructor. */
465
497
  layout?: PoolLayout;
466
- /** The OWNED resource id the members spend (majority of `consumes.resource` among the ids the
467
- * character owns); undefined when no member consumes an owned id (R4-G4 §4.2.3, Gate 0 B1). */
498
+ /** The OWNED resource id the members spend: the majority of the members' PAYERS (H3b `payingResourceId`: the named id
499
+ * when owned, else its owned declared equivalent, the pool's class first); undefined when no member has an owned payer
500
+ * (R4-G4 §4.2.3, Gate 0 B1; H3b spec §4). */
468
501
  resource?: string;
469
502
  /** ART-a (spec §4.5): the declaration's `count.label`, copied raw; read through `poolCountLabel` (absent reads "Known"). */
470
503
  countLabel?: string;
@@ -579,6 +612,10 @@ export interface DamageRider {
579
612
  source?: string;
580
613
  condition?: string;
581
614
  scope?: WeaponScope[];
615
+ /** D2b-A: the source of the feature the rider comes from, so its amount resolves against the OWNING class's level
616
+ * and spellcasting modifier (a multiclass character's Guided Precision reads the Artificer's INT). Set by
617
+ * `computeFeatureEffects`; consumed and DROPPED by recalc's rider resolution (an attack row never carries it). */
618
+ owner?: FeatureSource;
582
619
  }
583
620
  export interface AttackRow {
584
621
  id: string;
@@ -660,6 +697,12 @@ export interface AppliedBonuses {
660
697
  ability_bonuses: Partial<Record<Ability, number>>;
661
698
  ability_statics: Partial<Record<Ability, number>>;
662
699
  save_bonus: number;
700
+ /** SL (spec §11.3): `save_bonus` term by term, one per item, each named by the entry's display name (`overrides.name`, else
701
+ * the item's). The saves breakdown lists these, never a lumped "Equipment" term. */
702
+ save_terms: {
703
+ source: string;
704
+ amount: number;
705
+ }[];
663
706
  speed_bonuses: {
664
707
  walk: number;
665
708
  fly: number | "walk" | null;
@@ -0,0 +1,15 @@
1
+ import type { WeaponEntity } from "@archivist-gg/dnd5e/weapon/weapon.types";
2
+ export interface QualifiedWeaponGrant {
3
+ category: "simple" | "martial";
4
+ /** Absent: melee and ranged alike. */
5
+ range?: "melee" | "ranged";
6
+ /** Weapon property keys as the weapon notes carry them (`two_handed`, `finesse`). */
7
+ properties: string[];
8
+ /** true: the weapon has NONE of `properties` ("that don't have"); false: it has ANY of them ("that have"). */
9
+ without: boolean;
10
+ }
11
+ /** The grant a phrase states, or null when it is not a property-qualified category phrase (a weapon name, "simple"). */
12
+ export declare function parseQualifiedWeaponGrant(text: string): QualifiedWeaponGrant | null;
13
+ /** Does the qualified grant `text` cover `weapon`? False for any text that is not such a grant. Melee / ranged is the attack
14
+ * mode the classifier reconstructs, not the category suffix (a thrown melee weapon may be filed `*-ranged`). */
15
+ export declare function qualifiedGrantCovers(text: string, weapon: Pick<WeaponEntity, "category" | "properties" | "range" | "slug">): boolean;
@@ -17,19 +17,13 @@ export declare const RENDERING_HINT_LAYOUT: Readonly<Record<string, PoolLayout>>
17
17
  * function as the layout, and one junk member beside genuine `dice-pool` members collapsed a
18
18
  * correct majority into a phantom tie. */
19
19
  export declare function derivePoolLayout(entries: ReadonlyArray<ResolvedPoolEntry>): PoolLayout | undefined;
20
- /** ART-D (spec §7.2): the rows every pool tab draws unless its declaration authors `spell-like`. Applied AT READ by
21
- * {@link poolPresentation}, never as a zod `.default()`, so a parsed note gains no key (the importer's round trip). */
22
- export declare const DEFAULT_POOL_ROWS: "blocks";
23
20
  export type PoolHead = "dice" | "points";
24
- export type PoolRows = "blocks" | "spell-like";
25
21
  export interface PoolPresentation {
26
22
  head: PoolHead;
27
- rows: PoolRows;
28
23
  }
29
- /** ART-D (spec §7.2, Gate 1 C1): a pool tab's two data axes.
30
- * - HEAD: an authored `dice-pool` / `point-pool` wins; otherwise the DERIVED layout decides (points for `point-pool`,
31
- * dice for anything else).
32
- * - ROWS: `spell-like` only when the declaration AUTHORS it; otherwise {@link DEFAULT_POOL_ROWS}. */
24
+ /** A pool tab's ONE data axis (PT spec §9; ART-D's rows axis is retired: every pool tab draws the table).
25
+ * HEAD: an authored `dice-pool` / `point-pool` wins; otherwise the DERIVED layout decides (points for `point-pool`,
26
+ * dice for anything else). An authored `blocks` or `spell-like` still parses and is ignored. */
33
27
  export declare function poolPresentation(authored?: PoolLayout, derived?: PoolLayout): PoolPresentation;
34
28
  /** The ONE `rendering_hint` to `EntryAffordance` table (R4-G5 §4.2.1, invariant 3): the PER-ENTRY sibling of
35
29
  * `RENDERING_HINT_LAYOUT`. `granted-die-to-ally` is its only key, and the four documents carrying it
@@ -1,16 +1,14 @@
1
1
  import {
2
2
  AFFORDANCE_CAPTIONS,
3
- DEFAULT_POOL_ROWS,
4
3
  RENDERING_HINT_AFFORDANCE,
5
4
  RENDERING_HINT_LAYOUT,
6
5
  deriveEntryAffordance,
7
6
  derivePoolLayout,
8
7
  formatAffordanceCaption,
9
8
  poolPresentation
10
- } from "../chunk-HJQNK3J5.js";
9
+ } from "../chunk-B3DP42OM.js";
11
10
  export {
12
11
  AFFORDANCE_CAPTIONS,
13
- DEFAULT_POOL_ROWS,
14
12
  RENDERING_HINT_AFFORDANCE,
15
13
  RENDERING_HINT_LAYOUT,
16
14
  deriveEntryAffordance,
@@ -0,0 +1,44 @@
1
+ import type { ResourceIndex } from "./pc.resources.js";
2
+ import type { FeatureSource, ResolvedClass, ResolvedFeature } from "./pc.types.js";
3
+ /**
4
+ * H3b (spec `2026-09-28-h3b-resource-equivalents-design.md` §2): DECLARED equivalent resource ids. Each group says "these
5
+ * ids name ONE resource": the books and the SRD data mint different ids for the same pool (edition twins such as
6
+ * `fighter:superiority-dice` / `fighter-2024:superiority-dice`, book drift such as `monk:ki` / `monk:focus-point`,
7
+ * singular / plural such as `sorcerer:sorcery-point(s)`). Nothing is ever derived from an id's shape: an id in no group
8
+ * has no equivalent. The order inside a group is the fallback preference ({@link payingResourceId} step 4).
9
+ *
10
+ * The groups were measured over the installed vault (every class paired with every subclass of the same class, census in
11
+ * `.superpowers/sdd/h3b-evidence/`) and each checked against its declaring notes. The bare `channel-divinity` is the SRD
12
+ * 2024 id of BOTH the Cleric and the Paladin, so it sits in both Channel Divinity groups. Equivalence is read as "shares a
13
+ * group with", never transitively: `cleric:` / `cleric-2024:` never answer for `paladin:` / `paladin-2024:`. The bare id
14
+ * does answer for both, so a paladin consumer whose own class owns no Channel Divinity pays from a bare id another class
15
+ * (an SRD 2024 Cleric) declares: the one Channel Divinity pool of the 2014 multiclass rule (review m1, H3b).
16
+ */
17
+ export interface ResourceEquivalentGroup {
18
+ readonly name: string;
19
+ readonly ids: readonly string[];
20
+ }
21
+ export declare const RESOURCE_EQUIVALENTS: readonly ResourceEquivalentGroup[];
22
+ /** Every id that shares a group with `id`, in declared order (group order, then the order inside the group), `id` itself
23
+ * excluded, each once. Empty for an id in no group. */
24
+ export declare function equivalentResourceIds(id: string, groups?: readonly ResourceEquivalentGroup[]): string[];
25
+ /**
26
+ * THE rule (spec §3): which OWNED resource pays for a consumption naming `id`.
27
+ * 1. the candidates are `id`, then its declared equivalents in declared order, kept only when the character owns them;
28
+ * 2. none: `undefined` (the caller keeps the raw id: no control, never a spend from nothing);
29
+ * 3. the first candidate the consumer's OWN class entry declares (`owner`, its class or subclass) pays, so a class's
30
+ * feature or pool member spends its class's pool even when a feat owns a twin id (TCE Metamagic Adept on a 2014
31
+ * Sorcerer declares `sorcerer-2024:sorcery-point`);
32
+ * 4. else the first candidate: the named id itself when it is owned.
33
+ * Exactly one id per consumer, so a spend writes one `feature_uses` key.
34
+ */
35
+ export declare function payingResourceId(id: string, index: ResourceIndex, owner?: ResolvedClass | null, groups?: readonly ResourceEquivalentGroup[]): string | undefined;
36
+ /** The class entry a feature belongs to: a class feature's class, a subclass feature's class; none for a race,
37
+ * background, feat or campaign feature. */
38
+ export declare function classOfSource(source: FeatureSource, classes: readonly ResolvedClass[]): ResolvedClass | null;
39
+ /**
40
+ * Spec §4: every resolved feature whose `consumes.resource` has a different payer becomes a COPY (wrapper, feature and
41
+ * consumes; only `resource` changes). The registry `Feature` is shared by every open sheet and is never written; a
42
+ * feature with no `consumes.resource`, one paid by the id it names, or one with no owned candidate keeps its identity.
43
+ */
44
+ export declare function bindFeatureConsumers(features: ResolvedFeature[], index: ResourceIndex, classes: readonly ResolvedClass[]): ResolvedFeature[];
@@ -1,12 +1,7 @@
1
- // src/pc/spell-source.ts
2
- var SPELL_SOURCE = {
3
- class: { ownAbility: false, section: "spellbook", freeCastWhenNoSlot: false, showInPrepare: true, countsAsGranted: false },
4
- feat: { ownAbility: true, section: "spellbook", freeCastWhenNoSlot: true, showInPrepare: true, countsAsGranted: true },
5
- item: { ownAbility: false, section: "consumable", freeCastWhenNoSlot: false, showInPrepare: false, countsAsGranted: true },
6
- race: { ownAbility: true, section: "spellbook", freeCastWhenNoSlot: true, showInPrepare: true, countsAsGranted: true },
7
- domain: { ownAbility: false, section: "spellbook", freeCastWhenNoSlot: false, showInPrepare: true, countsAsGranted: false }
8
- };
9
- var spellSource = (s) => SPELL_SOURCE[s.source];
1
+ import {
2
+ SPELL_SOURCE,
3
+ spellSource
4
+ } from "../chunk-KR6JF3BF.js";
10
5
  export {
11
6
  SPELL_SOURCE,
12
7
  spellSource
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  raceCodec
3
- } from "../chunk-MC5YJ4PB.js";
4
- import "../chunk-R2V5LN3I.js";
5
- import "../chunk-X7VZY4ON.js";
3
+ } from "../chunk-AZRGFUSR.js";
4
+ import "../chunk-Y5VVP73C.js";
5
+ import "../chunk-FANQVQ3D.js";
6
6
  import "../chunk-4U55VNC7.js";
7
- import "../chunk-FPGXFD2M.js";
7
+ import "../chunk-YD2VAHA6.js";
8
8
  import "../chunk-WYGD2UGN.js";
9
9
  import "../chunk-ZJXSXVFP.js";
10
- import "../chunk-BRGLDWUP.js";
11
- import "../chunk-ZMJQUZQH.js";
10
+ import "../chunk-5MXFW4O3.js";
11
+ import "../chunk-2JSQE3DD.js";
12
12
  import "../chunk-UA5KS2PL.js";
13
13
  export {
14
14
  raceCodec
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  parseRace
3
- } from "../chunk-R2V5LN3I.js";
4
- import "../chunk-X7VZY4ON.js";
3
+ } from "../chunk-Y5VVP73C.js";
4
+ import "../chunk-FANQVQ3D.js";
5
5
  import "../chunk-4U55VNC7.js";
6
- import "../chunk-FPGXFD2M.js";
6
+ import "../chunk-YD2VAHA6.js";
7
7
  import "../chunk-WYGD2UGN.js";
8
8
  import "../chunk-ZJXSXVFP.js";
9
- import "../chunk-BRGLDWUP.js";
10
- import "../chunk-ZMJQUZQH.js";
9
+ import "../chunk-5MXFW4O3.js";
10
+ import "../chunk-2JSQE3DD.js";
11
11
  import "../chunk-UA5KS2PL.js";
12
12
  export {
13
13
  parseRace
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  fixedAsiSchema,
3
3
  raceEntitySchema
4
- } from "../chunk-X7VZY4ON.js";
5
- import "../chunk-FPGXFD2M.js";
4
+ } from "../chunk-FANQVQ3D.js";
5
+ import "../chunk-YD2VAHA6.js";
6
6
  import "../chunk-WYGD2UGN.js";
7
7
  import "../chunk-ZJXSXVFP.js";
8
- import "../chunk-BRGLDWUP.js";
9
- import "../chunk-ZMJQUZQH.js";
8
+ import "../chunk-5MXFW4O3.js";
9
+ import "../chunk-2JSQE3DD.js";
10
10
  import "../chunk-UA5KS2PL.js";
11
11
  export {
12
12
  fixedAsiSchema,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  choiceSchema
3
- } from "../chunk-BRGLDWUP.js";
4
- import "../chunk-ZMJQUZQH.js";
3
+ } from "../chunk-5MXFW4O3.js";
4
+ import "../chunk-2JSQE3DD.js";
5
5
  export {
6
6
  choiceSchema
7
7
  };