@optolith/database-schema 0.52.2 → 0.54.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 (120) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/gen/types.d.ts +265 -203
  3. package/lib/cache/activatableSelectOptions.js +28 -12
  4. package/lib/types/Advantage.d.ts +253 -253
  5. package/lib/types/Blessing.d.ts +10 -0
  6. package/lib/types/Cantrip.d.ts +10 -0
  7. package/lib/types/Ceremony.d.ts +294 -125
  8. package/lib/types/DerivedCharacteristic.d.ts +23 -23
  9. package/lib/types/Disadvantage.d.ts +230 -230
  10. package/lib/types/FamiliarsTrick.d.ts +40 -0
  11. package/lib/types/LiturgicalChant.d.ts +294 -125
  12. package/lib/types/Locale.d.ts +1 -0
  13. package/lib/types/Locale.js +1 -0
  14. package/lib/types/Profession.d.ts +330 -330
  15. package/lib/types/Ritual.d.ts +294 -125
  16. package/lib/types/Spell.d.ts +294 -125
  17. package/lib/types/Talisman.d.ts +10 -0
  18. package/lib/types/_Activatable.d.ts +1 -0
  19. package/lib/types/_Activatable.js +4 -0
  20. package/lib/types/_ActivatableAdventurePointsValue.d.ts +46 -46
  21. package/lib/types/_ActivatableAutomatic.d.ts +23 -23
  22. package/lib/types/_ActivatableCombat.d.ts +5 -1
  23. package/lib/types/_ActivatableCombat.js +13 -1
  24. package/lib/types/_ActivatableNonMundane.d.ts +128 -64
  25. package/lib/types/_ActivatableNonMundane.js +10 -67
  26. package/lib/types/_ActivatableSelectOptionCategory.d.ts +368 -368
  27. package/lib/types/_ActivatableSelectOptionCategory.js +19 -3
  28. package/lib/types/_ActivatableSelectOptions.d.ts +230 -230
  29. package/lib/types/_ActivatableSkill.d.ts +680 -284
  30. package/lib/types/_ActivatableSkillCastingTime.d.ts +30 -0
  31. package/lib/types/_ActivatableSkillCastingTime.js +20 -0
  32. package/lib/types/_ActivatableSkillCost.d.ts +288 -186
  33. package/lib/types/_ActivatableSkillCost.js +109 -110
  34. package/lib/types/_ActivatableSkillDuration.d.ts +70 -0
  35. package/lib/types/_ActivatableSkillDuration.js +44 -0
  36. package/lib/types/_ActivatableSkillParameterMap.d.ts +34 -0
  37. package/lib/types/_ActivatableSkillParameterMap.js +64 -0
  38. package/lib/types/_IdentifierGroup.d.ts +117 -92
  39. package/lib/types/_IdentifierGroup.js +37 -26
  40. package/lib/types/equipment/item/HerbalPreservation.d.ts +20 -0
  41. package/lib/types/magicalActions/AnimistPower.d.ts +50 -0
  42. package/lib/types/magicalActions/Bannzeichen.d.ts +53 -2
  43. package/lib/types/magicalActions/Bannzeichen.js +2 -4
  44. package/lib/types/magicalActions/Curse.d.ts +20 -0
  45. package/lib/types/magicalActions/DominationRitual.d.ts +20 -0
  46. package/lib/types/magicalActions/ElvenMagicalSong.d.ts +10 -0
  47. package/lib/types/magicalActions/GeodeRitual.d.ts +28 -13
  48. package/lib/types/magicalActions/GeodeRitual.js +2 -2
  49. package/lib/types/magicalActions/GoblinRitual.d.ts +20 -0
  50. package/lib/types/magicalActions/JesterTrick.d.ts +30 -0
  51. package/lib/types/magicalActions/MagicalMelody.d.ts +10 -0
  52. package/lib/types/magicalActions/MagicalRune.d.ts +20 -0
  53. package/lib/types/magicalActions/ZibiljaRitual.d.ts +92 -34
  54. package/lib/types/prerequisites/PrerequisiteGroups.d.ts +161 -161
  55. package/lib/types/prerequisites/single/ActivatablePrerequisite.d.ts +23 -23
  56. package/lib/types/prerequisites/single/PropertyPrerequisite.d.ts +16 -0
  57. package/lib/types/prerequisites/single/PropertyPrerequisite.js +16 -0
  58. package/lib/types/specialAbility/AdvancedCombatSpecialAbility.d.ts +230 -230
  59. package/lib/types/specialAbility/AdvancedCombatSpecialAbility.js +2 -2
  60. package/lib/types/specialAbility/AdvancedKarmaSpecialAbility.d.ts +230 -230
  61. package/lib/types/specialAbility/AdvancedMagicalSpecialAbility.d.ts +230 -230
  62. package/lib/types/specialAbility/AdvancedSkillSpecialAbility.d.ts +230 -230
  63. package/lib/types/specialAbility/AncestorGlyph.d.ts +230 -230
  64. package/lib/types/specialAbility/BlessedTradition.d.ts +230 -230
  65. package/lib/types/specialAbility/BrawlingSpecialAbility.d.ts +230 -230
  66. package/lib/types/specialAbility/BrawlingSpecialAbility.js +2 -2
  67. package/lib/types/specialAbility/CeremonialItemSpecialAbility.d.ts +230 -230
  68. package/lib/types/specialAbility/CombatSpecialAbility.d.ts +230 -230
  69. package/lib/types/specialAbility/CombatSpecialAbility.js +2 -2
  70. package/lib/types/specialAbility/CombatStyleSpecialAbility.d.ts +232 -233
  71. package/lib/types/specialAbility/CombatStyleSpecialAbility.js +2 -2
  72. package/lib/types/specialAbility/CommandSpecialAbility.d.ts +230 -230
  73. package/lib/types/specialAbility/CommandSpecialAbility.js +2 -2
  74. package/lib/types/specialAbility/FamiliarSpecialAbility.d.ts +230 -230
  75. package/lib/types/specialAbility/FatePointSexSpecialAbility.d.ts +230 -230
  76. package/lib/types/specialAbility/FatePointSpecialAbility.d.ts +230 -230
  77. package/lib/types/specialAbility/GeneralSpecialAbility.d.ts +230 -230
  78. package/lib/types/specialAbility/KarmaSpecialAbility.d.ts +230 -230
  79. package/lib/types/specialAbility/LiturgicalStyleSpecialAbility.d.ts +230 -230
  80. package/lib/types/specialAbility/LycantropicGift.d.ts +230 -230
  81. package/lib/types/specialAbility/MagicStyleSpecialAbility.d.ts +231 -230
  82. package/lib/types/specialAbility/MagicStyleSpecialAbility.js +2 -1
  83. package/lib/types/specialAbility/MagicalSign.d.ts +12 -13
  84. package/lib/types/specialAbility/MagicalSign.js +2 -2
  85. package/lib/types/specialAbility/MagicalSpecialAbility.d.ts +230 -230
  86. package/lib/types/specialAbility/MagicalTradition.d.ts +230 -230
  87. package/lib/types/specialAbility/PactGift.d.ts +253 -253
  88. package/lib/types/specialAbility/ProtectiveWardingCircleSpecialAbility.d.ts +230 -230
  89. package/lib/types/specialAbility/Sermon.d.ts +230 -230
  90. package/lib/types/specialAbility/SexSpecialAbility.d.ts +230 -230
  91. package/lib/types/specialAbility/SikaryanDrainSpecialAbility.d.ts +230 -230
  92. package/lib/types/specialAbility/SkillStyleSpecialAbility.d.ts +230 -230
  93. package/lib/types/specialAbility/VampiricGift.d.ts +230 -230
  94. package/lib/types/specialAbility/Vision.d.ts +230 -230
  95. package/lib/types/specialAbility/sub/TradeSecret.d.ts +207 -207
  96. package/lib/types/traditionArtifacts/ArcaneOrbEnchantment.d.ts +301 -270
  97. package/lib/types/traditionArtifacts/AttireEnchantment.d.ts +301 -270
  98. package/lib/types/traditionArtifacts/Beutelzauber.d.ts +301 -270
  99. package/lib/types/traditionArtifacts/BowlEnchantment.d.ts +301 -270
  100. package/lib/types/traditionArtifacts/CauldronEnchantment.d.ts +301 -270
  101. package/lib/types/traditionArtifacts/ChronicleEnchantment.d.ts +301 -270
  102. package/lib/types/traditionArtifacts/DaggerRitual.d.ts +301 -270
  103. package/lib/types/traditionArtifacts/FoolsHatEnchantment.d.ts +301 -270
  104. package/lib/types/traditionArtifacts/Haubenzauber.d.ts +301 -270
  105. package/lib/types/traditionArtifacts/Hauerkettenzauber.d.ts +94 -63
  106. package/lib/types/traditionArtifacts/InstrumentEnchantment.d.ts +301 -270
  107. package/lib/types/traditionArtifacts/Keulenzauber.d.ts +94 -63
  108. package/lib/types/traditionArtifacts/Krallenkettenzauber.d.ts +301 -270
  109. package/lib/types/traditionArtifacts/Kristallkugelzauber.d.ts +301 -270
  110. package/lib/types/traditionArtifacts/OrbEnchantment.d.ts +301 -270
  111. package/lib/types/traditionArtifacts/RingEnchantment.d.ts +301 -270
  112. package/lib/types/traditionArtifacts/Schweinetrommelzauber.d.ts +94 -63
  113. package/lib/types/traditionArtifacts/SickleRitual.d.ts +301 -270
  114. package/lib/types/traditionArtifacts/SpellSwordEnchantment.d.ts +301 -270
  115. package/lib/types/traditionArtifacts/StaffEnchantment.d.ts +301 -270
  116. package/lib/types/traditionArtifacts/ToyEnchantment.d.ts +301 -270
  117. package/lib/types/traditionArtifacts/Trinkhornzauber.d.ts +301 -270
  118. package/lib/types/traditionArtifacts/WandEnchantment.d.ts +287 -254
  119. package/lib/types/traditionArtifacts/WeaponEnchantment.d.ts +301 -270
  120. package/package.json +9 -9
