@optolith/entity-descriptions 0.9.2 → 0.11.0

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/entities/activatable.d.ts +4 -3
  3. package/lib/entities/activatable.js +30 -14
  4. package/lib/entities/disease.d.ts +1 -1
  5. package/lib/entities/disease.js +3 -0
  6. package/lib/entities/elixir.d.ts +1 -1
  7. package/lib/entities/equipment.d.ts +1 -1
  8. package/lib/entities/partial/prerequisites/displayOption.d.ts +5 -0
  9. package/lib/entities/partial/prerequisites/displayOption.js +18 -0
  10. package/lib/entities/partial/prerequisites/index.d.ts +3 -3
  11. package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +2 -2
  12. package/lib/entities/partial/prerequisites/prerequisiteGroups.js +10 -0
  13. package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.d.ts +7 -0
  14. package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.js +16 -0
  15. package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.d.ts +7 -0
  16. package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.js +17 -0
  17. package/lib/entities/partial/prerequisites/single/rated copy.d.ts +8 -0
  18. package/lib/entities/partial/prerequisites/single/rated copy.js +17 -0
  19. package/lib/entities/partial/prerequisites/single/tinyActivatable copy.d.ts +7 -0
  20. package/lib/entities/partial/prerequisites/single/tinyActivatable copy.js +16 -0
  21. package/lib/entities/partial/prerequisites/single/tinyActivatable.d.ts +7 -0
  22. package/lib/entities/partial/prerequisites/single/tinyActivatable.js +16 -0
  23. package/lib/entities/partial/rated/activatable/cost.d.ts +2 -2
  24. package/lib/entities/partial/reader.d.ts +1 -1
  25. package/lib/entities/partial/responsiveText.d.ts +1 -1
  26. package/lib/entities/poison.d.ts +1 -1
  27. package/lib/helpers/publicationOptions.d.ts +42 -0
  28. package/lib/helpers/publicationOptions.js +64 -0
  29. package/lib/index.d.ts +146 -146
  30. package/lib/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
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.0](https://github.com/Optolith/entity-descriptions/compare/v0.10.0...v0.11.0) (2026-09-13)
6
+
7
+ ### ⚠ BREAKING CHANGES
8
+
9
+ * **deps:** upgrade to schema 0.61.0
10
+
11
+ ### build
12
+
13
+ * **deps:** upgrade to schema 0.61.0 ([3883580](https://github.com/Optolith/entity-descriptions/commit/38835809b80d2937d33678bb1643da8f2ab9a200))
14
+ ## [0.10.0](https://github.com/Optolith/entity-descriptions/compare/v0.9.2...v0.10.0) (2026-09-12)
15
+
16
+ ### ⚠ BREAKING CHANGES
17
+
18
+ * **deps:** upgrade to schema 0.59.0
19
+
20
+ ### build
21
+
22
+ * **deps:** upgrade to schema 0.59.0 ([934588f](https://github.com/Optolith/entity-descriptions/commit/934588f14ca61dc4d78186dc0d7d47cd99c3f847))
5
23
  ## [0.9.2](https://github.com/Optolith/entity-descriptions/compare/v0.9.1...v0.9.2) (2026-09-11)
6
24
 
7
25
  ### Bug Fixes
@@ -1,4 +1,4 @@
1
- import type { ActivatableIdentifier, AdvancedSpecialAbility, AdvantageDisadvantagePrerequisites, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, Brew_ID, DaggerRitualCost, EnchantmentCost, Errata, GeneralPrerequisites, MagicalSignCost, Penalty, PropertyDeclaration, PublicationRefs, RatedIdentifier, SelectOptions, SpecialRule, Volume } from "@optolith/database-schema/gen";
1
+ import type { ActivatableIdentifier, AdvancedSpecialAbility, AdvantageDisadvantagePrerequisites, AdvantageDisadvantageSubtype, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, Brew_ID, DaggerRitualCost, EnchantmentCost, Errata, GeneralPrerequisites, MagicalSignCost, Penalty, PropertyDeclaration, PublicationRefs, RatedIdentifier, SelectOptions, SpecialRule, Volume } from "@optolith/database-schema/gen";
2
2
  import { Case } from "tsondb/schema/gen";
3
3
  import type { GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
4
4
  import type { GetAllResolvedNewSkillApplications, GetAllResolvedSelectOptions, GetAllResolvedSkillUses } from "../index.js";
@@ -10,6 +10,7 @@ type AdvancedIdentifierSpecialAbility = string | Case<AdvancedSpecialAbilityKind
10
10
  */
11
11
  export type BaseActivatable = {
12
12
  levels?: number;
13
+ subtype?: AdvantageDisadvantageSubtype;
13
14
  maximum?: number;
14
15
  select_options?: SelectOptions;
15
16
  usage_type?: Case<"Passive" | "Active" | "BasicManeuver" | "SpecialManeuver">;
@@ -47,8 +48,8 @@ export type BaseActivatableTranslation = {
47
48
  /**
48
49
  * Get a JSON representation of the rules text for a special ability.
49
50
  */
50
- 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", {
51
- getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon" | "Patron" | "PersonalityTrait" | "Blessing" | "Brew">;
51
+ export declare const getActivatableEntityDescription: import("../creator.js").EntityDescriptionCreator<"AdvancedCombatSpecialAbility" | "AdvancedKarmaSpecialAbility" | "AdvancedMagicalSpecialAbility" | "AdvancedSkillSpecialAbility" | "Advantage" | "AncestorGlyph" | "ArcaneOrbEnchantment" | "AttireEnchantment" | "Beutelzauber" | "BlessedTradition" | "BowlEnchantment" | "BrawlingSpecialAbility" | "CauldronEnchantment" | "CeremonialItemSpecialAbility" | "ChronicleEnchantment" | "CombatSpecialAbility" | "CombatStyleSpecialAbility" | "CommandSpecialAbility" | "DaggerRitual" | "Disadvantage" | "FamiliarSpecialAbility" | "FatePointSexSpecialAbility" | "FatePointSpecialAbility" | "FoolsHatEnchantment" | "GeneralSpecialAbility" | "Haubenzauber" | "Hauerkettenzauber" | "InstrumentEnchantment" | "KarmaSpecialAbility" | "Keulenzauber" | "Krallenkettenzauber" | "Kristallkugelzauber" | "LiturgicalStyleSpecialAbility" | "LycantropicGift" | "MagicStyleSpecialAbility" | "MagicalSign" | "MagicalSpecialAbility" | "MagicalTradition" | "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" | "Brew" | "Blessing" | "Cantrip">;
52
53
  getAllInstances: GetAllInstances<"Script">;
53
54
  getResolvedSelectOptionById: GetResolvedSelectOptionById;
54
55
  getAllResolvedSelectOptions: GetAllResolvedSelectOptions;
@@ -33,6 +33,34 @@ const isAdvancedSpecialAbilityKind = (value) => value === "AdvancedSkillSpecialA
33
33
  value === "AdvancedCombatSpecialAbility" ||
34
34
  value === "AdvancedMagicalSpecialAbility" ||
35
35
  value === "AdvancedKarmaSpecialAbility";
36
+ const renderAdvantageDisadvantageSubtype = (subtype) => {
37
+ switch (subtype.kind) {
38
+ case "MagicalHonor":
39
+ return translateR("Magical Honor");
40
+ case "MagicalPunishment":
41
+ return translateR("Magical Punishment");
42
+ case "MagicalRank":
43
+ return translateR("Magical Rank");
44
+ case "MagicalTitle":
45
+ return translateR("Magical Title");
46
+ default:
47
+ return assertExhaustive(subtype);
48
+ }
49
+ };
50
+ const renderCombatSpecialAbilityType = (usageType) => {
51
+ switch (usageType.kind) {
52
+ case "Active":
53
+ return translateR("Active");
54
+ case "Passive":
55
+ return translateR("Passive");
56
+ case "BasicManeuver":
57
+ return translateR("Basic Maneuver");
58
+ case "SpecialManeuver":
59
+ return translateR("Special Maneuver");
60
+ default:
61
+ return assertExhaustive(usageType);
62
+ }
63
+ };
36
64
  const renderPropertyValue = (getInstanceById, translate, translateMap, propertyDecl) => {
37
65
  switch (propertyDecl.kind) {
38
66
  case "DependingOnSelection":
@@ -756,20 +784,8 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
756
784
  return {
757
785
  title: makeTraditionName(translation.name_in_library ?? translation.name) +
758
786
  (baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
759
- subtitle: mapNullable(baseEntry.usage_type, usageType => {
760
- switch (usageType.kind) {
761
- case "Active":
762
- return translate("Active");
763
- case "Passive":
764
- return translate("Passive");
765
- case "BasicManeuver":
766
- return translate("Basic Maneuver");
767
- case "SpecialManeuver":
768
- return translate("Special Maneuver");
769
- default:
770
- return assertExhaustive(usageType);
771
- }
772
- }),
787
+ subtitle: mapNullable(baseEntry.subtype, subtype => renderAdvantageDisadvantageSubtype(subtype).run(env)) ??
788
+ mapNullable(baseEntry.usage_type, usageType => renderCombatSpecialAbilityType(usageType).run(env)),
773
789
  badge: mapNullable(entityName === "CombatStyleSpecialAbility" || entityName === "AdvancedCombatSpecialAbility"
774
790
  ? entry.type
775
791
  : undefined, combatType => {
@@ -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<"Disease" | "AnimalDisease", {
6
+ export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"AnimalDisease" | "Disease", {
7
7
  getInstanceById: GetInstanceById<"Publication" | "AnimalType" | "DerivedCharacteristic">;
8
8
  idMap: IdMap;
9
9
  }, import("../index.js").EntityDescription>;
@@ -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: [
@@ -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>;
@@ -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<"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", {
22
+ export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Ammunition" | "Animal" | "AnimalCare" | "Armor" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "Weapon" | "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>;
@@ -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 { 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
+ };
@@ -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,8 @@
1
+ import type { RatedPrerequisite } from "@optolith/database-schema/gen";
2
+ import { type GetInstanceById } from "../../../../helpers/getTypes.js";
3
+ import type { LocaleEnvironment } from "../../../../helpers/locale.js";
4
+ import type { PrerequisitePart } from "../part.js";
5
+ /**
6
+ * Get the translation of a blessed tradition prerequisite.
7
+ */
8
+ export declare const printRatedPrerequisite: (getInstanceById: GetInstanceById<"Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony">, locale: Pick<LocaleEnvironment, "translateMap">, prerequisite: RatedPrerequisite) => PrerequisitePart | undefined;
@@ -0,0 +1,17 @@
1
+ import { attributedCustomName } from "../../markdown.js";
2
+ import { MISSING_VALUE } from "../../unknown.js";
3
+ import { printDisplayOption } from "../displayOption.js";
4
+ /**
5
+ * Get the translation of a blessed tradition prerequisite.
6
+ */
7
+ export const printRatedPrerequisite = (getInstanceById, locale, prerequisite) => {
8
+ if (prerequisite.display_option !== undefined) {
9
+ return printDisplayOption(locale.translateMap, prerequisite.display_option);
10
+ }
11
+ const name = attributedCustomName(locale.translateMap, getInstanceById, "prerequisite", (t) => t.abbreviation ?? t.name, prerequisite.id) ?? MISSING_VALUE;
12
+ return {
13
+ value: prerequisite.value > 0 ? `${name} ${prerequisite.value.toFixed()}` : 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
+ };
@@ -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
+ };
@@ -42,7 +42,7 @@ export declare const renderIndefiniteCost: (value: IndefiniteCost, shouldAppendN
42
42
  /**
43
43
  * Returns the text for a standalone one-time cost map of an activatable skill.
44
44
  */
45
- export declare const renderStandaloneCostMap: (value: StandaloneCostMap) => Reader<StdEnv<"tm" | "t" | "rts"> & {
45
+ export declare const renderStandaloneCostMap: (value: StandaloneCostMap) => Reader<StdEnv<"rts" | "t" | "tm"> & {
46
46
  translate: import("../../../../helpers/translate.js").Translate;
47
47
  energyUnit: import("../../units/energy.js").EnergyUnit;
48
48
  }, string>;
@@ -63,7 +63,7 @@ export declare const renderNonModifiableSustainedCost: (value: NonModifiableSust
63
63
  responsiveTextSize: import("../../responsiveText.js").ResponsiveTextSize;
64
64
  } & {
65
65
  translate: import("../../../../helpers/translate.js").Translate;
66
- } & StdEnv<"f" | "tm" | "t" | "rts"> & StdEnv<"tm" | "t" | "rts" | "eu", never, never, never>, string>;
66
+ } & StdEnv<"f" | "rts" | "t" | "tm"> & StdEnv<"eu" | "rts" | "t" | "tm", never, never, never>, string>;
67
67
  /**
68
68
  * Returns the text for the cost of a sustained activatable skill.
69
69
  */
@@ -316,5 +316,5 @@ export declare const modifyBySpeedR: Reader<{
316
316
  /**
317
317
  * Returns the default values wrapped in a reader if the value is nullish, otherwise applies the given function to the value and returns the result.
318
318
  */
319
- export declare const mapNullableR: <T, U, R>(defaultValue: U, fn: (value: NonNullable<T>) => Reader<U, R>) => (value: T) => Reader<U, R> | Reader<unknown, U>;
319
+ export declare const mapNullableR: <T, U, R>(defaultValue: U, fn: (value: NonNullable<T>) => Reader<U, R>) => (value: T) => Reader<unknown, U> | Reader<U, R>;
320
320
  export {};
@@ -40,4 +40,4 @@ export declare const replaceTextIfNeeded: (translations: LocaleMap<{
40
40
  */
41
41
  export declare const appendNoteIfNeeded: (translations: LocaleMap<{
42
42
  note?: ResponsiveTextOptional;
43
- }> | undefined, valueToAppendTo: string) => Reader<StdEnv<"tm" | "rts">, string>;
43
+ }> | undefined, valueToAppendTo: string) => Reader<StdEnv<"rts" | "tm">, string>;
@@ -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>;
@@ -0,0 +1,42 @@
1
+ import type { Publication, Publication_ID } from "@optolith/database-schema/gen";
2
+ import type { GetInstanceById } from "./getTypes.js";
3
+ /**
4
+ * Options for how to render information from different publications in entity descriptions.
5
+ */
6
+ export type PublicationOptions = {
7
+ /**
8
+ * A list of publications to include, identified by their ID. These will always be included no matter the settings in `showPublicationGroups`.
9
+ */
10
+ publications: Publication_ID[];
11
+ /**
12
+ * Which publication groups to include, no matter if they are explicitly referenced or not.
13
+ *
14
+ * - `"none"`: No groups, only explicitly referenced publications
15
+ * - `"core"`: Core rules
16
+ * - `"playerOriented"`: Core rules and player-oriented supplements, excluding books with adult content and adventure books.
17
+ * - `"playerOrientedWithAdult"`: Core rules and player-oriented supplements, excluding adventure books but including books with adult content.
18
+ * - `"playerOrientedWithAdventures"`: Core rules and player-oriented supplements, including adventure books but excluding books with adult content.
19
+ * - `"all"`: All groups, including books with adult content and adventure books. Any explicit publication references will have no effect as all publications are included anyway.
20
+ */
21
+ showPublicationGroups: "none" | "core" | "playerOriented" | "playerOrientedWithAdult" | "playerOrientedWithAdventures" | "all";
22
+ /**
23
+ * How to handle different printings of the same publication.
24
+ *
25
+ * - `"none"`: No handling, new and removed entries are treated equally.
26
+ * - `"latestOnly"`: Only the latest printing of a publication is included, older revisions are ignored.
27
+ * - `Record<Publication_ID, number>`: A custom handling for each publication, where the number indicates the printing to include.
28
+ */
29
+ printingHandling: "none" | "latestOnly" | Record<Publication_ID, number>;
30
+ /**
31
+ * If true, only publication references to publications included via `publications` and `showPublicationGroups` will be shown.
32
+ */
33
+ onlyShowReferencesToIncludedPublications: boolean;
34
+ };
35
+ /**
36
+ *
37
+ */
38
+ export declare const isPublicationIncluded: (publicationOptions: PublicationOptions, publicationId: Publication_ID, publication: Publication) => boolean;
39
+ /**
40
+ *
41
+ */
42
+ export declare const isPublicationIncludedById: (getInstanceById: GetInstanceById<"Publication">, publicationOptions: PublicationOptions, publicationId: Publication_ID) => boolean;
@@ -0,0 +1,64 @@
1
+ import { assertExhaustive } from "@elyukai/utils/typeSafety";
2
+ const isPublicationIncludedInGroup = (publication, publicationOptions) => {
3
+ switch (publicationOptions.showPublicationGroups) {
4
+ case "none":
5
+ return false;
6
+ case "core":
7
+ switch (publication.category.kind) {
8
+ case "CoreRules":
9
+ return true;
10
+ case "ExpansionRules":
11
+ case "Sourcebook":
12
+ case "RegionalSourcebook":
13
+ case "Adventure":
14
+ return false;
15
+ default:
16
+ return assertExhaustive(publication.category);
17
+ }
18
+ case "playerOriented":
19
+ switch (publication.category.kind) {
20
+ case "CoreRules":
21
+ case "ExpansionRules":
22
+ case "Sourcebook":
23
+ case "RegionalSourcebook":
24
+ return !publication.containsAdultContent;
25
+ case "Adventure":
26
+ return false;
27
+ default:
28
+ return assertExhaustive(publication.category);
29
+ }
30
+ case "playerOrientedWithAdult":
31
+ switch (publication.category.kind) {
32
+ case "CoreRules":
33
+ case "ExpansionRules":
34
+ case "Sourcebook":
35
+ case "RegionalSourcebook":
36
+ return true;
37
+ case "Adventure":
38
+ return false;
39
+ default:
40
+ return assertExhaustive(publication.category);
41
+ }
42
+ case "playerOrientedWithAdventures":
43
+ return !publication.containsAdultContent;
44
+ case "all":
45
+ return true;
46
+ default:
47
+ return assertExhaustive(publicationOptions.showPublicationGroups);
48
+ }
49
+ };
50
+ /**
51
+ *
52
+ */
53
+ export const isPublicationIncluded = (publicationOptions, publicationId, publication) => publicationOptions.publications.includes(publicationId) ||
54
+ isPublicationIncludedInGroup(publication, publicationOptions);
55
+ /**
56
+ *
57
+ */
58
+ export const isPublicationIncludedById = (getInstanceById, publicationOptions, publicationId) => {
59
+ const publication = getInstanceById("Publication", publicationId);
60
+ if (publication === undefined) {
61
+ return false;
62
+ }
63
+ return isPublicationIncluded(publicationOptions, publicationId, publication);
64
+ };