@optolith/entity-descriptions 0.10.0 → 0.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/CHANGELOG.md +20 -0
- package/lib/entities/activatable.d.ts +2 -1
- package/lib/entities/activatable.js +34 -13
- package/lib/entities/disease.js +3 -0
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/partial/prerequisites/displayOption.d.ts +5 -0
- package/lib/entities/partial/prerequisites/displayOption.js +18 -0
- package/lib/entities/partial/prerequisites/index.d.ts +3 -3
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +2 -2
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +10 -0
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.js +17 -0
- package/lib/entities/partial/prerequisites/single/tinyActivatable.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/tinyActivatable.js +16 -0
- package/lib/entities/partial/rated/activatable/targetCategory.js +2 -5
- package/lib/entities/poison.d.ts +1 -1
- package/lib/index.d.ts +58 -58
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.11.1](https://github.com/Optolith/entity-descriptions/compare/v0.11.0...v0.11.1) (2026-09-13)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* attributed target category ([8411c00](https://github.com/Optolith/entity-descriptions/commit/8411c00eb0ac8df5f4335a41db951578cbaffe26))
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* advanced special ability sorting ([fd8ec9c](https://github.com/Optolith/entity-descriptions/commit/fd8ec9cf41625bc67f243850045f2bdf358bae5b)), closes [#50](https://github.com/Optolith/entity-descriptions/issues/50)
|
|
14
|
+
* advanced special ability sorting (other parts) ([75ccc67](https://github.com/Optolith/entity-descriptions/commit/75ccc671ad4a60116067a0b5df143d0b1c1cc3f9))
|
|
15
|
+
* display additional name ([460385e](https://github.com/Optolith/entity-descriptions/commit/460385ee19ea7be58766fb46859256514c75208f))
|
|
16
|
+
## [0.11.0](https://github.com/Optolith/entity-descriptions/compare/v0.10.0...v0.11.0) (2026-09-13)
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* **deps:** upgrade to schema 0.61.0
|
|
21
|
+
|
|
22
|
+
### build
|
|
23
|
+
|
|
24
|
+
* **deps:** upgrade to schema 0.61.0 ([3883580](https://github.com/Optolith/entity-descriptions/commit/38835809b80d2937d33678bb1643da8f2ab9a200))
|
|
5
25
|
## [0.10.0](https://github.com/Optolith/entity-descriptions/compare/v0.9.2...v0.10.0) (2026-09-12)
|
|
6
26
|
|
|
7
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -34,6 +34,7 @@ export type BaseActivatable = {
|
|
|
34
34
|
*/
|
|
35
35
|
export type BaseActivatableTranslation = {
|
|
36
36
|
name: string;
|
|
37
|
+
additionalName?: string;
|
|
37
38
|
name_in_library?: string;
|
|
38
39
|
rules?: string;
|
|
39
40
|
range?: string;
|
|
@@ -49,7 +50,7 @@ export type BaseActivatableTranslation = {
|
|
|
49
50
|
* Get a JSON representation of the rules text for a special ability.
|
|
50
51
|
*/
|
|
51
52
|
export declare const getActivatableEntityDescription: import("../creator.js").EntityDescriptionCreator<"Advantage" | "Disadvantage" | "AdvancedCombatSpecialAbility" | "AdvancedKarmaSpecialAbility" | "AdvancedMagicalSpecialAbility" | "AdvancedSkillSpecialAbility" | "AncestorGlyph" | "ArcaneOrbEnchantment" | "AttireEnchantment" | "Beutelzauber" | "BlessedTradition" | "BowlEnchantment" | "BrawlingSpecialAbility" | "CauldronEnchantment" | "CeremonialItemSpecialAbility" | "ChronicleEnchantment" | "CombatSpecialAbility" | "CombatStyleSpecialAbility" | "CommandSpecialAbility" | "DaggerRitual" | "FamiliarSpecialAbility" | "FatePointSexSpecialAbility" | "FatePointSpecialAbility" | "FoolsHatEnchantment" | "GeneralSpecialAbility" | "Haubenzauber" | "Hauerkettenzauber" | "InstrumentEnchantment" | "KarmaSpecialAbility" | "Keulenzauber" | "Krallenkettenzauber" | "Kristallkugelzauber" | "LiturgicalStyleSpecialAbility" | "LycantropicGift" | "MagicalSign" | "MagicalSpecialAbility" | "MagicalTradition" | "MagicStyleSpecialAbility" | "OrbEnchantment" | "PactGift" | "ProtectiveWardingCircleSpecialAbility" | "RingEnchantment" | "Schweinetrommelzauber" | "Sermon" | "SexSpecialAbility" | "SickleRitual" | "SikaryanDrainSpecialAbility" | "SkillStyleSpecialAbility" | "SpellSwordEnchantment" | "StaffEnchantment" | "ToyEnchantment" | "Trinkhornzauber" | "VampiricGift" | "Vision" | "WandEnchantment" | "WeaponEnchantment", {
|
|
52
|
-
getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon" | "Patron" | "PersonalityTrait" | "Blessing" | "
|
|
53
|
+
getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon" | "Patron" | "PersonalityTrait" | "Brew" | "Blessing" | "Cantrip">;
|
|
53
54
|
getAllInstances: GetAllInstances<"Script">;
|
|
54
55
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
55
56
|
getAllResolvedSelectOptions: GetAllResolvedSelectOptions;
|
|
@@ -4,6 +4,7 @@ import { count } from "@elyukai/utils/array/reductions";
|
|
|
4
4
|
import { deepEqual } from "@elyukai/utils/equality";
|
|
5
5
|
import { constant, on } from "@elyukai/utils/function";
|
|
6
6
|
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
7
|
+
import { reduceCompare } from "@elyukai/utils/ordering";
|
|
7
8
|
import { Reader } from "@elyukai/utils/reader";
|
|
8
9
|
import { numAsc } from "@optolith/helpers/compare";
|
|
9
10
|
import { sign } from "@optolith/helpers/math";
|
|
@@ -546,7 +547,7 @@ const renderAdvancedSpecialAbilityName = (translate, translateMap, getInstanceBy
|
|
|
546
547
|
const normalizedId = normalizeId(entityName, id);
|
|
547
548
|
return `^[${mapNullable(printActivatableName(getInstanceById, translate, normalizedId, option, undefined, getResolvedSelectOptionById, false), name => renderActivatableNameComponents(translateMap, name, false)) ?? MISSING_VALUE}](entity: "${normalizedId.kind}", instance: "${fromUniformCase(normalizedId)}", style: "normal")`;
|
|
548
549
|
};
|
|
549
|
-
const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceById, getResolvedSelectOptionById, entityName, advanced) => {
|
|
550
|
+
const renderAdvancedValue = (translate, translateMap, localeJoin, localeCompare, getInstanceById, getResolvedSelectOptionById, entityName, advanced) => {
|
|
550
551
|
if (advanced.every(entry => entry.kind === "OneOf") &&
|
|
551
552
|
isNotEmpty(advanced) &&
|
|
552
553
|
advanced.every(entry => entry.OneOf.options.length === 3)) {
|
|
@@ -558,7 +559,9 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
558
559
|
if (uniqueOptions.length === advanced.length) {
|
|
559
560
|
const [first, second] = optionsInAllEntries.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option));
|
|
560
561
|
return [
|
|
561
|
-
...uniqueOptions
|
|
562
|
+
...uniqueOptions
|
|
563
|
+
.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option))
|
|
564
|
+
.toSorted(localeCompare),
|
|
562
565
|
translate("one or two of these special abilities can alternatively be replaced by advanced special abilities {$first} and/or {$second}", { first, second }),
|
|
563
566
|
].join(", ");
|
|
564
567
|
}
|
|
@@ -568,25 +571,38 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
568
571
|
entry.DeriveFromExternalOption.display_option === undefined);
|
|
569
572
|
const anyEntriesToGenerate = count(advanced, entry => entry.kind === "Any");
|
|
570
573
|
const arr = [
|
|
571
|
-
...advanced
|
|
574
|
+
...advanced
|
|
575
|
+
.map((entry) => {
|
|
572
576
|
switch (entry.kind) {
|
|
573
577
|
case "General":
|
|
574
|
-
return
|
|
578
|
+
return [
|
|
579
|
+
"general",
|
|
580
|
+
renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, entry.General),
|
|
581
|
+
];
|
|
575
582
|
case "RestrictOptions":
|
|
576
|
-
return
|
|
583
|
+
return [
|
|
584
|
+
"general",
|
|
585
|
+
renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, entry.RestrictOptions.id, entry.RestrictOptions.option),
|
|
586
|
+
];
|
|
577
587
|
case "OneOf": {
|
|
578
588
|
if (entry.OneOf.display_option !== undefined) {
|
|
579
589
|
switch (entry.OneOf.display_option.kind) {
|
|
580
590
|
case "Hide":
|
|
581
591
|
return undefined;
|
|
582
592
|
case "ReplaceWith":
|
|
583
|
-
return
|
|
584
|
-
|
|
593
|
+
return [
|
|
594
|
+
"special",
|
|
595
|
+
translateMap(entry.OneOf.display_option.ReplaceWith.translations)
|
|
596
|
+
?.replacement ?? MISSING_VALUE,
|
|
597
|
+
];
|
|
585
598
|
default:
|
|
586
599
|
return assertExhaustive(entry.OneOf.display_option);
|
|
587
600
|
}
|
|
588
601
|
}
|
|
589
|
-
return
|
|
602
|
+
return [
|
|
603
|
+
"general",
|
|
604
|
+
localeJoin(entry.OneOf.options.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option)), "disjunction"),
|
|
605
|
+
];
|
|
590
606
|
}
|
|
591
607
|
case "DeriveFromExternalOption":
|
|
592
608
|
if (entry.DeriveFromExternalOption.display_option !== undefined) {
|
|
@@ -594,7 +610,10 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
594
610
|
case "Hide":
|
|
595
611
|
return undefined;
|
|
596
612
|
case "ReplaceWith":
|
|
597
|
-
return
|
|
613
|
+
return [
|
|
614
|
+
"special",
|
|
615
|
+
translateMap(entry.DeriveFromExternalOption.display_option.ReplaceWith.translations)?.replacement ?? MISSING_VALUE,
|
|
616
|
+
];
|
|
598
617
|
default:
|
|
599
618
|
return assertExhaustive(entry.DeriveFromExternalOption.display_option);
|
|
600
619
|
}
|
|
@@ -605,7 +624,10 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
605
624
|
default:
|
|
606
625
|
return assertExhaustive(entry);
|
|
607
626
|
}
|
|
608
|
-
})
|
|
627
|
+
})
|
|
628
|
+
.filter((item) => isNotNullish(item) && item[1] !== undefined)
|
|
629
|
+
.toSorted(reduceCompare(on(([type]) => type, localeCompare), on(([, value]) => value, localeCompare)))
|
|
630
|
+
.map(value => value[1]),
|
|
609
631
|
derivedFromExternalOptionEntriesToGenerate === 0
|
|
610
632
|
? undefined
|
|
611
633
|
: translate(".input {$count :number} {{{$count} more by primary patron}}", {
|
|
@@ -782,8 +804,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
782
804
|
? name => translate("Tradition ({$tradition})", { tradition: name })
|
|
783
805
|
: name => name;
|
|
784
806
|
return {
|
|
785
|
-
title: makeTraditionName(translation.name_in_library ?? translation.name) +
|
|
786
|
-
(baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
|
|
807
|
+
title: makeTraditionName(translation.name_in_library ?? translation.name + parensIf(translation.additionalName)) + (baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
|
|
787
808
|
subtitle: mapNullable(baseEntry.subtype, subtype => renderAdvantageDisadvantageSubtype(subtype).run(env)) ??
|
|
788
809
|
mapNullable(baseEntry.usage_type, usageType => renderCombatSpecialAbilityType(usageType).run(env)),
|
|
789
810
|
badge: mapNullable(entityName === "CombatStyleSpecialAbility" || entityName === "AdvancedCombatSpecialAbility"
|
|
@@ -839,7 +860,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
839
860
|
mapNullable(baseEntry.advanced, advanced => isStyleSpecialAbilityKind(entityName)
|
|
840
861
|
? {
|
|
841
862
|
label: renderAdvancedLabel(translate, entityName),
|
|
842
|
-
value: renderAdvancedValue(translate, translateMap, locale.join, getInstanceById, getResolvedSelectOptionById, entityName, advanced),
|
|
863
|
+
value: renderAdvancedValue(translate, translateMap, locale.join, locale.compare, getInstanceById, getResolvedSelectOptionById, entityName, advanced),
|
|
843
864
|
}
|
|
844
865
|
: undefined),
|
|
845
866
|
mapNullable(baseEntry.penalty, penalty => ({
|
package/lib/entities/disease.js
CHANGED
|
@@ -29,6 +29,9 @@ export const getDiseaseEntityDescription = createEntityDescriptionCreator(({ get
|
|
|
29
29
|
parensIf(ensureNonEmpty([
|
|
30
30
|
baseEntry.isChildhoodDisease === true ? translate("childhood disease") : undefined,
|
|
31
31
|
baseEntry.isMagicalDisease === true ? translate("magical disease") : undefined,
|
|
32
|
+
baseEntry.isSexuallyTransmittableDisease === true
|
|
33
|
+
? translate("sexually transmittable disease")
|
|
34
|
+
: undefined,
|
|
32
35
|
].filter(isNotNullish))?.join(", ")),
|
|
33
36
|
className: "disease",
|
|
34
37
|
body: [
|
package/lib/entities/elixir.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single
|
|
|
5
5
|
* Get a JSON representation of the rules text for an elixir.
|
|
6
6
|
*/
|
|
7
7
|
export declare const getElixirEntityDescription: import("../creator.js").EntityDescriptionCreator<"Elixir", {
|
|
8
|
-
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait">;
|
|
8
|
+
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait" | "Blessing" | "Cantrip">;
|
|
9
9
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
10
10
|
}, import("../index.js").EntityDescription>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { DisplayOption } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { TranslateMap } from "../../../helpers/translate.js";
|
|
3
|
+
import type { StdReader } from "../reader.js";
|
|
3
4
|
import type { PrerequisitePart } from "./part.js";
|
|
4
5
|
/**
|
|
5
6
|
* Get the translation of a display option.
|
|
6
7
|
*/
|
|
7
8
|
export declare const printDisplayOption: (translateMap: TranslateMap, displayOption: DisplayOption) => PrerequisitePart | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Get the translation of a display option.
|
|
11
|
+
*/
|
|
12
|
+
export declare const printDisplayOptionR: (displayOption: DisplayOption) => StdReader<PrerequisitePart | undefined, "tm">;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
1
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
2
3
|
import { MISSING_VALUE } from "../unknown.js";
|
|
3
4
|
/**
|
|
@@ -17,3 +18,20 @@ export const printDisplayOption = (translateMap, displayOption) => {
|
|
|
17
18
|
return assertExhaustive(displayOption);
|
|
18
19
|
}
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Get the translation of a display option.
|
|
23
|
+
*/
|
|
24
|
+
export const printDisplayOptionR = (displayOption) => {
|
|
25
|
+
switch (displayOption.kind) {
|
|
26
|
+
case "Hide":
|
|
27
|
+
return Reader.of(undefined);
|
|
28
|
+
case "ReplaceWith":
|
|
29
|
+
return Reader.asks(({ translateMap }) => ({
|
|
30
|
+
value: translateMap(displayOption.ReplaceWith.translations)?.replacement ?? MISSING_VALUE,
|
|
31
|
+
sentenceType: displayOption.ReplaceWith.sentence_type,
|
|
32
|
+
isMeta: false,
|
|
33
|
+
}));
|
|
34
|
+
default:
|
|
35
|
+
return assertExhaustive(displayOption);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -13,11 +13,11 @@ export declare const printPublicationPrerequisites: (getInstanceById: GetInstanc
|
|
|
13
13
|
/**
|
|
14
14
|
* Print plain general prerequisites as a string.
|
|
15
15
|
*/
|
|
16
|
-
export declare const printPlainGeneralPrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: PlainGeneralPrerequisites) => string;
|
|
16
|
+
export declare const printPlainGeneralPrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait" | "Blessing" | "Cantrip">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: PlainGeneralPrerequisites) => string;
|
|
17
17
|
/**
|
|
18
18
|
* Print general prerequisites as a string.
|
|
19
19
|
*/
|
|
20
|
-
export declare const printGeneralPrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: GeneralPrerequisites, printPreviousLevelPrerequisites?: {
|
|
20
|
+
export declare const printGeneralPrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait" | "Blessing" | "Cantrip">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: GeneralPrerequisites, printPreviousLevelPrerequisites?: {
|
|
21
21
|
id: ActivatableIdentifier;
|
|
22
22
|
levels: number;
|
|
23
23
|
}, trailingText?: string) => string;
|
|
@@ -28,7 +28,7 @@ export declare const printProfessionPrerequisites: (getInstanceById: GetInstance
|
|
|
28
28
|
/**
|
|
29
29
|
* Print advantage disadvantage prerequisites as a string.
|
|
30
30
|
*/
|
|
31
|
-
export declare const printAdvantageDisadvantagePrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: AdvantageDisadvantagePrerequisites, name: string, type: "Advantage" | "Disadvantage") => string;
|
|
31
|
+
export declare const printAdvantageDisadvantagePrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait" | "Blessing" | "Cantrip">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: AdvantageDisadvantagePrerequisites, name: string, type: "Advantage" | "Disadvantage") => string;
|
|
32
32
|
/**
|
|
33
33
|
* Print arcane tradition prerequisites as a string.
|
|
34
34
|
*/
|
|
@@ -14,7 +14,7 @@ export declare const printPublicationPrerequisiteGroup: (getInstanceById: GetIns
|
|
|
14
14
|
/**
|
|
15
15
|
* Print the translation of a general prerequisite group.
|
|
16
16
|
*/
|
|
17
|
-
export declare const printGeneralPrerequisiteGroup: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: GeneralPrerequisiteGroup) => PrerequisitePart | undefined;
|
|
17
|
+
export declare const printGeneralPrerequisiteGroup: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait" | "Blessing" | "Cantrip">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: GeneralPrerequisiteGroup) => PrerequisitePart | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* Print the translation of a profession prerequisite group.
|
|
20
20
|
*/
|
|
@@ -22,7 +22,7 @@ export declare const printProfessionPrerequisiteGroup: (getInstanceById: GetInst
|
|
|
22
22
|
/**
|
|
23
23
|
* Print the translation of an advantage/disadvantage prerequisite group.
|
|
24
24
|
*/
|
|
25
|
-
export declare const printAdvantageDisadvantagePrerequisiteGroup: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: AdvantageDisadvantagePrerequisiteGroup, name: string, type: "Advantage" | "Disadvantage") => PrerequisitePart | undefined;
|
|
25
|
+
export declare const printAdvantageDisadvantagePrerequisiteGroup: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement" | "PersonalityTrait" | "Blessing" | "Cantrip">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: AdvantageDisadvantagePrerequisiteGroup, name: string, type: "Advantage" | "Disadvantage") => PrerequisitePart | undefined;
|
|
26
26
|
/**
|
|
27
27
|
* Print the translation of an arcane tradition prerequisite group.
|
|
28
28
|
*/
|
|
@@ -23,6 +23,7 @@ import { printSexualCharacteristicPrerequisite } from "./single/sexualCharacteri
|
|
|
23
23
|
import { printSocialStatusPrerequisite } from "./single/socialStatus.js";
|
|
24
24
|
import { printStatePrerequisite } from "./single/state.js";
|
|
25
25
|
import { printTextPrerequisite } from "./single/text.js";
|
|
26
|
+
import { printTinyActivatablePrerequisite } from "./single/tinyActivatable.js";
|
|
26
27
|
/**
|
|
27
28
|
* Print the translation of a derived characteristic prerequisite group.
|
|
28
29
|
*/
|
|
@@ -75,6 +76,13 @@ export const printGeneralPrerequisiteGroup = (getInstanceById, getResolvedSelect
|
|
|
75
76
|
return printBlessedTraditionPrerequisite(locale, prerequisite.BlessedTradition);
|
|
76
77
|
case "MagicalTradition":
|
|
77
78
|
return printMagicalTraditionPrerequisite(locale, prerequisite.MagicalTradition);
|
|
79
|
+
case "TinyActivatable":
|
|
80
|
+
return printTinyActivatablePrerequisite(prerequisite.TinyActivatable).run({
|
|
81
|
+
getInstanceById,
|
|
82
|
+
translateMap: locale.translateMap,
|
|
83
|
+
});
|
|
84
|
+
case "AnySpecialAbilityOfGroup":
|
|
85
|
+
return printMagicalTraditionPrerequisite(locale, prerequisite.AnySpecialAbilityOfGroup);
|
|
78
86
|
case "Rated":
|
|
79
87
|
return printRatedPrerequisite(getInstanceById, locale, prerequisite.Rated);
|
|
80
88
|
case "RatedMinimumNumber":
|
|
@@ -135,6 +143,8 @@ export const printAdvantageDisadvantagePrerequisiteGroup = (getInstanceById, get
|
|
|
135
143
|
case "Activatable":
|
|
136
144
|
case "BlessedTradition":
|
|
137
145
|
case "MagicalTradition":
|
|
146
|
+
case "AnySpecialAbilityOfGroup":
|
|
147
|
+
case "TinyActivatable":
|
|
138
148
|
case "Rated":
|
|
139
149
|
case "RatedMinimumNumber":
|
|
140
150
|
case "RatedSum":
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnySpecialAbilityOfGroupPrerequisite } from "@optolith/database-schema/gen";
|
|
2
|
+
import { type StdReader } from "../../reader.js";
|
|
3
|
+
import type { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printAnySpecialAbilityOfGroupPrerequisite: (prerequisite: AnySpecialAbilityOfGroupPrerequisite) => StdReader<PrerequisitePart | undefined, "t" | "tm">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { translateR } from "../../reader.js";
|
|
2
|
+
import { printDisplayOptionR } from "../displayOption.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the translation of a tiny activatable prerequisite.
|
|
5
|
+
*/
|
|
6
|
+
export const printAnySpecialAbilityOfGroupPrerequisite = (prerequisite) => {
|
|
7
|
+
if (prerequisite.display_option !== undefined) {
|
|
8
|
+
return printDisplayOptionR(prerequisite.display_option);
|
|
9
|
+
}
|
|
10
|
+
return translateR(".input {$entity :string} {{a special ability}}", {
|
|
11
|
+
entity: prerequisite.group.kind,
|
|
12
|
+
}).map(name => ({
|
|
13
|
+
value: name,
|
|
14
|
+
sentenceType: undefined,
|
|
15
|
+
isMeta: false,
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TinyActivatablePrerequisite } from "@optolith/database-schema/gen";
|
|
2
|
+
import { type StdReader } from "../../reader.js";
|
|
3
|
+
import type { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printTinyActivatablePrerequisite: (prerequisite: TinyActivatablePrerequisite) => StdReader<PrerequisitePart | undefined, "tm" | "ibi", "Blessing" | "Cantrip">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { attributedCustomNameR } from "../../reader.js";
|
|
2
|
+
import { MISSING_VALUE } from "../../unknown.js";
|
|
3
|
+
import { printDisplayOptionR } from "../displayOption.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export const printTinyActivatablePrerequisite = (prerequisite) => {
|
|
8
|
+
if (prerequisite.display_option !== undefined) {
|
|
9
|
+
return printDisplayOptionR(prerequisite.display_option);
|
|
10
|
+
}
|
|
11
|
+
return attributedCustomNameR("prerequisite", (t) => t.abbreviation ?? t.name, prerequisite.id).map(name => ({
|
|
12
|
+
value: name ?? MISSING_VALUE,
|
|
13
|
+
sentenceType: undefined,
|
|
14
|
+
isMeta: false,
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
-
import { mapNullable } from "@optolith/helpers/nullable";
|
|
3
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
4
|
-
import {
|
|
3
|
+
import { attributedNameR, translateMapR, translateR } from "../../reader.js";
|
|
5
4
|
import { MISSING_VALUE } from "../../unknown.js";
|
|
6
5
|
import { appendInParensIfNotEmpty } from "./parensIf.js";
|
|
7
|
-
const renderPredefined = (targetCategoryId) =>
|
|
8
|
-
.thenW(getInstanceById => mapNullable(getInstanceById("TargetCategory", targetCategoryId), targetCategory => translateMapR(targetCategory.translations).map(translation => translation?.name)) ?? Reader.of(undefined))
|
|
9
|
-
.map(translation => translation ?? MISSING_VALUE);
|
|
6
|
+
const renderPredefined = (targetCategoryId) => attributedNameR("target-category", "TargetCategory", targetCategoryId).map(name => name ?? MISSING_VALUE);
|
|
10
7
|
const getTargetCategoryTranslationByType = (id) => {
|
|
11
8
|
switch (id.kind) {
|
|
12
9
|
case "Self":
|
package/lib/entities/poison.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single
|
|
|
6
6
|
* Get a JSON representation of the rules text for a poison.
|
|
7
7
|
*/
|
|
8
8
|
export declare const getPoisonEntityDescription: import("../creator.js").EntityDescriptionCreator<"Poison", {
|
|
9
|
-
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | "Disease" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait">;
|
|
9
|
+
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | "Disease" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait" | "Blessing" | "Cantrip">;
|
|
10
10
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
11
11
|
idMap: IdMap;
|
|
12
12
|
}, import("../index.js").EntityDescription>;
|