@wildshard/shard-format 0.38.0 → 0.38.1
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.
- package/package.json +1 -1
- package/src/format/creature-patrols.ts +151 -0
- package/src/format/creatures.ts +8 -5
- package/src/format/encounters.ts +24 -2
- package/src/format/groupBrains.ts +4 -0
- package/src/format/memory-armed.json +193 -1
- package/src/format/memory-armed.ts +17 -2
- package/src/format/primitive-table.ts +7 -3
- package/src/format/primitives.ts +15 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.1",
|
|
4
4
|
"description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
array,
|
|
3
|
+
check,
|
|
4
|
+
finite,
|
|
5
|
+
maxLength,
|
|
6
|
+
maxValue,
|
|
7
|
+
minLength,
|
|
8
|
+
minValue,
|
|
9
|
+
number,
|
|
10
|
+
pipe,
|
|
11
|
+
regex,
|
|
12
|
+
strictObject,
|
|
13
|
+
string,
|
|
14
|
+
tuple,
|
|
15
|
+
} from 'valibot'
|
|
16
|
+
|
|
17
|
+
import type { GenericSchema } from 'valibot'
|
|
18
|
+
|
|
19
|
+
/** Metres per second: a walking patrol, up to a run. */
|
|
20
|
+
const MAX_SPEED = 15
|
|
21
|
+
/** Metres: the cell's half-width. */
|
|
22
|
+
const MAX_COORD = 250
|
|
23
|
+
const MAX_RADIUS = 250
|
|
24
|
+
const MIN_RADIUS = 0.5
|
|
25
|
+
const MIN_STOPS = 2
|
|
26
|
+
const MAX_STOPS = 32
|
|
27
|
+
const MAX_MEMBERS = 16
|
|
28
|
+
const MAX_ID = 128
|
|
29
|
+
const MAX_PATROLS = 64
|
|
30
|
+
const MIN_SPEED = 0.1
|
|
31
|
+
const ONE = 1
|
|
32
|
+
const NONE = 0
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ONE-FORMAT OF37a (Q-S10: a separate patrol primitive). A patrol walks its members round `route` at `speed`, in step;
|
|
36
|
+
* a player within `engage` metres of any member draws the patrol into the fight, and once every member is more than
|
|
37
|
+
* `leash` metres from the route it gives up and walks back to where it left the route. Its members are creature spawns
|
|
38
|
+
* that belong to no other group. Nalati's `encounter.patrol` and timed encounters move onto it (OF37b).
|
|
39
|
+
*/
|
|
40
|
+
interface CreaturePatrol {
|
|
41
|
+
id: string
|
|
42
|
+
members: string[]
|
|
43
|
+
route: [number, number, number][]
|
|
44
|
+
speed: number
|
|
45
|
+
engage: number
|
|
46
|
+
leash: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const id = pipe(string(), regex(/^[a-z][a-z0-9.:-]*$/u), maxLength(MAX_ID))
|
|
50
|
+
const coord = pipe(
|
|
51
|
+
number(),
|
|
52
|
+
finite(),
|
|
53
|
+
minValue(-MAX_COORD),
|
|
54
|
+
maxValue(MAX_COORD),
|
|
55
|
+
)
|
|
56
|
+
const radius = pipe(
|
|
57
|
+
number(),
|
|
58
|
+
finite(),
|
|
59
|
+
minValue(MIN_RADIUS),
|
|
60
|
+
maxValue(MAX_RADIUS),
|
|
61
|
+
)
|
|
62
|
+
const stop = tuple([coord, coord, coord])
|
|
63
|
+
const route = pipe(
|
|
64
|
+
array(stop),
|
|
65
|
+
minLength(MIN_STOPS, 'A patrol route needs two stops'),
|
|
66
|
+
maxLength(MAX_STOPS),
|
|
67
|
+
)
|
|
68
|
+
const members = pipe(
|
|
69
|
+
array(id),
|
|
70
|
+
minLength(ONE, 'A patrol needs a member'),
|
|
71
|
+
maxLength(MAX_MEMBERS),
|
|
72
|
+
)
|
|
73
|
+
const speed = pipe(number(), finite(), minValue(MIN_SPEED), maxValue(MAX_SPEED))
|
|
74
|
+
|
|
75
|
+
/** A patrol as the rules read it. */
|
|
76
|
+
interface PatrolReading {
|
|
77
|
+
readonly id: string
|
|
78
|
+
readonly members: readonly string[]
|
|
79
|
+
readonly engage: number
|
|
80
|
+
readonly leash: number
|
|
81
|
+
}
|
|
82
|
+
interface GroupReading {
|
|
83
|
+
readonly members: readonly string[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function leashOutreaches(row: PatrolReading): boolean {
|
|
87
|
+
return row.leash >= row.engage
|
|
88
|
+
}
|
|
89
|
+
const patrol = pipe(
|
|
90
|
+
strictObject({ id, members, route, speed, engage: radius, leash: radius }),
|
|
91
|
+
check<CreaturePatrol, string>(
|
|
92
|
+
leashOutreaches,
|
|
93
|
+
'A patrol leash reaches at least its engage radius',
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
const CreaturePatrolsSchema: GenericSchema<CreaturePatrol[]> = pipe(
|
|
97
|
+
array(patrol),
|
|
98
|
+
maxLength(MAX_PATROLS),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
/** Each member once across the patrols and groups: the members already taken by a group or an earlier patrol. */
|
|
102
|
+
function memberErrors(
|
|
103
|
+
row: PatrolReading,
|
|
104
|
+
known: ReadonlySet<string>,
|
|
105
|
+
taken: Set<string>,
|
|
106
|
+
): string[] {
|
|
107
|
+
const errors: string[] = []
|
|
108
|
+
for (const member of row.members) {
|
|
109
|
+
if (!known.has(member)) {
|
|
110
|
+
errors.push('declared patrol member')
|
|
111
|
+
}
|
|
112
|
+
if (taken.has(member)) {
|
|
113
|
+
errors.push('a patrol member belongs to one controller')
|
|
114
|
+
}
|
|
115
|
+
taken.add(member)
|
|
116
|
+
}
|
|
117
|
+
return errors
|
|
118
|
+
}
|
|
119
|
+
/** Patrol references: unique ids, members that are spawns, and no spawn in two patrols or in a group too. */
|
|
120
|
+
function patrolRules(
|
|
121
|
+
patrols: readonly PatrolReading[],
|
|
122
|
+
spawns: readonly Readonly<{ id: string }>[],
|
|
123
|
+
groups: readonly GroupReading[],
|
|
124
|
+
): string[] {
|
|
125
|
+
const known = new Set(
|
|
126
|
+
spawns.map((row: Readonly<{ id: string }>): string => row.id),
|
|
127
|
+
)
|
|
128
|
+
const taken = new Set(
|
|
129
|
+
groups.flatMap((row: GroupReading): readonly string[] => row.members),
|
|
130
|
+
)
|
|
131
|
+
const ids = new Set(patrols.map((row: PatrolReading): string => row.id))
|
|
132
|
+
const errors = ids.size === patrols.length ? [] : ['unique patrol ids']
|
|
133
|
+
return [
|
|
134
|
+
...errors,
|
|
135
|
+
...patrols.flatMap((row: PatrolReading): string[] =>
|
|
136
|
+
memberErrors(row, known, taken),
|
|
137
|
+
),
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Whether the patrols' references hold (`patrolRules` finds nothing). */
|
|
142
|
+
function patrolsAdmitted(
|
|
143
|
+
patrols: readonly PatrolReading[],
|
|
144
|
+
spawns: readonly Readonly<{ id: string }>[],
|
|
145
|
+
groups: readonly GroupReading[],
|
|
146
|
+
): boolean {
|
|
147
|
+
return patrolRules(patrols, spawns, groups).length === NONE
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type { CreaturePatrol }
|
|
151
|
+
export { CreaturePatrolsSchema, patrolRules, patrolsAdmitted }
|
package/src/format/creatures.ts
CHANGED
|
@@ -7,9 +7,12 @@ import { ReturnProgramSchema } from './namedJsonContracts.ts';
|
|
|
7
7
|
import { NativeRidingSchema } from './nativeRiding.ts';
|
|
8
8
|
import { isJsonData } from './json.ts';
|
|
9
9
|
import { StalkerSchema, GuardianPatternsSchema, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema } from './brains.ts';
|
|
10
|
-
import {
|
|
10
|
+
import type { CreaturePatrol } from './groupBrains.ts';
|
|
11
|
+
import { CreaturePatrolsSchema, patrolsAdmitted, GroupBrainSchema, groupBrainRules, GuardedHerdGuestSchema, GroupGuestBindingSchema } from './groupBrains.ts';
|
|
11
12
|
import { RamGrazerSchema, ChallengeGrazerSchema, GrazerSchema } from './grazers.ts';
|
|
12
13
|
import { DiverSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema } from './flyers.ts';
|
|
14
|
+
/** One creature spawn row; input and output differ only in the home they carry. */
|
|
15
|
+
interface CreatureSpawnRow<Home> { perchBody?: string; group?: string; rank?: 'veteran' | 'elite' | 'champion' | 'legendary'; count?: { per: number; max: number }; when?: { quest?: { id: string; stage: number }; time?: 'day' | 'night'; wave?: { set: string; index: number } }; phaseOffset?: number | undefined; respawn?: number | undefined; home?: Home | undefined; id: string; species: string; variant: string; brain: (string) | null; strike: (string) | null; seed: number; scale: number; at: [number, number, number]; yaw: number; }
|
|
13
16
|
|
|
14
17
|
const id = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9.:-]*$/u), v.maxLength(128));
|
|
15
18
|
const finite = v.pipe(v.number(), v.finite());
|
|
@@ -81,8 +84,8 @@ const timeWhen = v.picklist(['day', 'night'], 'unknown spawn time');
|
|
|
81
84
|
const when = v.strictObject({ quest: v.exactOptional(questWhen), time: v.exactOptional(timeWhen), wave: v.exactOptional(waveWhen) }, 'unknown spawn condition');
|
|
82
85
|
const spawn = v.strictObject({ perchBody: v.exactOptional(id), group: v.exactOptional(id), rank: v.exactOptional(rank), count: v.exactOptional(count), when: v.exactOptional(when), phaseOffset: v.optional(phase), home: v.optional(CreatureHomeSchema), respawn: v.optional(respawn), id, species: id, variant: id, brain: v.nullable(id), strike: v.nullable(id), seed: v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(0xffffffff)), scale: v.pipe(finite, v.minValue(0.1), v.maxValue(10)), at: v.tuple([coord, coord, coord]), yaw: finite });
|
|
83
86
|
/** Pure-data creature archetypes and stable spawn layouts, expanded before the local sim boots. */
|
|
84
|
-
export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ perchBodies: v.exactOptional(CreaturePerchBodiesSchema), brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
|
|
85
|
-
v.check((c) => creatureRules(c).length === 0, 'creature reference rules'));
|
|
87
|
+
export const CreaturesSchema: v.GenericSchema<ShardCreaturesInput, ShardCreatures> = v.pipe(v.strictObject({ perchBodies: v.exactOptional(CreaturePerchBodiesSchema), brains: v.pipe(v.array(v.variant('kind', [brain, SkirmisherSchema, GuardianSchema, PerchHunterSchema, ScriptBrainSchema, RamGrazerSchema, ChallengeGrazerSchema, OrbitDiverSchema, PatrolDiverSchema, BurstFlyerSchema, GrazerSchema, DiverSchema, GuardianPatternsSchema, StalkerSchema])), v.maxLength(64)), groups: v.optional(v.pipe(v.array(GroupBrainSchema), v.maxLength(64)), []), patrols: v.exactOptional(CreaturePatrolsSchema), spawns: v.pipe(v.array(spawn), v.maxLength(10000)) }),
|
|
88
|
+
v.check((c) => creatureRules(c).length === 0 && patrolsAdmitted(c.patrols ?? [], c.spawns, c.groups), 'creature reference rules'));
|
|
86
89
|
/** Validated brain parameters and spawn layout, with no rig or runtime closure. */
|
|
87
90
|
|
|
88
91
|
/** Unique ids and brain references; species and strikes are resolved against the loader's declared catalogues. */
|
|
@@ -185,8 +188,8 @@ export interface CreatureMemoryActionsRows { stateKey: string; states: (string)[
|
|
|
185
188
|
export interface CreatureBodyRecipeRowsInput { actions?: CreatureMemoryActionsRowsInput; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
186
189
|
export interface CreatureBodyRecipeRows { actions?: CreatureMemoryActionsRows; offset?: { field: string; from: number; to: number; }; kind: 'animal'; motion: 'ground' | 'flight'; attack: 'keeper' | 'unlimited'; stunned: 'none' | 'look-hold'; contact: ({ kind: 'environment'; halfArc: number; }) | ({ kind: 'actor'; halfArc: number; move: string; }); }
|
|
187
190
|
// oxlint-disable-next-line typescript/consistent-type-definitions -- Valibot's readonly defaults need the alias's implicit dictionary compatibility.
|
|
188
|
-
export type ShardCreaturesInput = { perchBodies?: CreaturePerchBodyInput[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined;
|
|
189
|
-
export interface ShardCreatures { perchBodies?: CreaturePerchBody[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[];
|
|
191
|
+
export type ShardCreaturesInput = { perchBodies?: CreaturePerchBodyInput[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferInput<typeof SkirmisherSchema>) | (v.InferInput<typeof GuardianSchema>) | (v.InferInput<typeof PerchHunterSchema>) | (v.InferInput<typeof ScriptBrainSchema>) | (v.InferInput<typeof RamGrazerSchema>) | (v.InferInput<typeof ChallengeGrazerSchema>) | (v.InferInput<typeof OrbitDiverSchema>) | (v.InferInput<typeof PatrolDiverSchema>) | (v.InferInput<typeof BurstFlyerSchema>) | (v.InferInput<typeof GrazerSchema>) | (v.InferInput<typeof DiverSchema>) | (v.InferInput<typeof GuardianPatternsSchema>) | (v.InferInput<typeof StalkerSchema>))[]; groups?: (v.InferInput<typeof GroupBrainSchema>)[] | undefined; patrols?: CreaturePatrol[]; spawns: CreatureSpawnRow<ShardCreatureHomeInput>[]; };
|
|
192
|
+
export interface ShardCreatures { perchBodies?: CreaturePerchBody[]; brains: (({ id: string; kind: 'pursue'; awareRadius: number; leashRadius: number; speed: number; returnSpeed: number; stopDistance: number; turnRate: number; thinkDivisor: number; attackCooldownTicks: number; wanderRadius: number; wanderEveryTicks: number; }) | (v.InferOutput<typeof SkirmisherSchema>) | (v.InferOutput<typeof GuardianSchema>) | (v.InferOutput<typeof PerchHunterSchema>) | (v.InferOutput<typeof ScriptBrainSchema>) | (v.InferOutput<typeof RamGrazerSchema>) | (v.InferOutput<typeof ChallengeGrazerSchema>) | (v.InferOutput<typeof OrbitDiverSchema>) | (v.InferOutput<typeof PatrolDiverSchema>) | (v.InferOutput<typeof BurstFlyerSchema>) | (v.InferOutput<typeof GrazerSchema>) | (v.InferOutput<typeof DiverSchema>) | (v.InferOutput<typeof GuardianPatternsSchema>) | (v.InferOutput<typeof StalkerSchema>))[]; groups: (v.InferOutput<typeof GroupBrainSchema>)[]; patrols?: CreaturePatrol[]; spawns: CreatureSpawnRow<ShardCreatureHome>[]; }
|
|
190
193
|
export type CreatureStrikeRowsInput = CreatureStrikeRows;
|
|
191
194
|
export interface CreatureStrikeRows { debris?: StrikeDebrisPolicy; id: string; shape: ({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }); windup: number; active: number; recover: number; cooldown: number; range: (number) | null; damage: number; tags: (`${string}.${string}`)[]; weight: ({ kind: 'constant'; value: number; }) | ({ kind: 'horizontal-distance'; above: number; far: number; near: number; }); units?: 'world' | 'actor'; alternatives?: (({ kind: 'arc'; radius: number; halfAngle: number; yawOffset?: number; }) | ({ kind: 'lane'; length: number; width: number; }) | ({ kind: 'ring'; inner: number; outer: number; }) | ({ kind: 'wedge'; length: number; halfAngle: number; }) | ({ kind: 'point'; radius: number; exclusive?: boolean; }) | ({ kind: 'sphere'; radius: number; }))[]; motion?: { speed?: number; delay?: number; track?: 'none' | 'lead' | 'follow'; overshoot?: number; skid?: number; }; eligibility?: { maxDy?: number; jumpDodges?: boolean; }; }
|
|
192
195
|
export type CreatureStrikesInput = unknown;
|
package/src/format/encounters.ts
CHANGED
|
@@ -8,10 +8,29 @@ const point = v.tuple([coord, coord, coord]);
|
|
|
8
8
|
const positive = v.pipe(finite, v.minValue(0.001), v.maxValue(500));
|
|
9
9
|
const duration = v.pipe(finite, v.minValue(0), v.maxValue(60));
|
|
10
10
|
const phase = v.strictObject({ at: v.pipe(finite, v.minValue(0.001), v.maxValue(1)), name: label, caption: label, speed: v.pipe(finite, v.minValue(0), v.maxValue(15)), stopDistance: v.pipe(finite, v.minValue(0), v.maxValue(50)), turnRate: v.pipe(finite, v.minValue(0), v.maxValue(30)) });
|
|
11
|
+
/**
|
|
12
|
+
* ONE-FORMAT OF34a (J420 (1), Jake 2026-11-18): every boss is three parts. `boss` is the one fight: it `start`s `placed`
|
|
13
|
+
* (its body stands in the world from load, as before), `spawned` (no body until a player enters the arena) or `resident`
|
|
14
|
+
* (its body lives in the world and the fight starts at the first blow, wherever it is), and `capExempt` keeps it out of
|
|
15
|
+
* the cell's fight cap. `boss.arena` is the arena's `bounds`: a `room` resets the fight when every contender has left it,
|
|
16
|
+
* `open` ground when the boss is drawn out past its radius. Tells are any ability's (CC11b), not a boss field. A row
|
|
17
|
+
* without these fields reads as before: placed, capped, no bounds.
|
|
18
|
+
*/
|
|
19
|
+
const BOSS_STARTS = ['placed', 'spawned', 'resident'] as const;
|
|
20
|
+
const ARENA_BOUNDS = ['room', 'open'] as const;
|
|
21
|
+
const start = v.exactOptional(v.picklist(BOSS_STARTS, 'Unknown boss start'));
|
|
22
|
+
const bounds = v.exactOptional(v.picklist(ARENA_BOUNDS, 'Unknown arena bounds'));
|
|
23
|
+
const arena = v.strictObject({ at: point, radius: positive, bounds });
|
|
24
|
+
const capExempt = v.exactOptional(v.literal(true));
|
|
25
|
+
/** Only a boss starts, and only a boss skips the fight cap. */
|
|
26
|
+
function bossOnly(row: Readonly<{ kind: 'elite' | 'boss'; start?: (typeof BOSS_STARTS)[number]; capExempt?: true }>): boolean {
|
|
27
|
+
return row.kind === 'boss' || (row.start === undefined && row.capExempt === undefined);
|
|
28
|
+
}
|
|
11
29
|
const encounter = v.pipe(v.strictObject({ id, entity: id, kind: v.picklist(['elite', 'boss']), panel: v.nullable(id), name: label, title: label, retry: label,
|
|
12
|
-
|
|
30
|
+
start, capExempt, arena, intro: duration, introShort: duration,
|
|
13
31
|
respawn: v.strictObject({ at: point, yaw: finite }), phases: v.pipe(v.array(phase), v.minLength(1), v.maxLength(16)) }),
|
|
14
|
-
v.check((e) => e.phases[0]?.at === 1 && e.phases.every((p, i) => i === 0 || p.at < (e.phases[i - 1]?.at ?? 0)), 'descending phase thresholds starting at 1')
|
|
32
|
+
v.check((e) => e.phases[0]?.at === 1 && e.phases.every((p, i) => i === 0 || p.at < (e.phases[i - 1]?.at ?? 0)), 'descending phase thresholds starting at 1'),
|
|
33
|
+
v.check<ShardEncounters[number], string>(bossOnly, 'Only a boss has a start or capExempt'));
|
|
15
34
|
/** Elite/boss phase tables with checkpoints/retry, neutral steering data and declared panel references. */
|
|
16
35
|
export const EncountersSchema: v.GenericSchema<ShardEncountersInput, ShardEncounters> = v.pipe(v.array(encounter), v.maxLength(64), v.check((rows) => new Set(rows.map((e) => e.id)).size === rows.length && new Set(rows.map((e) => e.entity)).size === rows.length, 'unique encounter ids and actors'));
|
|
17
36
|
/** Validated data-only encounter tables. */
|
|
@@ -36,6 +55,8 @@ export type ShardEncounters = ({
|
|
|
36
55
|
name: string;
|
|
37
56
|
title: string;
|
|
38
57
|
retry: string;
|
|
58
|
+
start?: (typeof BOSS_STARTS)[number];
|
|
59
|
+
capExempt?: true;
|
|
39
60
|
arena: {
|
|
40
61
|
at: [
|
|
41
62
|
number,
|
|
@@ -43,6 +64,7 @@ export type ShardEncounters = ({
|
|
|
43
64
|
number
|
|
44
65
|
];
|
|
45
66
|
radius: number;
|
|
67
|
+
bounds?: (typeof ARENA_BOUNDS)[number];
|
|
46
68
|
};
|
|
47
69
|
intro: number;
|
|
48
70
|
introShort: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
/** Built-in guarded group states shared by its wire rows and native owner. */
|
|
4
5
|
export const GUARDED_STALLION_STATES: readonly ['watch', 'warn', 'display', 'charge', 'wheel', 'lead', 'beaten', 'ridden'] = ['watch', 'warn', 'display', 'charge', 'wheel', 'lead', 'beaten', 'ridden'] as const;
|
|
5
6
|
|
|
@@ -247,3 +248,6 @@ export type GuardedHerdGuestRows = {
|
|
|
247
248
|
references?: Record<string, string>;
|
|
248
249
|
plans?: true;
|
|
249
250
|
} & GroupGuestBindingRows;
|
|
251
|
+
/** ONE-FORMAT OF37a: patrols sit beside the group controllers, so their rules live with them. */
|
|
252
|
+
export { CreaturePatrolsSchema, patrolRules, patrolsAdmitted } from './creature-patrols.ts';
|
|
253
|
+
export type { CreaturePatrol } from './creature-patrols.ts';
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`)
|
|
2
|
+
"$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json.",
|
|
3
3
|
"lines": {
|
|
4
4
|
"playingBytes": 1000000000,
|
|
5
5
|
"loadingBytes": 1500000000
|
|
6
6
|
},
|
|
7
7
|
"zones": {
|
|
8
|
+
"brasscap-mesa": {
|
|
9
|
+
"armed": "2026-11-18",
|
|
10
|
+
"by": "mini-pinemem5",
|
|
11
|
+
"epoch": 8,
|
|
12
|
+
"playingBytes": 679221837,
|
|
13
|
+
"loadingBytes": 984731013,
|
|
14
|
+
"evidence": "engine-pinned product revision 6 (tar f42fe0449a93), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
15
|
+
},
|
|
8
16
|
"driftwood-isle": {
|
|
9
17
|
"armed": "2026-11-18",
|
|
10
18
|
"by": "mini-pinemem5",
|
|
@@ -13,6 +21,22 @@
|
|
|
13
21
|
"loadingBytes": 1157545785,
|
|
14
22
|
"evidence": "shard-driftwood e736730 built with format 0.37 (epoch 8); codex-nalati locked pairs on the EM11 upper read 990.5 / 1,344.7 MB (meta MEMORY-GATES)"
|
|
15
23
|
},
|
|
24
|
+
"far-reach": {
|
|
25
|
+
"armed": "2026-11-18",
|
|
26
|
+
"by": "mini-pinemem5",
|
|
27
|
+
"epoch": 8,
|
|
28
|
+
"playingBytes": 999952196,
|
|
29
|
+
"loadingBytes": 1415754105,
|
|
30
|
+
"evidence": "engine-pinned product revision 4 (tar 5bc5adcf764a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
31
|
+
},
|
|
32
|
+
"ink-cel-valley": {
|
|
33
|
+
"armed": "2026-11-18",
|
|
34
|
+
"by": "mini-pinemem5",
|
|
35
|
+
"epoch": 8,
|
|
36
|
+
"playingBytes": 636979847,
|
|
37
|
+
"loadingBytes": 925290035,
|
|
38
|
+
"evidence": "engine-pinned product revision 1 (tar 5764c86a258a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
39
|
+
},
|
|
16
40
|
"nalati-grasslands": {
|
|
17
41
|
"armed": "2026-11-18",
|
|
18
42
|
"by": "mini-pinemem5",
|
|
@@ -20,6 +44,174 @@
|
|
|
20
44
|
"playingBytes": 945736154,
|
|
21
45
|
"loadingBytes": 1328901899,
|
|
22
46
|
"evidence": "shard-nalati 1d5014e8 built with format 0.37 (epoch 8); mini-resweep EM11 upper on the J420 stand-in: playing 0.940 GB less the worker, loading 1.470 GB (meta MEMORY-GATES)"
|
|
47
|
+
},
|
|
48
|
+
"nine-dragon-stack": {
|
|
49
|
+
"armed": "2026-11-18",
|
|
50
|
+
"by": "mini-pinemem5",
|
|
51
|
+
"epoch": 8,
|
|
52
|
+
"playingBytes": 1023504847,
|
|
53
|
+
"loadingBytes": 1434692360,
|
|
54
|
+
"evidence": "shard-nine-dragon 8779b872 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine d0fd6e62, 9 pairs: playing upper 0.938 GB, loading upper 1.435 GB (meta 1677f091). The estimate's playing (1,023.5 MB) is over the 1.0 GB line, so it locks at that reading"
|
|
55
|
+
},
|
|
56
|
+
"open-plot-alien-plain": {
|
|
57
|
+
"armed": "2026-11-18",
|
|
58
|
+
"by": "mini-pinemem5",
|
|
59
|
+
"epoch": 8,
|
|
60
|
+
"playingBytes": 665173554,
|
|
61
|
+
"loadingBytes": 967392441,
|
|
62
|
+
"evidence": "engine-pinned product revision 1 (tar c32cd9fb9229), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
63
|
+
},
|
|
64
|
+
"open-plot-clockwork-canyon": {
|
|
65
|
+
"armed": "2026-11-18",
|
|
66
|
+
"by": "mini-pinemem5",
|
|
67
|
+
"epoch": 8,
|
|
68
|
+
"playingBytes": 675751489,
|
|
69
|
+
"loadingBytes": 982935896,
|
|
70
|
+
"evidence": "engine-pinned product revision 1 (tar 3b322eccd99e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
71
|
+
},
|
|
72
|
+
"open-plot-coral-drift": {
|
|
73
|
+
"armed": "2026-11-18",
|
|
74
|
+
"by": "mini-pinemem5",
|
|
75
|
+
"epoch": 8,
|
|
76
|
+
"playingBytes": 681768940,
|
|
77
|
+
"loadingBytes": 992453778,
|
|
78
|
+
"evidence": "engine-pinned product revision 1 (tar 87841749dc3f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
79
|
+
},
|
|
80
|
+
"open-plot-desert-ruin": {
|
|
81
|
+
"armed": "2026-11-18",
|
|
82
|
+
"by": "mini-pinemem5",
|
|
83
|
+
"epoch": 8,
|
|
84
|
+
"playingBytes": 686478807,
|
|
85
|
+
"loadingBytes": 997958716,
|
|
86
|
+
"evidence": "engine-pinned product revision 1 (tar 3b65bfef7275), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
87
|
+
},
|
|
88
|
+
"open-plot-ember-forge": {
|
|
89
|
+
"armed": "2026-11-18",
|
|
90
|
+
"by": "mini-pinemem5",
|
|
91
|
+
"epoch": 8,
|
|
92
|
+
"playingBytes": 679682616,
|
|
93
|
+
"loadingBytes": 987005255,
|
|
94
|
+
"evidence": "engine-pinned product revision 1 (tar e1a3a9325e8e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
95
|
+
},
|
|
96
|
+
"open-plot-fossil-badlands": {
|
|
97
|
+
"armed": "2026-11-18",
|
|
98
|
+
"by": "mini-pinemem5",
|
|
99
|
+
"epoch": 8,
|
|
100
|
+
"playingBytes": 671308241,
|
|
101
|
+
"loadingBytes": 976533532,
|
|
102
|
+
"evidence": "engine-pinned product revision 1 (tar 5bbdd51b8db9), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
103
|
+
},
|
|
104
|
+
"open-plot-frostline-peaks": {
|
|
105
|
+
"armed": "2026-11-18",
|
|
106
|
+
"by": "mini-pinemem5",
|
|
107
|
+
"epoch": 8,
|
|
108
|
+
"playingBytes": 694731191,
|
|
109
|
+
"loadingBytes": 1007041500,
|
|
110
|
+
"evidence": "engine-pinned product revision 1 (tar ec7b8879a343), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
111
|
+
},
|
|
112
|
+
"open-plot-jungle-ziggurat": {
|
|
113
|
+
"armed": "2026-11-18",
|
|
114
|
+
"by": "mini-pinemem5",
|
|
115
|
+
"epoch": 8,
|
|
116
|
+
"playingBytes": 683128342,
|
|
117
|
+
"loadingBytes": 992540003,
|
|
118
|
+
"evidence": "engine-pinned product revision 1 (tar 62fdb3cc7e41), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
119
|
+
},
|
|
120
|
+
"open-plot-lantern-bayou": {
|
|
121
|
+
"armed": "2026-11-18",
|
|
122
|
+
"by": "mini-pinemem5",
|
|
123
|
+
"epoch": 8,
|
|
124
|
+
"playingBytes": 679945285,
|
|
125
|
+
"loadingBytes": 989938627,
|
|
126
|
+
"evidence": "engine-pinned product revision 1 (tar 1f9fb1cba098), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
127
|
+
},
|
|
128
|
+
"open-plot-mosslight-ruins": {
|
|
129
|
+
"armed": "2026-11-18",
|
|
130
|
+
"by": "mini-pinemem5",
|
|
131
|
+
"epoch": 8,
|
|
132
|
+
"playingBytes": 693006386,
|
|
133
|
+
"loadingBytes": 1006944516,
|
|
134
|
+
"evidence": "engine-pinned product revision 1 (tar 19840339238b), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
135
|
+
},
|
|
136
|
+
"open-plot-night-market": {
|
|
137
|
+
"armed": "2026-11-18",
|
|
138
|
+
"by": "mini-pinemem5",
|
|
139
|
+
"epoch": 8,
|
|
140
|
+
"playingBytes": 709180040,
|
|
141
|
+
"loadingBytes": 1028237840,
|
|
142
|
+
"evidence": "engine-pinned product revision 1 (tar d8fe11c2db67), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
143
|
+
},
|
|
144
|
+
"open-plot-patchwork-fairground": {
|
|
145
|
+
"armed": "2026-11-18",
|
|
146
|
+
"by": "mini-pinemem5",
|
|
147
|
+
"epoch": 8,
|
|
148
|
+
"playingBytes": 670516626,
|
|
149
|
+
"loadingBytes": 974863462,
|
|
150
|
+
"evidence": "engine-pinned product revision 1 (tar e517f4814ef6), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
151
|
+
},
|
|
152
|
+
"open-plot-saltwind-lighthouse": {
|
|
153
|
+
"armed": "2026-11-18",
|
|
154
|
+
"by": "mini-pinemem5",
|
|
155
|
+
"epoch": 8,
|
|
156
|
+
"playingBytes": 657567209,
|
|
157
|
+
"loadingBytes": 956173411,
|
|
158
|
+
"evidence": "engine-pinned product revision 1 (tar 2e37a04b0c9e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
159
|
+
},
|
|
160
|
+
"open-plot-sky-harbor": {
|
|
161
|
+
"armed": "2026-11-18",
|
|
162
|
+
"by": "mini-pinemem5",
|
|
163
|
+
"epoch": 8,
|
|
164
|
+
"playingBytes": 671985118,
|
|
165
|
+
"loadingBytes": 977835231,
|
|
166
|
+
"evidence": "engine-pinned product revision 1 (tar 9aa4a9839015), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
167
|
+
},
|
|
168
|
+
"open-plot-sky-race": {
|
|
169
|
+
"armed": "2026-11-18",
|
|
170
|
+
"by": "mini-pinemem5",
|
|
171
|
+
"epoch": 8,
|
|
172
|
+
"playingBytes": 671490214,
|
|
173
|
+
"loadingBytes": 977159704,
|
|
174
|
+
"evidence": "engine-pinned product revision 1 (tar a5633d8eee7f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
175
|
+
},
|
|
176
|
+
"open-plot-starfall-observatory": {
|
|
177
|
+
"armed": "2026-11-18",
|
|
178
|
+
"by": "mini-pinemem5",
|
|
179
|
+
"epoch": 8,
|
|
180
|
+
"playingBytes": 674717033,
|
|
181
|
+
"loadingBytes": 981241332,
|
|
182
|
+
"evidence": "engine-pinned product revision 1 (tar 25331b613be1), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
183
|
+
},
|
|
184
|
+
"open-plot-thin-ice": {
|
|
185
|
+
"armed": "2026-11-18",
|
|
186
|
+
"by": "mini-pinemem5",
|
|
187
|
+
"epoch": 8,
|
|
188
|
+
"playingBytes": 657896658,
|
|
189
|
+
"loadingBytes": 957357794,
|
|
190
|
+
"evidence": "engine-pinned product revision 1 (tar 4546f70ddac2), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
191
|
+
},
|
|
192
|
+
"pastel-plain": {
|
|
193
|
+
"armed": "2026-11-18",
|
|
194
|
+
"by": "mini-pinemem5",
|
|
195
|
+
"epoch": 8,
|
|
196
|
+
"playingBytes": 636958876,
|
|
197
|
+
"loadingBytes": 925256481,
|
|
198
|
+
"evidence": "engine-pinned product revision 1 (tar e42e2f5f5793), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
199
|
+
},
|
|
200
|
+
"pine-hollow": {
|
|
201
|
+
"armed": "2026-11-18",
|
|
202
|
+
"by": "mini-pinemem5",
|
|
203
|
+
"epoch": 8,
|
|
204
|
+
"playingBytes": 920666659,
|
|
205
|
+
"loadingBytes": 1298769921,
|
|
206
|
+
"evidence": "shard-pine-hollow 400ed4b7 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine f0a96518, 9 pairs: playing upper 0.969 GB, loading upper 1.407 GB (meta 118a2b13)"
|
|
207
|
+
},
|
|
208
|
+
"sunscar-dunes": {
|
|
209
|
+
"armed": "2026-11-18",
|
|
210
|
+
"by": "mini-pinemem5",
|
|
211
|
+
"epoch": 8,
|
|
212
|
+
"playingBytes": 772000529,
|
|
213
|
+
"loadingBytes": 1108011593,
|
|
214
|
+
"evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
|
|
23
215
|
}
|
|
24
216
|
}
|
|
25
217
|
}
|
|
@@ -31,15 +31,30 @@ function zoneArmed(slug?: string): boolean {
|
|
|
31
31
|
return slug !== undefined && Object.hasOwn(ARMED_ZONES, slug)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/** A rebuild of the same source moves the computed estimate by packing and compression drift only. */
|
|
35
|
+
const ARMED_ALLOWANCE = 0.005
|
|
36
|
+
|
|
37
|
+
/** What an armed zone's offline estimate refuses over: the J410 line, or, when the conservative estimate of a source
|
|
38
|
+
* that EM11 measured under the line already reads over it (Nine's playing), that reading at arming plus the
|
|
39
|
+
* allowance, so the gate locks in the measured state and refuses any growth. Undefined for a zone that only reports. */
|
|
35
40
|
function armedLine(
|
|
36
41
|
slug: string | undefined,
|
|
37
42
|
kind: ArmedKind,
|
|
38
43
|
): number | undefined {
|
|
39
|
-
|
|
44
|
+
const zone =
|
|
45
|
+
slug === undefined || !zoneArmed(slug) ? undefined : ARMED_ZONES[slug]
|
|
46
|
+
if (zone === undefined) {
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
const armedBytes = kind === 'playing' ? zone.playingBytes : zone.loadingBytes
|
|
50
|
+
return Math.max(
|
|
51
|
+
ARMED_LINES[kind],
|
|
52
|
+
armedBytes + Math.floor(armedBytes * ARMED_ALLOWANCE),
|
|
53
|
+
)
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
export {
|
|
57
|
+
ARMED_ALLOWANCE,
|
|
43
58
|
ARMED_LINES,
|
|
44
59
|
ARMED_ZONES,
|
|
45
60
|
type ArmedKind,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
interface PrimitiveSwitch {
|
|
6
6
|
readonly section: string
|
|
7
7
|
readonly path: readonly string[]
|
|
8
|
-
/** When set, the family is on only if some row of the list at `path` has this key. */
|
|
8
|
+
/** When set, the family is on only if some row of the list at `path` has this key (a dotted key reads a nested one). */
|
|
9
9
|
readonly having?: string
|
|
10
10
|
/** With `having`: only a row whose `having` key holds this value counts. */
|
|
11
11
|
readonly equals?: string
|
|
@@ -104,7 +104,11 @@ const TABLE: readonly Primitive[] = [
|
|
|
104
104
|
{
|
|
105
105
|
name: 'boss.arena',
|
|
106
106
|
row: 'OF34',
|
|
107
|
-
on:
|
|
107
|
+
on: {
|
|
108
|
+
section: 'combat/encounters',
|
|
109
|
+
path: ['encounters'],
|
|
110
|
+
having: 'arena.bounds',
|
|
111
|
+
},
|
|
108
112
|
hosts: ['boss.arena', 'boss.open-arena'],
|
|
109
113
|
},
|
|
110
114
|
{
|
|
@@ -130,7 +134,7 @@ const TABLE: readonly Primitive[] = [
|
|
|
130
134
|
{
|
|
131
135
|
name: 'patrol',
|
|
132
136
|
row: 'OF37',
|
|
133
|
-
on: '
|
|
137
|
+
on: { section: 'actors/creatures', path: ['creatures', 'patrols'] },
|
|
134
138
|
hosts: ['encounter.patrol', 'timed.encounters'],
|
|
135
139
|
},
|
|
136
140
|
{
|
package/src/format/primitives.ts
CHANGED
|
@@ -64,6 +64,19 @@ function filled(value: unknown): boolean {
|
|
|
64
64
|
Object.keys(value).length > NONE
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
|
+
/** A row's key, or a nested one by a dotted key (`arena.bounds`). */
|
|
68
|
+
function field(row: object, key: string): { has: boolean; value?: unknown } {
|
|
69
|
+
const keys = key.split('.')
|
|
70
|
+
const last = keys.pop() ?? key
|
|
71
|
+
const holder = at(row, keys)
|
|
72
|
+
if (typeof holder !== 'object' || holder === null) {
|
|
73
|
+
return { has: false }
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
has: Object.hasOwn(holder, last),
|
|
77
|
+
value: Object.getOwnPropertyDescriptor(holder, last)?.value,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
67
80
|
function rowCounts(row: unknown, rule: PrimitiveSwitch): boolean {
|
|
68
81
|
if (typeof row !== 'object' || row === null) {
|
|
69
82
|
return false
|
|
@@ -75,13 +88,8 @@ function rowCounts(row: unknown, rule: PrimitiveSwitch): boolean {
|
|
|
75
88
|
if (having === undefined) {
|
|
76
89
|
return true
|
|
77
90
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return (
|
|
82
|
-
equals === undefined ||
|
|
83
|
-
Object.getOwnPropertyDescriptor(row, having)?.value === equals
|
|
84
|
-
)
|
|
91
|
+
const found = field(row, having)
|
|
92
|
+
return found.has && (equals === undefined || found.value === equals)
|
|
85
93
|
}
|
|
86
94
|
function switchedOn(value: unknown, rule: PrimitiveSwitch): boolean {
|
|
87
95
|
if (rule.having === undefined && rule.lacking === undefined) {
|