@@ -5,12 +5,13 @@ import { compareNullish, compareNumber } from "@elyukai/utils/ordering";
5
5
  import { assertExhaustive } from "@elyukai/utils/typeSafety";
6
6
  import { Case, fromUniformCase } from "tsondb/schema/gen";
7
7
  const wrapPlainApValue = (apValue) => apValue === undefined ? undefined : Case("Fixed", apValue);
8
- const matchesSpecificSkillishIdList = (id, config) => {
8
+ const matchesSpecificSkillishIdList = (config, matches) => {
9
+ const isInList = config.list.some(matches);
9
10
  switch (config.operation.kind) {
10
11
  case "Intersection":
11
- return config.list.includes(id);
12
+ return isInList;
12
13
  case "Difference":
13
- return !config.list.includes(id);
14
+ return !isInList;
14
15
  default:
15
16
  return assertExhaustive(config.operation);
16
17
  }
@@ -112,9 +113,24 @@ const getDefaultSkillishFilter = (category) => {
112
113
  const { specific } = category;
113
114
  return specific === undefined
114
115
  ? undefined
115
- : ({ id }) => matchesSpecificSkillishIdList(id, specific);
116
+ : ({ id }) => matchesSpecificSkillishIdList(specific, required => required === id);
116
117
  };
117
- const getDerivedSkillishSelectOptions = (database, entryId, entity, category, options, filter = getDefaultSkillishFilter(category)) => {
118
+ const getSpellworkFilter = (category) => {
119
+ const { specific } = category;
120
+ return specific === undefined
121
+ ? undefined
122
+ : ({ id, content: { property } }) => matchesSpecificSkillishIdList(specific, required => {
123
+ switch (required.kind) {
124
+ case "Single":
125
+ return required.Single === id;
126
+ case "Property":
127
+ return property === required.Property;
128
+ default:
129
+ return assertExhaustive(required);
130
+ }
131
+ });
132
+ };
133
+ const getDerivedSkillishSelectOptions = (database, entryId, entity, category, options, filter) => {
118
134
  const { prerequisites } = category;
119
135
  const { bindingCost, ap_value } = options;
120
136
  const instances = database.getAllInstanceContainersOfEntity(entity);
@@ -625,17 +641,17 @@ const getDerivedSelectOptions = (selectOptionCategory, entryId, database, idMap)
625
641
  const matchesGroupRequirement = category.Skills.groups === undefined ||
626
642
  category.Skills.groups.some(ref => ref === content.group);
627
643
  const matchesIdRequirement = category.Skills.specific === undefined ||
628
- matchesSpecificSkillishIdList(id, category.Skills.specific);
644
+ matchesSpecificSkillishIdList(category.Skills.specific, required => required === id);
629
645
  return matchesGroupRequirement && matchesIdRequirement;
630
646
  });
631
647
  case "Spells":
632
- return getDerivedSkillishSelectOptions(database, entryId, "Spell", category.Spells, selectOptionCategory.Skills);
648
+ return getDerivedSkillishSelectOptions(database, entryId, "Spell", category.Spells, selectOptionCategory.Skills, getSpellworkFilter(category.Spells));
633
649
  case "Rituals":
634
- return getDerivedSkillishSelectOptions(database, entryId, "Ritual", category.Rituals, selectOptionCategory.Skills);
650
+ return getDerivedSkillishSelectOptions(database, entryId, "Ritual", category.Rituals, selectOptionCategory.Skills, getSpellworkFilter(category.Rituals));
635
651
  case "LiturgicalChants":
636
- return getDerivedSkillishSelectOptions(database, entryId, "LiturgicalChant", category.LiturgicalChants, selectOptionCategory.Skills);
652
+ return getDerivedSkillishSelectOptions(database, entryId, "LiturgicalChant", category.LiturgicalChants, selectOptionCategory.Skills, getDefaultSkillishFilter(category.LiturgicalChants));
637
653
  case "Ceremonies":
638
- return getDerivedSkillishSelectOptions(database, entryId, "Ceremony", category.Ceremonies, selectOptionCategory.Skills);
654
+ return getDerivedSkillishSelectOptions(database, entryId, "Ceremony", category.Ceremonies, selectOptionCategory.Skills, getDefaultSkillishFilter(category.Ceremonies));
639
655
  default:
640
656
  return assertExhaustive(category);
641
657
  }
@@ -644,9 +660,9 @@ const getDerivedSelectOptions = (selectOptionCategory, entryId, database, idMap)
644
660
  return selectOptionCategory.CombatTechniques.categories.flatMap(category => {
645
661
  switch (category.kind) {
646
662
  case "CloseCombatTechniques":
647
- return getDerivedSkillishSelectOptions(database, entryId, "CloseCombatTechnique", category.CloseCombatTechniques, selectOptionCategory.CombatTechniques);
663
+ return getDerivedSkillishSelectOptions(database, entryId, "CloseCombatTechnique", category.CloseCombatTechniques, selectOptionCategory.CombatTechniques, getDefaultSkillishFilter(category.CloseCombatTechniques));
648
664
  case "RangedCombatTechniques":
649
- return getDerivedSkillishSelectOptions(database, entryId, "RangedCombatTechnique", category.RangedCombatTechniques, selectOptionCategory.CombatTechniques);
665
+ return getDerivedSkillishSelectOptions(database, entryId, "RangedCombatTechnique", category.RangedCombatTechniques, selectOptionCategory.CombatTechniques, getDefaultSkillishFilter(category.RangedCombatTechniques));
650
666
  default:
651
667
  return assertExhaustive(category);
652
668
  }