Sync parsers and game mechanics with vault changes (2026-08-18 to 08-23)

- talent-parser.ts, discipline-parser.ts, race-parser.ts: rebuilt to read
  from the vault's post-bab5a62 per-topic-file layout (rulebook monoliths
  were split into per-chapter subfolders; discipline/race writeups moved to
  their canonical disciplines/ and races/ folders). All three parsers were
  previously producing zero or broken output for their packs.
- constants.ts, actor-character.ts, actor-npc.ts, rest.ts: mana is now a
  daily pool (Poziom Mocy x3) restored via rest tiers, not a per-round
  budget; Zywotnosc is 2x(Cialo+Umysl+Dusza), not 3x; rest recovery amounts
  updated to match Odetchniecie/Krotki Odpoczynek/Dlugi Odpoczynek.
- combat.ts: removed the now-obsolete per-round mana reset hook.
- actor-npc.ts: Initiative now includes Refleks/Spostrzegawczosc skill
  bonuses (was missing entirely); Magia attribute constrained to valid
  1k10 character-creation values.
- fields.ts: added `choices` support to makeIntField for the above.
- spell-cast.ts: overcast test now uses the correct T-threshold tiers and
  triangular S = E*(E+1)/2 required-successes formula (Zasada
  Nadczarowywania Zaklec).

Not implemented (flagged as new features, out of scope for a sync fix):
mana-exhaustion/overcast-failure penalty tables, overcast bonus taper past
step 2, shield-breaking damage mechanic, elixir-weapon-coating system.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 01:15:38 +02:00
co-authored by Claude Sonnet 5
parent 0fe9dd02d6
commit 1fba0892b9
10 changed files with 345 additions and 396 deletions
+20 -8
View File
@@ -1,9 +1,13 @@
/**
* Rest logic.
*
* Short Rest (Krótki Odpoczynek):
* - Restore HP equal to actor.body.value (capped at max).
* - Restore mana to max-per-spell? - no: short rest does NOT restore mana.
* Breather (Odetchnięcie, 10 min):
* - Restore 1d6 + Wytrzymałość skill value HP (capped at max).
* - Restore 1d6 mana (capped at daily pool max).
*
* Short Rest (Krótki Odpoczynek, 1h+):
* - Restore half of max HP.
* - Restore one third of the daily mana pool.
* - Holders of `Nadzwyczajna Odporność` (alchemy passive) restore 1 elixir tolerance.
*
* Long Rest (Długi Odpoczynek):
@@ -66,8 +70,13 @@ export async function rest(actor: CastableActor, kind: RestKind): Promise<RestRe
if (kind === 'breather') {
if (a.mana?.max != null && manaBefore < a.mana.max) {
update['system.attributes.mana.value'] = a.mana.max;
manaRestored = a.mana.max - manaBefore;
const manaRoll = new Roll('1d6');
await manaRoll.evaluate();
const manaGain = Math.min(manaRoll.total, a.mana.max - manaBefore);
if (manaGain > 0) {
update['system.attributes.mana.value'] = manaBefore + manaGain;
manaRestored = manaGain;
}
}
const endurance = actor.system.skills?.endurance?.value ?? 0;
const roll = new Roll('1d6 + @endurance', { endurance });
@@ -80,10 +89,13 @@ export async function rest(actor: CastableActor, kind: RestKind): Promise<RestRe
}
} else if (kind === 'short') {
if (a.mana?.max != null && manaBefore < a.mana.max) {
update['system.attributes.mana.value'] = a.mana.max;
manaRestored = a.mana.max - manaBefore;
const manaGain = Math.min(Math.ceil(a.mana.max / 3), a.mana.max - manaBefore);
if (manaGain > 0) {
update['system.attributes.mana.value'] = manaBefore + manaGain;
manaRestored = manaGain;
}
}
const healAmount = Math.ceil((a.health?.max ?? 0) / 3);
const healAmount = Math.ceil((a.health?.max ?? 0) / 2);
const heal = Math.min(healAmount, (a.health?.max ?? 0) - hpBefore);
if (heal > 0) {
update['system.attributes.health.value'] = hpBefore + heal;