@arcadia-eternity/content-sdk 4.10.0 → 4.11.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/dist/content-workspace.d.ts +68 -42
- package/dist/content-workspace.js +28 -0
- package/dist/debug-environments.d.ts +50 -130
- package/dist/debug-environments.js +2 -2
- package/dist/environment-host-base.d.ts +17 -42
- package/dist/environment-rules.d.ts +189 -176
- package/dist/environment-rules.js +23 -11
- package/dist/mcp-contracts.d.ts +50 -130
- package/dist/prepared-document.d.ts +51 -126
- package/dist/rule-composition.d.ts +19 -191
- package/dist/rule-composition.js +11 -219
- package/dist/template/package.json +2 -2
- package/dist/testing.js +5 -3
- package/package.json +5 -5
|
@@ -14,12 +14,20 @@ export declare function assertEnvironmentTeam(input: unknown, team: unknown): vo
|
|
|
14
14
|
export declare function assertPlayableTeam(rules: EnvironmentRules | undefined, team: readonly unknown[], ...content: import('./learnsets.js').LearningLookups): void;
|
|
15
15
|
/** Check one build against prepared rules independently of team size and composition. */
|
|
16
16
|
export declare function assertEnvironmentMember(rules: EnvironmentRules, pet: unknown): void;
|
|
17
|
-
/**
|
|
17
|
+
/** Compatibility defaults for unmanaged projects with the official base package. */
|
|
18
18
|
export declare function defaultRuleDeclaration(definitions?: readonly unknown[]): {
|
|
19
19
|
schemaVersion: 2;
|
|
20
|
-
|
|
20
|
+
mechanics: {
|
|
21
|
+
individualValues: {
|
|
22
|
+
max: number;
|
|
23
|
+
};
|
|
24
|
+
inheritance: {
|
|
25
|
+
eligible: 'species';
|
|
26
|
+
};
|
|
27
|
+
secondGenerationNatures: 'species';
|
|
28
|
+
};
|
|
21
29
|
} | {
|
|
22
|
-
|
|
30
|
+
mechanics?: undefined;
|
|
23
31
|
schemaVersion: 1;
|
|
24
32
|
};
|
|
25
33
|
export declare function prepareEnvironmentRules(input: unknown, definitions?: readonly unknown[], host?: {
|
|
@@ -65,6 +73,23 @@ export declare function prepareEnvironmentRules(input: unknown, definitions?: re
|
|
|
65
73
|
max: number;
|
|
66
74
|
} | undefined;
|
|
67
75
|
allowFaintSwitch?: boolean | undefined;
|
|
76
|
+
timer?: {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
turnTimeLimit?: number | undefined;
|
|
79
|
+
totalTimeLimit?: number | undefined;
|
|
80
|
+
animationPauseEnabled?: boolean | undefined;
|
|
81
|
+
maxAnimationDuration?: number | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
teamSelection?: {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
86
|
+
minTeamSize?: number | undefined;
|
|
87
|
+
maxTeamSize?: number | undefined;
|
|
88
|
+
allowStarterSelection?: boolean | undefined;
|
|
89
|
+
showOpponentTeam?: boolean | undefined;
|
|
90
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
91
|
+
timeLimit?: number | undefined;
|
|
92
|
+
} | undefined;
|
|
68
93
|
inheritance?: {
|
|
69
94
|
eligible: "all" | "off" | "species" | string[];
|
|
70
95
|
pool?: {
|
|
@@ -123,42 +148,6 @@ export declare function prepareEnvironmentRules(input: unknown, definitions?: re
|
|
|
123
148
|
uniqueSpecies?: boolean | undefined;
|
|
124
149
|
} | undefined;
|
|
125
150
|
};
|
|
126
|
-
declarations: {
|
|
127
|
-
constraints: ({
|
|
128
|
-
id: string;
|
|
129
|
-
allOf: {
|
|
130
|
-
kind: "mark" | "skill" | "species";
|
|
131
|
-
ids: string[];
|
|
132
|
-
fromCollections?: string[] | undefined;
|
|
133
|
-
}[];
|
|
134
|
-
kind: "ban";
|
|
135
|
-
scope: "pet" | "team";
|
|
136
|
-
exceptWhen?: {
|
|
137
|
-
kind: "mark" | "skill" | "species";
|
|
138
|
-
ids: string[];
|
|
139
|
-
fromCollections?: string[] | undefined;
|
|
140
|
-
}[] | undefined;
|
|
141
|
-
exceptAny?: {
|
|
142
|
-
kind: "mark" | "skill" | "species";
|
|
143
|
-
ids: string[];
|
|
144
|
-
fromCollections?: string[] | undefined;
|
|
145
|
-
}[][] | undefined;
|
|
146
|
-
} | {
|
|
147
|
-
id: string;
|
|
148
|
-
allOf: {
|
|
149
|
-
kind: "mark" | "skill" | "species";
|
|
150
|
-
ids: string[];
|
|
151
|
-
fromCollections?: string[] | undefined;
|
|
152
|
-
}[];
|
|
153
|
-
kind: "memberLimit";
|
|
154
|
-
max: number;
|
|
155
|
-
})[];
|
|
156
|
-
collections: {
|
|
157
|
-
id: string;
|
|
158
|
-
kind: "mark" | "skill" | "species";
|
|
159
|
-
ids: string[];
|
|
160
|
-
}[];
|
|
161
|
-
};
|
|
162
151
|
fields: {
|
|
163
152
|
path: string[];
|
|
164
153
|
value: unknown;
|
|
@@ -181,6 +170,23 @@ export declare function prepareEnvironmentRules(input: unknown, definitions?: re
|
|
|
181
170
|
max: number;
|
|
182
171
|
} | undefined;
|
|
183
172
|
allowFaintSwitch?: boolean | undefined;
|
|
173
|
+
timer?: {
|
|
174
|
+
enabled: boolean;
|
|
175
|
+
turnTimeLimit?: number | undefined;
|
|
176
|
+
totalTimeLimit?: number | undefined;
|
|
177
|
+
animationPauseEnabled?: boolean | undefined;
|
|
178
|
+
maxAnimationDuration?: number | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
teamSelection?: {
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
183
|
+
minTeamSize?: number | undefined;
|
|
184
|
+
maxTeamSize?: number | undefined;
|
|
185
|
+
allowStarterSelection?: boolean | undefined;
|
|
186
|
+
showOpponentTeam?: boolean | undefined;
|
|
187
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
188
|
+
timeLimit?: number | undefined;
|
|
189
|
+
} | undefined;
|
|
184
190
|
inheritance?: {
|
|
185
191
|
eligible: "all" | "off" | "species" | string[];
|
|
186
192
|
pool?: {
|
|
@@ -319,153 +325,126 @@ export declare function prepareEnvironmentRules(input: unknown, definitions?: re
|
|
|
319
325
|
requiredCapabilities: string[];
|
|
320
326
|
};
|
|
321
327
|
export declare function validateEnvironmentRuleDeclaration(input: unknown): {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
climaxMin?: number | undefined;
|
|
329
|
-
} | undefined;
|
|
330
|
-
individualValueDefault?: number | undefined;
|
|
331
|
-
individualValues?: {
|
|
332
|
-
max: number;
|
|
333
|
-
} | undefined;
|
|
334
|
-
allowFaintSwitch?: boolean | undefined;
|
|
335
|
-
inheritance?: {
|
|
336
|
-
eligible: "all" | "off" | "species" | string[];
|
|
337
|
-
pool?: {
|
|
338
|
-
mode: "append" | "fallback" | "replace";
|
|
339
|
-
skills: string[];
|
|
340
|
-
} | undefined;
|
|
341
|
-
} | undefined;
|
|
342
|
-
enhancement?: {
|
|
343
|
-
mode: "active" | "forbidden" | "suppressed";
|
|
344
|
-
minLevel?: number | undefined;
|
|
345
|
-
defaultBranches?: string[] | undefined;
|
|
346
|
-
stages?: string[] | undefined;
|
|
347
|
-
species?: string[] | undefined;
|
|
348
|
-
} | undefined;
|
|
349
|
-
secondGenerationNatures?: "all" | "off" | "species" | string[] | undefined;
|
|
328
|
+
schemaVersion: 1 | 2;
|
|
329
|
+
mechanics?: {
|
|
330
|
+
skillSlots?: {
|
|
331
|
+
normalMax: number;
|
|
332
|
+
climaxMax: number;
|
|
333
|
+
climaxMin?: number | undefined;
|
|
350
334
|
} | undefined;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
overrides?: {
|
|
355
|
-
skill: string;
|
|
356
|
-
useId: string;
|
|
357
|
-
parameter: string;
|
|
358
|
-
value: number;
|
|
359
|
-
}[] | undefined;
|
|
335
|
+
individualValueDefault?: number | undefined;
|
|
336
|
+
individualValues?: {
|
|
337
|
+
max: number;
|
|
360
338
|
} | undefined;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
339
|
+
allowFaintSwitch?: boolean | undefined;
|
|
340
|
+
timer?: {
|
|
341
|
+
enabled: boolean;
|
|
342
|
+
turnTimeLimit?: number | undefined;
|
|
343
|
+
totalTimeLimit?: number | undefined;
|
|
344
|
+
animationPauseEnabled?: boolean | undefined;
|
|
345
|
+
maxAnimationDuration?: number | undefined;
|
|
368
346
|
} | undefined;
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
species?: string[] | undefined;
|
|
379
|
-
skills?: string[] | undefined;
|
|
380
|
-
marks?: string[] | undefined;
|
|
347
|
+
teamSelection?: {
|
|
348
|
+
enabled: boolean;
|
|
349
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
350
|
+
minTeamSize?: number | undefined;
|
|
351
|
+
maxTeamSize?: number | undefined;
|
|
352
|
+
allowStarterSelection?: boolean | undefined;
|
|
353
|
+
showOpponentTeam?: boolean | undefined;
|
|
354
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
355
|
+
timeLimit?: number | undefined;
|
|
381
356
|
} | undefined;
|
|
382
|
-
|
|
383
|
-
species
|
|
384
|
-
|
|
385
|
-
|
|
357
|
+
inheritance?: {
|
|
358
|
+
eligible: "all" | "off" | "species" | string[];
|
|
359
|
+
pool?: {
|
|
360
|
+
mode: "append" | "fallback" | "replace";
|
|
361
|
+
skills: string[];
|
|
362
|
+
} | undefined;
|
|
386
363
|
} | undefined;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
364
|
+
enhancement?: {
|
|
365
|
+
mode: "active" | "forbidden" | "suppressed";
|
|
366
|
+
minLevel?: number | undefined;
|
|
367
|
+
defaultBranches?: string[] | undefined;
|
|
368
|
+
stages?: string[] | undefined;
|
|
369
|
+
species?: string[] | undefined;
|
|
391
370
|
} | undefined;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
kind: "mark" | "skill" | "species";
|
|
403
|
-
ids: string[];
|
|
404
|
-
fromCollections?: string[] | undefined;
|
|
405
|
-
}[] | undefined;
|
|
406
|
-
exceptAny?: {
|
|
407
|
-
kind: "mark" | "skill" | "species";
|
|
408
|
-
ids: string[];
|
|
409
|
-
fromCollections?: string[] | undefined;
|
|
410
|
-
}[][] | undefined;
|
|
411
|
-
} | {
|
|
412
|
-
id: string;
|
|
413
|
-
allOf: {
|
|
414
|
-
kind: "mark" | "skill" | "species";
|
|
415
|
-
ids: string[];
|
|
416
|
-
fromCollections?: string[] | undefined;
|
|
417
|
-
}[];
|
|
418
|
-
kind: "memberLimit";
|
|
419
|
-
max: number;
|
|
420
|
-
})[] | undefined;
|
|
421
|
-
};
|
|
422
|
-
include: string[];
|
|
423
|
-
edits: {
|
|
424
|
-
remove?: string[] | undefined;
|
|
425
|
-
replace?: ({
|
|
426
|
-
id: string;
|
|
427
|
-
allOf: {
|
|
428
|
-
kind: "mark" | "skill" | "species";
|
|
429
|
-
ids: string[];
|
|
430
|
-
fromCollections?: string[] | undefined;
|
|
431
|
-
}[];
|
|
432
|
-
kind: "ban";
|
|
433
|
-
scope: "pet" | "team";
|
|
434
|
-
exceptWhen?: {
|
|
435
|
-
kind: "mark" | "skill" | "species";
|
|
436
|
-
ids: string[];
|
|
437
|
-
fromCollections?: string[] | undefined;
|
|
438
|
-
}[] | undefined;
|
|
439
|
-
exceptAny?: {
|
|
440
|
-
kind: "mark" | "skill" | "species";
|
|
441
|
-
ids: string[];
|
|
442
|
-
fromCollections?: string[] | undefined;
|
|
443
|
-
}[][] | undefined;
|
|
444
|
-
} | {
|
|
445
|
-
id: string;
|
|
446
|
-
allOf: {
|
|
447
|
-
kind: "mark" | "skill" | "species";
|
|
448
|
-
ids: string[];
|
|
449
|
-
fromCollections?: string[] | undefined;
|
|
450
|
-
}[];
|
|
451
|
-
kind: "memberLimit";
|
|
452
|
-
max: number;
|
|
453
|
-
})[] | undefined;
|
|
454
|
-
clearExceptions?: string[] | undefined;
|
|
455
|
-
exceptions?: {
|
|
456
|
-
target: string;
|
|
457
|
-
allOf: {
|
|
458
|
-
kind: "mark" | "skill" | "species";
|
|
459
|
-
ids: string[];
|
|
460
|
-
fromCollections?: string[] | undefined;
|
|
461
|
-
}[];
|
|
371
|
+
secondGenerationNatures?: "all" | "off" | "species" | string[] | undefined;
|
|
372
|
+
} | undefined;
|
|
373
|
+
skillParameters?: {
|
|
374
|
+
profile?: string | undefined;
|
|
375
|
+
groups?: Record<string, number> | undefined;
|
|
376
|
+
overrides?: {
|
|
377
|
+
skill: string;
|
|
378
|
+
useId: string;
|
|
379
|
+
parameter: string;
|
|
380
|
+
value: number;
|
|
462
381
|
}[] | undefined;
|
|
463
|
-
};
|
|
464
|
-
|
|
382
|
+
} | undefined;
|
|
383
|
+
matchups?: {
|
|
384
|
+
table?: string | undefined;
|
|
385
|
+
adjustments?: {
|
|
386
|
+
attack: string;
|
|
387
|
+
defense: string;
|
|
388
|
+
multiplier: number;
|
|
389
|
+
}[] | undefined;
|
|
390
|
+
} | undefined;
|
|
391
|
+
learnsetAdjustments?: {
|
|
392
|
+
species: string;
|
|
393
|
+
source: "inherited" | "normal";
|
|
394
|
+
skill: string;
|
|
395
|
+
action: "add" | "remove";
|
|
396
|
+
level?: number | undefined;
|
|
397
|
+
}[] | undefined;
|
|
398
|
+
tier?: "standard" | undefined;
|
|
399
|
+
allow?: {
|
|
400
|
+
species?: string[] | undefined;
|
|
401
|
+
skills?: string[] | undefined;
|
|
402
|
+
marks?: string[] | undefined;
|
|
403
|
+
} | undefined;
|
|
404
|
+
deny?: {
|
|
405
|
+
species?: string[] | undefined;
|
|
406
|
+
skills?: string[] | undefined;
|
|
407
|
+
marks?: string[] | undefined;
|
|
408
|
+
} | undefined;
|
|
409
|
+
team?: {
|
|
410
|
+
minSize?: number | undefined;
|
|
411
|
+
maxSize?: number | undefined;
|
|
412
|
+
uniqueSpecies?: boolean | undefined;
|
|
413
|
+
} | undefined;
|
|
414
|
+
constraints?: ({
|
|
415
|
+
id: string;
|
|
416
|
+
allOf: {
|
|
417
|
+
kind: "mark" | "skill" | "species";
|
|
418
|
+
ids: string[];
|
|
419
|
+
fromCollections?: string[] | undefined;
|
|
420
|
+
}[];
|
|
421
|
+
kind: "ban";
|
|
422
|
+
scope: "pet" | "team";
|
|
423
|
+
exceptWhen?: {
|
|
424
|
+
kind: "mark" | "skill" | "species";
|
|
425
|
+
ids: string[];
|
|
426
|
+
fromCollections?: string[] | undefined;
|
|
427
|
+
}[] | undefined;
|
|
428
|
+
exceptAny?: {
|
|
429
|
+
kind: "mark" | "skill" | "species";
|
|
430
|
+
ids: string[];
|
|
431
|
+
fromCollections?: string[] | undefined;
|
|
432
|
+
}[][] | undefined;
|
|
433
|
+
} | {
|
|
434
|
+
id: string;
|
|
435
|
+
allOf: {
|
|
436
|
+
kind: "mark" | "skill" | "species";
|
|
437
|
+
ids: string[];
|
|
438
|
+
fromCollections?: string[] | undefined;
|
|
439
|
+
}[];
|
|
440
|
+
kind: "memberLimit";
|
|
441
|
+
max: number;
|
|
442
|
+
})[] | undefined;
|
|
443
|
+
collections?: {
|
|
465
444
|
id: string;
|
|
466
445
|
kind: "mark" | "skill" | "species";
|
|
467
446
|
ids: string[];
|
|
468
|
-
}[];
|
|
447
|
+
}[] | undefined;
|
|
469
448
|
};
|
|
470
449
|
/** Validate selectors once against the catalog held by this preparation. */
|
|
471
450
|
export declare function assertRuleContentReferences(rules: EnvironmentRules, catalog: {
|
|
@@ -517,6 +496,23 @@ export declare function prepareRulesForContent(declaration: unknown, data: Conte
|
|
|
517
496
|
max: number;
|
|
518
497
|
} | undefined;
|
|
519
498
|
allowFaintSwitch?: boolean | undefined;
|
|
499
|
+
timer?: {
|
|
500
|
+
enabled: boolean;
|
|
501
|
+
turnTimeLimit?: number | undefined;
|
|
502
|
+
totalTimeLimit?: number | undefined;
|
|
503
|
+
animationPauseEnabled?: boolean | undefined;
|
|
504
|
+
maxAnimationDuration?: number | undefined;
|
|
505
|
+
} | undefined;
|
|
506
|
+
teamSelection?: {
|
|
507
|
+
enabled: boolean;
|
|
508
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
509
|
+
minTeamSize?: number | undefined;
|
|
510
|
+
maxTeamSize?: number | undefined;
|
|
511
|
+
allowStarterSelection?: boolean | undefined;
|
|
512
|
+
showOpponentTeam?: boolean | undefined;
|
|
513
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
514
|
+
timeLimit?: number | undefined;
|
|
515
|
+
} | undefined;
|
|
520
516
|
inheritance?: {
|
|
521
517
|
eligible: "all" | "off" | "species" | string[];
|
|
522
518
|
pool?: {
|
|
@@ -597,6 +593,23 @@ export declare function prepareRulesForContent(declaration: unknown, data: Conte
|
|
|
597
593
|
max: number;
|
|
598
594
|
} | undefined;
|
|
599
595
|
allowFaintSwitch?: boolean | undefined;
|
|
596
|
+
timer?: {
|
|
597
|
+
enabled: boolean;
|
|
598
|
+
turnTimeLimit?: number | undefined;
|
|
599
|
+
totalTimeLimit?: number | undefined;
|
|
600
|
+
animationPauseEnabled?: boolean | undefined;
|
|
601
|
+
maxAnimationDuration?: number | undefined;
|
|
602
|
+
} | undefined;
|
|
603
|
+
teamSelection?: {
|
|
604
|
+
enabled: boolean;
|
|
605
|
+
mode?: "FULL_TEAM" | "TEAM_SELECTION" | "VIEW_ONLY" | undefined;
|
|
606
|
+
minTeamSize?: number | undefined;
|
|
607
|
+
maxTeamSize?: number | undefined;
|
|
608
|
+
allowStarterSelection?: boolean | undefined;
|
|
609
|
+
showOpponentTeam?: boolean | undefined;
|
|
610
|
+
teamInfoVisibility?: "BASIC" | "FULL" | "HIDDEN" | undefined;
|
|
611
|
+
timeLimit?: number | undefined;
|
|
612
|
+
} | undefined;
|
|
600
613
|
inheritance?: {
|
|
601
614
|
eligible: "all" | "off" | "species" | string[];
|
|
602
615
|
pool?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { RuleCompositionError, resolveEnvironmentMechanics } from '@arcadia-eternity/const';
|
|
2
2
|
import { readSkillParameterCatalog, resolveSkillParameters, requireElementChart } from '@arcadia-eternity/const';
|
|
3
|
-
import {
|
|
4
|
-
import { allowsEnhancementRecord,
|
|
3
|
+
import { resolveDeclaredRules } from './rule-composition.js';
|
|
4
|
+
import { allowsEnhancementRecord, IndependentEnvironmentRulesSchema, readEnvironmentRuleSets, resolveEnvironmentMechanics, resolveEnvironmentTeam, validateConstraintReferences, EnvironmentRulesSchema, parseRuleData, EnvironmentRequirementsSchema, teamConstraintIssues, } from '@arcadia-eternity/const';
|
|
5
5
|
import { assertLearningChoices, validateLearningReferences } from './learnsets.js';
|
|
6
6
|
export { resolveLearnset, learningIssues, isEligible, assertNatureChoice, validateLearningReferences, assertLearningChoices, } from './learnsets.js';
|
|
7
7
|
import { isRecord } from './types.js';
|
|
@@ -14,14 +14,17 @@ const identifier = (value) => typeof value === 'string' && value.length > 0 && v
|
|
|
14
14
|
function validateRuleFields(input) {
|
|
15
15
|
return parseRuleData(EnvironmentRulesSchema, input);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function checkEffectiveRules(rules) {
|
|
18
18
|
const { max, defaultValue } = resolveEnvironmentMechanics(rules).individualValues;
|
|
19
|
+
const team = resolveEnvironmentTeam(rules);
|
|
20
|
+
if (team.minSize > team.maxSize)
|
|
21
|
+
fail('ENVIRONMENT_TEAM_SELECTION_EXCEEDS_ROSTER');
|
|
19
22
|
if (defaultValue > max)
|
|
20
23
|
fail('ENVIRONMENT_IV_DEFAULT_EXCEEDS_MAX');
|
|
21
24
|
return rules;
|
|
22
25
|
}
|
|
23
26
|
export function validateEnvironmentRules(input) {
|
|
24
|
-
return
|
|
27
|
+
return checkEffectiveRules(validateRuleFields(input));
|
|
25
28
|
}
|
|
26
29
|
const capabilityFields = {
|
|
27
30
|
'team.constraints.v1': (rules) => rules.constraints?.length,
|
|
@@ -31,6 +34,8 @@ const capabilityFields = {
|
|
|
31
34
|
'training.enhancement.v1': (rules) => rules.mechanics?.enhancement,
|
|
32
35
|
'battle.skill-parameters.v1': (rules) => rules.skillParameters,
|
|
33
36
|
'battle.type-chart.v1': (rules) => rules.matchups,
|
|
37
|
+
'battle.timer.v1': (rules) => rules.mechanics?.timer,
|
|
38
|
+
'battle.team-selection.v1': (rules) => rules.mechanics?.teamSelection,
|
|
34
39
|
'battle.faint-switch.v1': (rules) => rules.mechanics?.allowFaintSwitch !== undefined,
|
|
35
40
|
};
|
|
36
41
|
export const environmentCapabilities = Object.freeze(['rules.composition.v1', ...Object.keys(capabilityFields)]);
|
|
@@ -123,26 +128,33 @@ export function assertEnvironmentMember(rules, pet) {
|
|
|
123
128
|
fail('ENVIRONMENT_TEAM_REJECTED');
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
|
-
/**
|
|
131
|
+
/** Compatibility defaults for unmanaged projects with the official base package. */
|
|
127
132
|
export function defaultRuleDeclaration(definitions = []) {
|
|
128
133
|
return definitions.some(row => isRecord(row) && row.id === 'base:classic')
|
|
129
|
-
? {
|
|
134
|
+
? {
|
|
135
|
+
schemaVersion: 2,
|
|
136
|
+
mechanics: {
|
|
137
|
+
individualValues: { max: 31 },
|
|
138
|
+
inheritance: { eligible: 'species' },
|
|
139
|
+
secondGenerationNatures: 'species',
|
|
140
|
+
},
|
|
141
|
+
}
|
|
130
142
|
: { schemaVersion: 1 };
|
|
131
143
|
}
|
|
132
144
|
export function prepareEnvironmentRules(input, definitions = [], host = currentHost) {
|
|
133
145
|
const declaration = input === undefined ? defaultRuleDeclaration(definitions) : input;
|
|
134
|
-
const prepared =
|
|
135
|
-
|
|
146
|
+
const prepared = resolveDeclaredRules(validateEnvironmentRuleDeclaration(declaration));
|
|
147
|
+
checkEffectiveRules(prepared.rules);
|
|
136
148
|
const requiredCapabilities = Object.entries(capabilityFields)
|
|
137
149
|
.filter(([, used]) => used(prepared.rules))
|
|
138
150
|
.map(([key]) => key);
|
|
139
|
-
if (isRecord(declaration) &&
|
|
151
|
+
if (isRecord(declaration) && 'collections' in declaration)
|
|
140
152
|
requiredCapabilities.unshift('rules.composition.v1');
|
|
141
153
|
assertEnvironmentRequirements({ capabilities: requiredCapabilities }, host);
|
|
142
|
-
return { ...prepared, requiredCapabilities };
|
|
154
|
+
return { ...prepared, ruleSets: readEnvironmentRuleSets(definitions), requiredCapabilities };
|
|
143
155
|
}
|
|
144
156
|
export function validateEnvironmentRuleDeclaration(input) {
|
|
145
|
-
return
|
|
157
|
+
return parseRuleData(IndependentEnvironmentRulesSchema, input);
|
|
146
158
|
}
|
|
147
159
|
/** Validate selectors once against the catalog held by this preparation. */
|
|
148
160
|
export function assertRuleContentReferences(rules, catalog, fields = []) {
|