@optolith/entity-descriptions 0.11.0 → 0.11.2
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 +19 -0
- package/lib/entities/activatable.d.ts +2 -1
- package/lib/entities/activatable.js +45 -18
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/elixir.js +9 -1
- package/lib/entities/equipment.d.ts +1 -1
- package/lib/entities/influence.js +10 -1
- package/lib/entities/partial/activatableNameChunks.d.ts +2 -2
- package/lib/entities/partial/activatableNameChunks.js +18 -4
- package/lib/entities/partial/adventurePointsValue.js +19 -12
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/enhancements.js +13 -4
- package/lib/entities/partial/map.d.ts +1 -1
- package/lib/entities/partial/prerequisites/displayOption.d.ts +2 -7
- package/lib/entities/partial/prerequisites/displayOption.js +1 -18
- package/lib/entities/partial/prerequisites/index.d.ts +22 -20
- package/lib/entities/partial/prerequisites/index.js +68 -65
- package/lib/entities/partial/prerequisites/part.d.ts +3 -4
- package/lib/entities/partial/prerequisites/part.js +13 -11
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +16 -18
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +90 -82
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +4 -5
- package/lib/entities/partial/prerequisites/single/activatable.js +21 -29
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/animistPower.js +6 -9
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.js +4 -7
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +15 -17
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +9 -6
- package/lib/entities/partial/prerequisites/single/culture.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/culture.js +8 -15
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/enhancement.js +1 -1
- package/lib/entities/partial/prerequisites/single/influence.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/influence.js +7 -10
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +10 -12
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +4 -3
- package/lib/entities/partial/prerequisites/single/pact.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/pact.js +17 -18
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +21 -22
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +6 -8
- package/lib/entities/partial/prerequisites/single/profession.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/profession.js +11 -14
- package/lib/entities/partial/prerequisites/single/publication.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/publication.js +7 -13
- package/lib/entities/partial/prerequisites/single/race.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/race.js +8 -15
- package/lib/entities/partial/prerequisites/single/rated.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/rated.js +7 -9
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +52 -53
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/ratedSum.js +15 -15
- package/lib/entities/partial/prerequisites/single/rule.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/rule.js +2 -1
- package/lib/entities/partial/prerequisites/single/sex.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/sex.js +7 -6
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +11 -8
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/socialStatus.js +9 -15
- package/lib/entities/partial/prerequisites/single/state.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/state.js +8 -15
- package/lib/entities/partial/prerequisites/single/text.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/text.js +4 -3
- package/lib/entities/partial/prerequisites/single/tinyActivatable.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/tinyActivatable.js +5 -8
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/cost.d.ts +3 -3
- package/lib/entities/partial/rated/activatable/duration.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/duration.js +1 -1
- package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +1 -1
- package/lib/entities/partial/rated/activatable/range.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.js +2 -5
- package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
- package/lib/entities/partial/rated/skillCheck.d.ts +1 -1
- package/lib/entities/partial/reader.d.ts +3 -58
- package/lib/entities/partial/responsiveText.d.ts +2 -2
- package/lib/entities/partial/units/length.d.ts +1 -1
- package/lib/entities/partial/units/timeSpan.d.ts +3 -4
- package/lib/entities/personalityTrait.js +8 -1
- package/lib/entities/poison.js +5 -1
- package/lib/entities/profession.js +9 -15
- package/lib/entities/race.d.ts +1 -1
- package/lib/entities/race.js +16 -12
- package/lib/entities/spell.js +5 -2
- package/lib/env.d.ts +66 -0
- package/lib/env.js +1 -0
- package/lib/index.d.ts +88 -88
- package/lib/references/publicationOptions.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.d.ts +0 -7
- package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.js +0 -16
- package/lib/entities/partial/prerequisites/single/rated copy.d.ts +0 -8
- package/lib/entities/partial/prerequisites/single/rated copy.js +0 -17
- package/lib/entities/partial/prerequisites/single/tinyActivatable copy.d.ts +0 -7
- package/lib/entities/partial/prerequisites/single/tinyActivatable copy.js +0 -16
- package/lib/helpers/publicationOptions.d.ts +0 -42
- package/lib/helpers/publicationOptions.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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.2](https://github.com/Optolith/entity-descriptions/compare/v0.11.1...v0.11.2) (2026-09-14)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* activatable prerequisite disjunctions ([7895f89](https://github.com/Optolith/entity-descriptions/commit/7895f89735315a6a97a7a03bbcdc1c58361763b9)), closes [#52](https://github.com/Optolith/entity-descriptions/issues/52)
|
|
10
|
+
* correctly signed and labeled AP value depending on active entries ([27e3a7a](https://github.com/Optolith/entity-descriptions/commit/27e3a7a4975368651b443520f08bdd918e81a019))
|
|
11
|
+
* correctly signed value in IC derived AP value ([99fa203](https://github.com/Optolith/entity-descriptions/commit/99fa20395d8e9a378194673388d38e26938982bd))
|
|
12
|
+
* derived combat technique ap value ([0ad0554](https://github.com/Optolith/entity-descriptions/commit/0ad0554f2eee7857dbaa7717a3742e70b5735f1f))
|
|
13
|
+
## [0.11.1](https://github.com/Optolith/entity-descriptions/compare/v0.11.0...v0.11.1) (2026-09-13)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* attributed target category ([8411c00](https://github.com/Optolith/entity-descriptions/commit/8411c00eb0ac8df5f4335a41db951578cbaffe26))
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* advanced special ability sorting ([fd8ec9c](https://github.com/Optolith/entity-descriptions/commit/fd8ec9cf41625bc67f243850045f2bdf358bae5b)), closes [#50](https://github.com/Optolith/entity-descriptions/issues/50)
|
|
22
|
+
* advanced special ability sorting (other parts) ([75ccc67](https://github.com/Optolith/entity-descriptions/commit/75ccc671ad4a60116067a0b5df143d0b1c1cc3f9))
|
|
23
|
+
* display additional name ([460385e](https://github.com/Optolith/entity-descriptions/commit/460385ee19ea7be58766fb46859256514c75208f))
|
|
5
24
|
## [0.11.0](https://github.com/Optolith/entity-descriptions/compare/v0.10.0...v0.11.0) (2026-09-13)
|
|
6
25
|
|
|
7
26
|
### ⚠ 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;
|
|
@@ -48,7 +49,7 @@ export type BaseActivatableTranslation = {
|
|
|
48
49
|
/**
|
|
49
50
|
* Get a JSON representation of the rules text for a special ability.
|
|
50
51
|
*/
|
|
51
|
-
export declare const getActivatableEntityDescription: import("../creator.js").EntityDescriptionCreator<"
|
|
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
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;
|
|
@@ -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";
|
|
@@ -21,7 +22,7 @@ import { printAdvantageDisadvantagePrerequisites, printGeneralPrerequisites, } f
|
|
|
21
22
|
import { printActivatableName, } from "./partial/prerequisites/single/activatable.js";
|
|
22
23
|
import { renderStandaloneCostMap } from "./partial/rated/activatable/cost.js";
|
|
23
24
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
24
|
-
import { attributedNameR, localeSortR, nameR, translateR
|
|
25
|
+
import { attributedNameR, localeSortR, nameR, translateR } from "./partial/reader.js";
|
|
25
26
|
import { getResponsiveText, getResponsiveTextOptional, ResponsiveTextSize, } from "./partial/responsiveText.js";
|
|
26
27
|
import { formatTimeSpan } from "./partial/units/timeSpan.js";
|
|
27
28
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
@@ -544,9 +545,14 @@ const normalizeId = (entityName, id) => {
|
|
|
544
545
|
};
|
|
545
546
|
const renderAdvancedSpecialAbilityName = (translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, id, option) => {
|
|
546
547
|
const normalizedId = normalizeId(entityName, id);
|
|
547
|
-
return `^[${mapNullable(printActivatableName(
|
|
548
|
+
return `^[${mapNullable(printActivatableName(normalizedId, option, undefined).run({
|
|
549
|
+
getInstanceById,
|
|
550
|
+
translate,
|
|
551
|
+
getResolvedSelectOptionById,
|
|
552
|
+
displayedInProfession: false,
|
|
553
|
+
}), name => renderActivatableNameComponents(translateMap, name, false)) ?? MISSING_VALUE}](entity: "${normalizedId.kind}", instance: "${fromUniformCase(normalizedId)}", style: "normal")`;
|
|
548
554
|
};
|
|
549
|
-
const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceById, getResolvedSelectOptionById, entityName, advanced) => {
|
|
555
|
+
const renderAdvancedValue = (translate, translateMap, localeJoin, localeCompare, getInstanceById, getResolvedSelectOptionById, entityName, advanced) => {
|
|
550
556
|
if (advanced.every(entry => entry.kind === "OneOf") &&
|
|
551
557
|
isNotEmpty(advanced) &&
|
|
552
558
|
advanced.every(entry => entry.OneOf.options.length === 3)) {
|
|
@@ -558,7 +564,9 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
558
564
|
if (uniqueOptions.length === advanced.length) {
|
|
559
565
|
const [first, second] = optionsInAllEntries.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option));
|
|
560
566
|
return [
|
|
561
|
-
...uniqueOptions
|
|
567
|
+
...uniqueOptions
|
|
568
|
+
.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option))
|
|
569
|
+
.toSorted(localeCompare),
|
|
562
570
|
translate("one or two of these special abilities can alternatively be replaced by advanced special abilities {$first} and/or {$second}", { first, second }),
|
|
563
571
|
].join(", ");
|
|
564
572
|
}
|
|
@@ -568,25 +576,38 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
568
576
|
entry.DeriveFromExternalOption.display_option === undefined);
|
|
569
577
|
const anyEntriesToGenerate = count(advanced, entry => entry.kind === "Any");
|
|
570
578
|
const arr = [
|
|
571
|
-
...advanced
|
|
579
|
+
...advanced
|
|
580
|
+
.map((entry) => {
|
|
572
581
|
switch (entry.kind) {
|
|
573
582
|
case "General":
|
|
574
|
-
return
|
|
583
|
+
return [
|
|
584
|
+
"general",
|
|
585
|
+
renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, entry.General),
|
|
586
|
+
];
|
|
575
587
|
case "RestrictOptions":
|
|
576
|
-
return
|
|
588
|
+
return [
|
|
589
|
+
"general",
|
|
590
|
+
renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, entry.RestrictOptions.id, entry.RestrictOptions.option),
|
|
591
|
+
];
|
|
577
592
|
case "OneOf": {
|
|
578
593
|
if (entry.OneOf.display_option !== undefined) {
|
|
579
594
|
switch (entry.OneOf.display_option.kind) {
|
|
580
595
|
case "Hide":
|
|
581
596
|
return undefined;
|
|
582
597
|
case "ReplaceWith":
|
|
583
|
-
return
|
|
584
|
-
|
|
598
|
+
return [
|
|
599
|
+
"special",
|
|
600
|
+
translateMap(entry.OneOf.display_option.ReplaceWith.translations)
|
|
601
|
+
?.replacement ?? MISSING_VALUE,
|
|
602
|
+
];
|
|
585
603
|
default:
|
|
586
604
|
return assertExhaustive(entry.OneOf.display_option);
|
|
587
605
|
}
|
|
588
606
|
}
|
|
589
|
-
return
|
|
607
|
+
return [
|
|
608
|
+
"general",
|
|
609
|
+
localeJoin(entry.OneOf.options.map(option => renderAdvancedSpecialAbilityName(translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, option)), "disjunction"),
|
|
610
|
+
];
|
|
590
611
|
}
|
|
591
612
|
case "DeriveFromExternalOption":
|
|
592
613
|
if (entry.DeriveFromExternalOption.display_option !== undefined) {
|
|
@@ -594,7 +615,10 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
594
615
|
case "Hide":
|
|
595
616
|
return undefined;
|
|
596
617
|
case "ReplaceWith":
|
|
597
|
-
return
|
|
618
|
+
return [
|
|
619
|
+
"special",
|
|
620
|
+
translateMap(entry.DeriveFromExternalOption.display_option.ReplaceWith.translations)?.replacement ?? MISSING_VALUE,
|
|
621
|
+
];
|
|
598
622
|
default:
|
|
599
623
|
return assertExhaustive(entry.DeriveFromExternalOption.display_option);
|
|
600
624
|
}
|
|
@@ -605,7 +629,10 @@ const renderAdvancedValue = (translate, translateMap, localeJoin, getInstanceByI
|
|
|
605
629
|
default:
|
|
606
630
|
return assertExhaustive(entry);
|
|
607
631
|
}
|
|
608
|
-
})
|
|
632
|
+
})
|
|
633
|
+
.filter((item) => isNotNullish(item) && item[1] !== undefined)
|
|
634
|
+
.toSorted(reduceCompare(on(([type]) => type, localeCompare), on(([, value]) => value, localeCompare)))
|
|
635
|
+
.map(value => value[1]),
|
|
609
636
|
derivedFromExternalOptionEntriesToGenerate === 0
|
|
610
637
|
? undefined
|
|
611
638
|
: translate(".input {$count :number} {{{$count} more by primary patron}}", {
|
|
@@ -770,6 +797,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
770
797
|
getInstanceById,
|
|
771
798
|
localeCompare: locale.compare,
|
|
772
799
|
localeJoin: locale.join,
|
|
800
|
+
getResolvedSelectOptionById,
|
|
773
801
|
};
|
|
774
802
|
const baseEntry = entry;
|
|
775
803
|
const wrappedId = Case(entityName, id);
|
|
@@ -782,8 +810,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
782
810
|
? name => translate("Tradition ({$tradition})", { tradition: name })
|
|
783
811
|
: name => name;
|
|
784
812
|
return {
|
|
785
|
-
title: makeTraditionName(translation.name_in_library ?? translation.name) +
|
|
786
|
-
(baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
|
|
813
|
+
title: makeTraditionName(translation.name_in_library ?? translation.name + parensIf(translation.additionalName)) + (baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
|
|
787
814
|
subtitle: mapNullable(baseEntry.subtype, subtype => renderAdvantageDisadvantageSubtype(subtype).run(env)) ??
|
|
788
815
|
mapNullable(baseEntry.usage_type, usageType => renderCombatSpecialAbilityType(usageType).run(env)),
|
|
789
816
|
badge: mapNullable(entityName === "CombatStyleSpecialAbility" || entityName === "AdvancedCombatSpecialAbility"
|
|
@@ -839,7 +866,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
839
866
|
mapNullable(baseEntry.advanced, advanced => isStyleSpecialAbilityKind(entityName)
|
|
840
867
|
? {
|
|
841
868
|
label: renderAdvancedLabel(translate, entityName),
|
|
842
|
-
value: renderAdvancedValue(translate, translateMap, locale.join, getInstanceById, getResolvedSelectOptionById, entityName, advanced),
|
|
869
|
+
value: renderAdvancedValue(translate, translateMap, locale.join, locale.compare, getInstanceById, getResolvedSelectOptionById, entityName, advanced),
|
|
843
870
|
}
|
|
844
871
|
: undefined),
|
|
845
872
|
mapNullable(baseEntry.penalty, penalty => ({
|
|
@@ -849,11 +876,11 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
849
876
|
mapNullable(entry.prerequisites ?? (isAdvancedSpecialAbilityKind(entityName) ? [] : undefined), prerequisites => ({
|
|
850
877
|
label: translate("Prerequisites"),
|
|
851
878
|
value: wrappedId.kind === "Advantage" || wrappedId.kind === "Disadvantage"
|
|
852
|
-
? printAdvantageDisadvantagePrerequisites(
|
|
853
|
-
: printGeneralPrerequisites(
|
|
879
|
+
? printAdvantageDisadvantagePrerequisites(prerequisites, translation.name, wrappedId.kind).run(env)
|
|
880
|
+
: printGeneralPrerequisites(prerequisites, mapNullable(baseEntry.levels, levels => ({
|
|
854
881
|
id: wrappedId,
|
|
855
882
|
levels,
|
|
856
|
-
})), renderTrailingAdvancedPrerequisitesNote(translate, entityName)),
|
|
883
|
+
})), renderTrailingAdvancedPrerequisitesNote(translate, entityName)).run(env),
|
|
857
884
|
})),
|
|
858
885
|
mapNullable(baseEntry.combat_techniques, combatTechniques => ({
|
|
859
886
|
label: translate("Combat Techniques"),
|
|
@@ -3,7 +3,7 @@ import type { IdMap } from "../index.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Get a JSON representation of the rules text for an optional rule.
|
|
5
5
|
*/
|
|
6
|
-
export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"
|
|
6
|
+
export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"Disease" | "AnimalDisease", {
|
|
7
7
|
getInstanceById: GetInstanceById<"Publication" | "AnimalType" | "DerivedCharacteristic">;
|
|
8
8
|
idMap: IdMap;
|
|
9
9
|
}, import("../index.js").EntityDescription>;
|
package/lib/entities/elixir.js
CHANGED
|
@@ -13,6 +13,14 @@ export const getElixirEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
13
13
|
if (translation === undefined) {
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
16
|
+
const env = {
|
|
17
|
+
translate,
|
|
18
|
+
translateMap,
|
|
19
|
+
getInstanceById,
|
|
20
|
+
localeCompare: locale.compare,
|
|
21
|
+
localeJoin: locale.join,
|
|
22
|
+
getResolvedSelectOptionById,
|
|
23
|
+
};
|
|
16
24
|
return {
|
|
17
25
|
title: translation.name,
|
|
18
26
|
className: "elixir",
|
|
@@ -48,7 +56,7 @@ export const getElixirEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
48
56
|
value: translate("{$value} AP", {
|
|
49
57
|
value: entry.trade_secret.ap_value,
|
|
50
58
|
}) +
|
|
51
|
-
parensIf(mapNullable(entry.trade_secret.prerequisites, prerequisites => `${translate("Prerequisites")}: ${printPlainGeneralPrerequisites(
|
|
59
|
+
parensIf(mapNullable(entry.trade_secret.prerequisites, prerequisites => `${translate("Prerequisites")}: ${printPlainGeneralPrerequisites(prerequisites).run(env)}`)),
|
|
52
60
|
},
|
|
53
61
|
translation.special === undefined
|
|
54
62
|
? undefined
|
|
@@ -19,7 +19,7 @@ export declare const renderRangedWeapon: <Damage>(translate: Translate, translat
|
|
|
19
19
|
/**
|
|
20
20
|
* Get a JSON representation of the rules text for equipment.
|
|
21
21
|
*/
|
|
22
|
-
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Ammunition" | "
|
|
22
|
+
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature", {
|
|
23
23
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Reach" | "SocialStatus" | "CloseCombatTechnique" | "RangedCombatTechnique" | "MagicalTradition" | "BlessedTradition" | "DerivedCharacteristic" | AmmunitionishIdentifier["kind"] | "Race" | "Culture" | "Profession" | "Skill">;
|
|
24
24
|
idMap: IdMap;
|
|
25
25
|
}, import("../index.js").EntityDescription>;
|
|
@@ -9,6 +9,15 @@ export const getInfluenceEntityDescription = createEntityDescriptionCreator(({ g
|
|
|
9
9
|
if (translation === undefined) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
+
const env = {
|
|
13
|
+
translate,
|
|
14
|
+
translateMap,
|
|
15
|
+
getInstanceById,
|
|
16
|
+
localeCompare: locale.compare,
|
|
17
|
+
localeJoin: locale.join,
|
|
18
|
+
getResolvedSelectOptionById,
|
|
19
|
+
getChildInstancesForInstanceId,
|
|
20
|
+
};
|
|
12
21
|
return {
|
|
13
22
|
title: translation.name,
|
|
14
23
|
className: "influence",
|
|
@@ -32,7 +41,7 @@ export const getInfluenceEntityDescription = createEntityDescriptionCreator(({ g
|
|
|
32
41
|
? undefined
|
|
33
42
|
: {
|
|
34
43
|
label: translate("Prerequisites"),
|
|
35
|
-
value: printInfluencePrerequisites(
|
|
44
|
+
value: printInfluencePrerequisites(entry.prerequisites).run(env),
|
|
36
45
|
},
|
|
37
46
|
],
|
|
38
47
|
},
|
|
@@ -43,7 +43,7 @@ export declare const combineNameComponents: (elements: ActivatableNameComponents
|
|
|
43
43
|
/**
|
|
44
44
|
* Renders the name components of an activatable entry, combining multiple options into one string.
|
|
45
45
|
*/
|
|
46
|
-
export declare const renderCombinedActivatableNameComponents: (translateMap: TranslateMap, components: CombinedActivatableNameComponents, formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
46
|
+
export declare const renderCombinedActivatableNameComponents: (translateMap: TranslateMap, components: CombinedActivatableNameComponents, formatAsPrerequisite: boolean, join?: (list: string[]) => string, context?: string) => string;
|
|
47
47
|
/**
|
|
48
48
|
* Renders the name components of multiple activatable entries.
|
|
49
49
|
*/
|
|
@@ -51,7 +51,7 @@ export declare const renderMultipleStandaloneActivatableNameComponents: (transla
|
|
|
51
51
|
/**
|
|
52
52
|
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
53
53
|
*/
|
|
54
|
-
export declare const renderActivatableNameComponentsCombinedIfPossible: (translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
54
|
+
export declare const renderActivatableNameComponentsCombinedIfPossible: (translate: Translate, translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
55
55
|
/**
|
|
56
56
|
* Renders the options of an activatable entry, combining them if necessary.
|
|
57
57
|
*/
|
|
@@ -6,6 +6,8 @@ import { isNotNullish } from "@elyukai/utils/nullable";
|
|
|
6
6
|
import { mapObject } from "@optolith/helpers/object";
|
|
7
7
|
import { romanize } from "@optolith/helpers/roman";
|
|
8
8
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
9
|
+
import { fromUniformCase } from "tsondb/schema/gen";
|
|
10
|
+
import { attributedInstance } from "./markdown.js";
|
|
9
11
|
import { MISSING_VALUE } from "./unknown.js";
|
|
10
12
|
const combineChunks = (a, b, join) => {
|
|
11
13
|
if (typeof a === "string") {
|
|
@@ -127,22 +129,34 @@ export const combineNameComponents = (elements) => {
|
|
|
127
129
|
/**
|
|
128
130
|
* Renders the name components of an activatable entry, combining multiple options into one string.
|
|
129
131
|
*/
|
|
130
|
-
export const renderCombinedActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => renderActivatableNameComponents(translateMap, {
|
|
132
|
+
export const renderCombinedActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", "), context = "prerequisite") => attributedInstance(renderActivatableNameComponents(translateMap, {
|
|
131
133
|
...components,
|
|
132
134
|
nameBuilderRules: {
|
|
133
135
|
...components.nameBuilderRules,
|
|
134
136
|
useParenthesis: true,
|
|
135
137
|
},
|
|
136
138
|
options: join(components.options.map(chunk => renderActivatableNameChunk(translateMap, normalizeChunks(chunk)))),
|
|
137
|
-
}, formatAsPrerequisite);
|
|
139
|
+
}, formatAsPrerequisite), components.id.kind, fromUniformCase(components.id), { context });
|
|
138
140
|
/**
|
|
139
141
|
* Renders the name components of multiple activatable entries.
|
|
140
142
|
*/
|
|
141
|
-
export const renderMultipleStandaloneActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => join(components.map(item => renderActivatableNameComponents(translateMap, item, formatAsPrerequisite)));
|
|
143
|
+
export const renderMultipleStandaloneActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => join(components.map(item => attributedInstance(renderActivatableNameComponents(translateMap, item, formatAsPrerequisite), item.id.kind, fromUniformCase(item.id), { context: '"prerequisite"' })));
|
|
142
144
|
/**
|
|
143
145
|
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
144
146
|
*/
|
|
145
|
-
export const renderActivatableNameComponentsCombinedIfPossible = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => {
|
|
147
|
+
export const renderActivatableNameComponentsCombinedIfPossible = (translate, translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => {
|
|
148
|
+
if (isNotEmpty(components) &&
|
|
149
|
+
components.length > 1 &&
|
|
150
|
+
(components.every(c => c.id.kind === "MagicalTradition") ||
|
|
151
|
+
components.every(c => c.id.kind === "BlessedTradition"))) {
|
|
152
|
+
return (attributedInstance(`${translate("Tradition")} (`, components[0].id.kind, undefined, {
|
|
153
|
+
context: '"prerequisite"',
|
|
154
|
+
}) +
|
|
155
|
+
join(components.map(c => c.options === undefined
|
|
156
|
+
? MISSING_VALUE
|
|
157
|
+
: attributedInstance(renderActivatableNameChunk(translateMap, normalizeChunks(c.options)), c.id.kind, fromUniformCase(c.id), { context: '"prerequisite"' }))) +
|
|
158
|
+
attributedInstance(`)`, components[0].id.kind, undefined, { context: '"prerequisite"' }));
|
|
159
|
+
}
|
|
146
160
|
const combined = combineNameComponents(components);
|
|
147
161
|
if (combined === undefined) {
|
|
148
162
|
return renderMultipleStandaloneActivatableNameComponents(translateMap, components, formatAsPrerequisite, join);
|
|
@@ -35,7 +35,7 @@ const renderFixedSelectOptionsAdventurePointsValue = (locale, getAllSelectOption
|
|
|
35
35
|
.join("; ");
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, getAllSelectOptions, getNameForSelectOptionId, config, applyNegative) => {
|
|
38
|
+
const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, derivedRangeStart, getAllSelectOptions, getNameForSelectOptionId, config, applyNegative) => {
|
|
39
39
|
if (config === undefined) {
|
|
40
40
|
return MISSING_VALUE;
|
|
41
41
|
}
|
|
@@ -43,8 +43,8 @@ const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, getAllSel
|
|
|
43
43
|
case "DerivedFromImprovementCost": {
|
|
44
44
|
const start = derivedLabel();
|
|
45
45
|
return `${start}: ${locale.translate("{$value} Adventure Points", {
|
|
46
|
-
value: Array.from({ length:
|
|
47
|
-
(config.DerivedFromImprovementCost.offset ?? 0)).join("/"),
|
|
46
|
+
value: Array.from({ length: 5 - derivedRangeStart }, (_, index) => applyNegative((index + derivedRangeStart) * (config.DerivedFromImprovementCost.multiplier ?? 1) +
|
|
47
|
+
(config.DerivedFromImprovementCost.offset ?? 0))).join("/"),
|
|
48
48
|
})}`;
|
|
49
49
|
}
|
|
50
50
|
case "Fixed":
|
|
@@ -220,9 +220,9 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
220
220
|
default:
|
|
221
221
|
return translate("A/B/C/D ability");
|
|
222
222
|
}
|
|
223
|
-
}, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.Skills.ap_value, applyNegative);
|
|
223
|
+
}, 1, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.Skills.ap_value, applyNegative);
|
|
224
224
|
case "CombatTechniques":
|
|
225
|
-
return renderSelectOptionsAdventurePointsValue(locale, () => translate("B/C/D combat technique"), getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.CombatTechniques.ap_value, applyNegative);
|
|
225
|
+
return renderSelectOptionsAdventurePointsValue(locale, () => translate("B/C/D combat technique"), 2, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.CombatTechniques.ap_value, applyNegative);
|
|
226
226
|
case "TargetCategories":
|
|
227
227
|
return MISSING_VALUE;
|
|
228
228
|
default:
|
|
@@ -231,20 +231,27 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
231
231
|
}
|
|
232
232
|
case "DependingOnActive":
|
|
233
233
|
return `${translate(".input {$value :number} {{{$value} Adventure Points}}", {
|
|
234
|
-
value: value.DependingOnActive.inactive,
|
|
234
|
+
value: applyNegative(value.DependingOnActive.inactive),
|
|
235
235
|
})} (${translate(".input {$value :number} {{{$value} Adventure Points with {$name}}}", {
|
|
236
|
-
value: value.DependingOnActive.active,
|
|
236
|
+
value: applyNegative(value.DependingOnActive.active),
|
|
237
237
|
name: getNameForId(value.DependingOnActive.id) ?? MISSING_VALUE,
|
|
238
238
|
})})`;
|
|
239
239
|
case "DependingOnActiveInstances":
|
|
240
240
|
switch (value.DependingOnActiveInstances.kind) {
|
|
241
241
|
case "Threshold":
|
|
242
|
-
|
|
243
|
-
value: value
|
|
244
|
-
|
|
242
|
+
if (entry.levels === undefined) {
|
|
243
|
+
return translate(".input {$value :number} {{{$value} Adventure Points}}", {
|
|
244
|
+
value: applyNegative(value.DependingOnActiveInstances.Threshold.normal),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
return translate(".input {$value :number} {{{$value} Adventure Points per level}}", {
|
|
249
|
+
value: applyNegative(value.DependingOnActiveInstances.Threshold.normal),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
245
252
|
case "Expression": {
|
|
246
253
|
const expression = value.DependingOnActiveInstances.Expression;
|
|
247
|
-
const values = Array.from({ length: entry.maximum ?? 3 }, (_, index) => evaluateMathOperation(expression, exprValue => {
|
|
254
|
+
const values = Array.from({ length: entry.maximum ?? 3 }, (_, index) => applyNegative(evaluateMathOperation(expression, exprValue => {
|
|
248
255
|
switch (exprValue.kind) {
|
|
249
256
|
case "Constant":
|
|
250
257
|
return exprValue.Constant;
|
|
@@ -253,7 +260,7 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
253
260
|
default:
|
|
254
261
|
return assertExhaustive(exprValue);
|
|
255
262
|
}
|
|
256
|
-
})).join("/");
|
|
263
|
+
}))).join("/");
|
|
257
264
|
const labels = Array.from({ length: entry.maximum ?? 3 }, (_, index) => `${(index + 1).toFixed()}.`).join("/");
|
|
258
265
|
if (entry.maximum !== undefined) {
|
|
259
266
|
return translate("{$values} Adventure Points for the {$labels} purchase", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonnessRatedAdvantageDisadvantage } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdReader } from "../../env.js";
|
|
2
3
|
import type { TranslationKeysWithoutParams } from "../../helpers/translate.js";
|
|
3
4
|
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../index.js";
|
|
4
|
-
import type { StdReader } from "./reader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Render the names of either commonness-rated advantages or commonness-rated disadvantages.
|
|
7
7
|
*/
|
|
@@ -50,7 +50,7 @@ const renderCommonnessRatedAdvantageOrDisadvantageName = (translateMap, getInsta
|
|
|
50
50
|
level,
|
|
51
51
|
nameBuilderRules: makeNameBuilderRulesWithDefaults(instance.nameBuilderRules),
|
|
52
52
|
options,
|
|
53
|
-
}, false, list => list.toSorted(localeCompare).join(", "));
|
|
53
|
+
}, false, list => list.toSorted(localeCompare).join(", "), "commonness");
|
|
54
54
|
}, entity, item.id) ?? MISSING_VALUE);
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImprovementCost, RatedIdentifier, SkillWithEnhancementsIdentifier } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdReader } from "../../env.js";
|
|
2
3
|
import type { RawEntityDescriptionSection } from "../../index.js";
|
|
3
|
-
import { type StdReader } from "./reader.js";
|
|
4
4
|
/**
|
|
5
5
|
* Render the enhancements section for an entity description, if applicable.
|
|
6
6
|
*/
|
|
@@ -6,7 +6,7 @@ import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
|
6
6
|
import { getAdventurePointsForActivation } from "@optolith/adventure-points/improvement-cost";
|
|
7
7
|
import { filterIncludedPublicationEntriesMapR } from "../../references/publicationOptions.js";
|
|
8
8
|
import { printEnhancementPrerequisites } from "./prerequisites/index.js";
|
|
9
|
-
import { getChildInstancesForInstanceIdR, translateMapR, translateR
|
|
9
|
+
import { getChildInstancesForInstanceIdR, translateMapR, translateR } from "./reader.js";
|
|
10
10
|
const getEnhancementAPValue = (adventurePoints, parentImprovementCost) => {
|
|
11
11
|
switch (adventurePoints.kind) {
|
|
12
12
|
case "DerivedFromImprovementCost":
|
|
@@ -18,9 +18,18 @@ const getEnhancementAPValue = (adventurePoints, parentImprovementCost) => {
|
|
|
18
18
|
return assertExhaustive(adventurePoints);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
const renderEnhancement = (enhancement, parentImprovementCost) =>
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const renderEnhancement = (enhancement, parentImprovementCost) => {
|
|
22
|
+
const { prerequisites } = enhancement.content;
|
|
23
|
+
return translateMapR(enhancement.content.translations).thenW(translation => translation === undefined
|
|
24
|
+
? Reader.of(undefined)
|
|
25
|
+
: translateR("SR {$value}", { value: enhancement.content.skill_rating }).thenW(sr => translateR("{$value} AP", {
|
|
26
|
+
value: getEnhancementAPValue(enhancement.content.adventurePoints, parentImprovementCost),
|
|
27
|
+
}).thenW(ap => (prerequisites === undefined
|
|
28
|
+
? Reader.of("")
|
|
29
|
+
: translateR(".input {$hiddenCount :number} {{Prerequisites}}", {
|
|
30
|
+
hiddenCount: prerequisites.length,
|
|
31
|
+
}).thenW(prerequisitesLabel => printEnhancementPrerequisites(prerequisites).map(prerequisitesText => ` ${prerequisitesLabel}: ${prerequisitesText}`))).map(prerequisitesText => `- ^[${translation.name}](entity: "Enhancement") (${sr}, ${ap}): ${translation.effect.split("\n").join("\n ")}${prerequisitesText}`))));
|
|
32
|
+
};
|
|
24
33
|
/**
|
|
25
34
|
* Render the enhancements section for an entity description, if applicable.
|
|
26
35
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
2
|
import type { ParameterMapStyle, ResponsiveTextOptional } from "@optolith/database-schema/gen";
|
|
3
|
+
import type { StdEnv, StdReader } from "../../env.js";
|
|
3
4
|
import type { LocaleMap } from "../../helpers/translate.js";
|
|
4
|
-
import { type StdEnv, type StdReader } from "./reader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Renders a map of options to a string.
|
|
7
7
|
*/
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { DisplayOption } from "@optolith/database-schema/gen";
|
|
2
|
-
import type {
|
|
3
|
-
import type { StdReader } from "../reader.js";
|
|
2
|
+
import type { StdReader } from "../../../env.js";
|
|
4
3
|
import type { PrerequisitePart } from "./part.js";
|
|
5
4
|
/**
|
|
6
5
|
* Get the translation of a display option.
|
|
7
6
|
*/
|
|
8
|
-
export declare const printDisplayOption: (
|
|
9
|
-
/**
|
|
10
|
-
* Get the translation of a display option.
|
|
11
|
-
*/
|
|
12
|
-
export declare const printDisplayOptionR: (displayOption: DisplayOption) => StdReader<PrerequisitePart | undefined, "tm">;
|
|
7
|
+
export declare const printDisplayOption: (displayOption: DisplayOption) => StdReader<PrerequisitePart | undefined, "tm">;
|
|
@@ -4,24 +4,7 @@ import { MISSING_VALUE } from "../unknown.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Get the translation of a display option.
|
|
6
6
|
*/
|
|
7
|
-
export const printDisplayOption = (
|
|
8
|
-
switch (displayOption.kind) {
|
|
9
|
-
case "Hide":
|
|
10
|
-
return undefined;
|
|
11
|
-
case "ReplaceWith":
|
|
12
|
-
return {
|
|
13
|
-
value: translateMap(displayOption.ReplaceWith.translations)?.replacement ?? MISSING_VALUE,
|
|
14
|
-
sentenceType: displayOption.ReplaceWith.sentence_type,
|
|
15
|
-
isMeta: false,
|
|
16
|
-
};
|
|
17
|
-
default:
|
|
18
|
-
return assertExhaustive(displayOption);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Get the translation of a display option.
|
|
23
|
-
*/
|
|
24
|
-
export const printDisplayOptionR = (displayOption) => {
|
|
7
|
+
export const printDisplayOption = (displayOption) => {
|
|
25
8
|
switch (displayOption.kind) {
|
|
26
9
|
case "Hide":
|
|
27
10
|
return Reader.of(undefined);
|