@optolith/entity-descriptions 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/lib/creator.d.ts +32 -0
  3. package/lib/creator.js +72 -0
  4. package/lib/entities/activatable.d.ts +52 -0
  5. package/lib/entities/activatable.js +609 -0
  6. package/lib/entities/alternativeRule.d.ts +7 -0
  7. package/lib/entities/alternativeRule.js +21 -0
  8. package/lib/entities/attribute.d.ts +6 -0
  9. package/lib/entities/attribute.js +15 -0
  10. package/lib/entities/combatTechnique.d.ts +5 -7
  11. package/lib/entities/combatTechnique.js +34 -24
  12. package/lib/entities/condition.d.ts +12 -0
  13. package/lib/entities/condition.js +63 -0
  14. package/lib/entities/culture.d.ts +8 -0
  15. package/lib/entities/culture.js +309 -0
  16. package/lib/entities/curriculum.d.ts +11 -0
  17. package/lib/entities/curriculum.js +266 -0
  18. package/lib/entities/derivedCharacteristic.d.ts +9 -0
  19. package/lib/entities/derivedCharacteristic.js +91 -0
  20. package/lib/entities/disease.d.ts +9 -0
  21. package/lib/entities/disease.js +88 -0
  22. package/lib/entities/elixir.d.ts +10 -0
  23. package/lib/entities/elixir.js +76 -0
  24. package/lib/entities/equipment.d.ts +24 -0
  25. package/lib/entities/equipment.js +613 -0
  26. package/lib/entities/equipmentPackage.d.ts +8 -0
  27. package/lib/entities/equipmentPackage.js +301 -0
  28. package/lib/entities/experienceLevel.d.ts +3 -2
  29. package/lib/entities/experienceLevel.js +33 -28
  30. package/lib/entities/focusRule.d.ts +3 -4
  31. package/lib/entities/focusRule.js +13 -5
  32. package/lib/entities/influence.d.ts +7 -0
  33. package/lib/entities/influence.js +35 -0
  34. package/lib/entities/liturgicalChant.d.ts +10 -23
  35. package/lib/entities/liturgicalChant.js +169 -131
  36. package/lib/entities/optionalRule.d.ts +3 -2
  37. package/lib/entities/optionalRule.js +4 -3
  38. package/lib/entities/partial/activatableNameChunks.d.ts +58 -0
  39. package/lib/entities/partial/activatableNameChunks.js +356 -0
  40. package/lib/entities/partial/adventurePointsValue.d.ts +9 -0
  41. package/lib/entities/partial/adventurePointsValue.js +243 -0
  42. package/lib/entities/partial/animalTypes.d.ts +11 -0
  43. package/lib/entities/partial/animalTypes.js +13 -0
  44. package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +16 -0
  45. package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +40 -0
  46. package/lib/entities/partial/dice.d.ts +10 -0
  47. package/lib/entities/partial/dice.js +13 -0
  48. package/lib/entities/partial/herbary.d.ts +28 -0
  49. package/lib/entities/partial/herbary.js +65 -0
  50. package/lib/entities/partial/map.d.ts +49 -0
  51. package/lib/entities/partial/map.js +43 -0
  52. package/lib/entities/partial/mathOperation.d.ts +36 -0
  53. package/lib/entities/partial/mathOperation.js +107 -0
  54. package/lib/entities/partial/prerequisites/displayOption.d.ts +7 -0
  55. package/lib/entities/partial/prerequisites/displayOption.js +19 -0
  56. package/lib/entities/partial/prerequisites/index.d.ts +67 -0
  57. package/lib/entities/partial/prerequisites/index.js +189 -0
  58. package/lib/entities/partial/prerequisites/part.d.ts +26 -0
  59. package/lib/entities/partial/prerequisites/part.js +88 -0
  60. package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +65 -0
  61. package/lib/entities/partial/prerequisites/prerequisiteGroups.js +269 -0
  62. package/lib/entities/partial/prerequisites/single/activatable.d.ts +18 -0
  63. package/lib/entities/partial/prerequisites/single/activatable.js +40 -0
  64. package/lib/entities/partial/prerequisites/single/animistPower.d.ts +8 -0
  65. package/lib/entities/partial/prerequisites/single/animistPower.js +23 -0
  66. package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +7 -0
  67. package/lib/entities/partial/prerequisites/single/blessedTradition.js +32 -0
  68. package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +6 -0
  69. package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +19 -0
  70. package/lib/entities/partial/prerequisites/single/culture.d.ts +8 -0
  71. package/lib/entities/partial/prerequisites/single/culture.js +20 -0
  72. package/lib/entities/partial/prerequisites/single/enhancement.d.ts +8 -0
  73. package/lib/entities/partial/prerequisites/single/enhancement.js +41 -0
  74. package/lib/entities/partial/prerequisites/single/influence.d.ts +8 -0
  75. package/lib/entities/partial/prerequisites/single/influence.js +17 -0
  76. package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +7 -0
  77. package/lib/entities/partial/prerequisites/single/magicalTradition.js +27 -0
  78. package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +6 -0
  79. package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +8 -0
  80. package/lib/entities/partial/prerequisites/single/pact.d.ts +8 -0
  81. package/lib/entities/partial/prerequisites/single/pact.js +30 -0
  82. package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +8 -0
  83. package/lib/entities/partial/prerequisites/single/personalityTrait.js +28 -0
  84. package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +7 -0
  85. package/lib/entities/partial/prerequisites/single/primaryAttribute.js +15 -0
  86. package/lib/entities/partial/prerequisites/single/publication.d.ts +8 -0
  87. package/lib/entities/partial/prerequisites/single/publication.js +19 -0
  88. package/lib/entities/partial/prerequisites/single/race.d.ts +8 -0
  89. package/lib/entities/partial/prerequisites/single/race.js +20 -0
  90. package/lib/entities/partial/prerequisites/single/rated.d.ts +8 -0
  91. package/lib/entities/partial/prerequisites/single/rated.js +41 -0
  92. package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +8 -0
  93. package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +89 -0
  94. package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +8 -0
  95. package/lib/entities/partial/prerequisites/single/ratedSum.js +21 -0
  96. package/lib/entities/partial/prerequisites/single/rule.d.ts +7 -0
  97. package/lib/entities/partial/prerequisites/single/rule.js +4 -0
  98. package/lib/entities/partial/prerequisites/single/sex.d.ts +7 -0
  99. package/lib/entities/partial/prerequisites/single/sex.js +19 -0
  100. package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +7 -0
  101. package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +21 -0
  102. package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +8 -0
  103. package/lib/entities/partial/prerequisites/single/socialStatus.js +21 -0
  104. package/lib/entities/partial/prerequisites/single/state.d.ts +8 -0
  105. package/lib/entities/partial/prerequisites/single/state.js +20 -0
  106. package/lib/entities/partial/prerequisites/single/text.d.ts +7 -0
  107. package/lib/entities/partial/prerequisites/single/text.js +9 -0
  108. package/lib/entities/partial/professions.d.ts +15 -0
  109. package/lib/entities/partial/professions.js +19 -0
  110. package/lib/entities/partial/rated/activatable/castingTime.d.ts +16 -7
  111. package/lib/entities/partial/rated/activatable/castingTime.js +35 -20
  112. package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +18 -3
  113. package/lib/entities/partial/rated/activatable/checkResultBased.js +18 -10
  114. package/lib/entities/partial/rated/activatable/cost.d.ts +88 -8
  115. package/lib/entities/partial/rated/activatable/cost.js +183 -115
  116. package/lib/entities/partial/rated/activatable/duration.d.ts +36 -13
  117. package/lib/entities/partial/rated/activatable/duration.js +72 -61
  118. package/lib/entities/partial/rated/activatable/effect.d.ts +4 -4
  119. package/lib/entities/partial/rated/activatable/effect.js +32 -25
  120. package/lib/entities/partial/rated/activatable/index.d.ts +31 -27
  121. package/lib/entities/partial/rated/activatable/index.js +63 -28
  122. package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +5 -6
  123. package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +8 -5
  124. package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +2 -4
  125. package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +7 -42
  126. package/lib/entities/partial/rated/activatable/range.d.ts +22 -14
  127. package/lib/entities/partial/rated/activatable/range.js +54 -54
  128. package/lib/entities/partial/rated/activatable/speed.d.ts +11 -2
  129. package/lib/entities/partial/rated/activatable/speed.js +14 -1
  130. package/lib/entities/partial/rated/activatable/targetCategory.d.ts +4 -5
  131. package/lib/entities/partial/rated/activatable/targetCategory.js +19 -24
  132. package/lib/entities/partial/rated/improvementCost.d.ts +16 -4
  133. package/lib/entities/partial/rated/improvementCost.js +63 -4
  134. package/lib/entities/partial/rated/skillCheck.d.ts +20 -17
  135. package/lib/entities/partial/rated/skillCheck.js +56 -54
  136. package/lib/entities/partial/reader.d.ts +266 -0
  137. package/lib/entities/partial/reader.js +175 -0
  138. package/lib/entities/partial/responsiveText.d.ts +10 -5
  139. package/lib/entities/partial/responsiveText.js +19 -3
  140. package/lib/entities/partial/units/energy.d.ts +5 -8
  141. package/lib/entities/partial/units/energy.js +5 -23
  142. package/lib/entities/partial/units/length.d.ts +20 -2
  143. package/lib/entities/partial/units/length.js +24 -5
  144. package/lib/entities/partial/units/timeSpan.d.ts +25 -4
  145. package/lib/entities/partial/units/timeSpan.js +27 -15
  146. package/lib/entities/partial/unknown.d.ts +5 -1
  147. package/lib/entities/partial/unknown.js +5 -1
  148. package/lib/entities/personalityTrait.d.ts +7 -0
  149. package/lib/entities/personalityTrait.js +56 -0
  150. package/lib/entities/poison.d.ts +12 -0
  151. package/lib/entities/poison.js +356 -0
  152. package/lib/entities/profession.d.ts +12 -0
  153. package/lib/entities/profession.js +585 -0
  154. package/lib/entities/race.d.ts +9 -0
  155. package/lib/entities/race.js +146 -0
  156. package/lib/entities/sexPractice.d.ts +6 -0
  157. package/lib/entities/sexPractice.js +33 -0
  158. package/lib/entities/skill.d.ts +9 -9
  159. package/lib/entities/skill.js +124 -91
  160. package/lib/entities/spell.d.ts +83 -26
  161. package/lib/entities/spell.js +835 -147
  162. package/lib/entities/state.d.ts +6 -0
  163. package/lib/entities/state.js +17 -0
  164. package/lib/helpers/enums.d.ts +11 -0
  165. package/lib/helpers/enums.js +6 -0
  166. package/lib/helpers/getTypes.d.ts +12 -482
  167. package/lib/helpers/getTypes.js +1 -0
  168. package/lib/helpers/identifiers.d.ts +314 -0
  169. package/lib/helpers/identifiers.js +333 -0
  170. package/lib/helpers/locale.d.ts +21 -2
  171. package/lib/helpers/translate.d.ts +47 -5
  172. package/lib/helpers/translate.js +13 -6
  173. package/lib/index.d.ts +848 -21
  174. package/lib/index.js +182 -17
  175. package/lib/references/index.d.ts +6 -3
  176. package/lib/references/index.js +25 -33
  177. package/lib/references/page.d.ts +1 -1
  178. package/lib/references/page.js +14 -14
  179. package/lib/references/pageRange.d.ts +1 -5
  180. package/lib/references/pageRange.js +7 -16
  181. package/lib/tsconfig.tsbuildinfo +1 -0
  182. package/package.json +30 -10
  183. package/.prettierrc.yml +0 -1
  184. package/lib/entities/partial/rated/activatable/entity.d.ts +0 -11
  185. package/lib/entities/partial/rated/activatable/entity.js +0 -12
  186. package/lib/references/occurrence.d.ts +0 -4
  187. package/lib/references/occurrence.js +0 -3
@@ -1,36 +1,43 @@
1
- import { filterNonNullable } from "@optolith/helpers/array";
2
1
  import { mapNullable } from "@optolith/helpers/nullable";
3
2
  import { assertExhaustive } from "@optolith/helpers/typeSafety";
4
- const getContentPartsForQualityLevels = (getQualityLevelString, locale, source) => filterNonNullable([
5
- {
6
- label: locale.translate("Effect"),
7
- value: source.text_before,
8
- },
9
- ...source.quality_levels.map((text, index) => ({
10
- value: text,
11
- label: locale.translate("QL {0}", getQualityLevelString(index)),
12
- })),
13
- mapNullable(source.text_after, (textAfter) => ({
14
- value: textAfter,
15
- className: "effect-after",
16
- })),
17
- ]);
3
+ import { translateFnR } from "../../reader.js";
4
+ const getContentPartsForQualityLevels = (getQualityLevelString, source) => translateFnR.map((translate) => ({
5
+ label: translate("Effect"),
6
+ value: [
7
+ {
8
+ type: "plain",
9
+ text: source.text_before,
10
+ },
11
+ {
12
+ type: "definitionList",
13
+ style: "hidden",
14
+ items: source.quality_levels.map((text, index) => ({
15
+ label: translate("QL {$value}", {
16
+ value: getQualityLevelString(index),
17
+ }),
18
+ value: text,
19
+ })),
20
+ },
21
+ mapNullable(source.text_after, textAfter => ({
22
+ type: "plain",
23
+ text: textAfter,
24
+ })),
25
+ ],
26
+ }));
18
27
  /**
19
28
  * Gets the text for the effect of an activatable skill.
20
29
  */
21
- export const getTextForEffect = (locale, effect) => {
22
- switch (effect.tag) {
30
+ export const renderEffect = (effect) => {
31
+ switch (effect.kind) {
23
32
  case "Plain":
24
- return [
25
- {
26
- label: locale.translate("Effect"),
27
- value: effect.plain.text,
28
- },
29
- ];
33
+ return translateFnR.map(translate => ({
34
+ label: translate("Effect"),
35
+ value: effect.Plain.text,
36
+ }));
30
37
  case "ForEachQualityLevel":
31
- return getContentPartsForQualityLevels((index) => index + 1, locale, effect.for_each_quality_level);
38
+ return getContentPartsForQualityLevels(index => index + 1, effect.ForEachQualityLevel);
32
39
  case "ForEachTwoQualityLevels":
33
- return getContentPartsForQualityLevels((index) => `${index * 2 + 1}–${index * 2 + 2}`, locale, effect.for_each_two_quality_levels);
40
+ return getContentPartsForQualityLevels(index => `${index * 2 + 1}–${index * 2 + 2}`, effect.ForEachTwoQualityLevels);
34
41
  default:
35
42
  return assertExhaustive(effect);
36
43
  }
@@ -1,41 +1,45 @@
1
- import { FastOneTimePerformanceParameters, FastSustainedPerformanceParameters, SlowOneTimePerformanceParameters, SlowSustainedPerformanceParameters } from "optolith-database-schema/types/_ActivatableSkill";
2
- import { GetById } from "../../../../helpers/getTypes.js";
3
- import { LocaleEnvironment } from "../../../../helpers/locale.js";
4
- import { ResponsiveTextSize } from "../../responsiveText.js";
5
- import { Entity } from "./entity.js";
6
- /**
7
- * Get the texts for all fast one-time performance parameters.
8
- */
9
- export declare const getFastOneTimePerformanceParametersTranslations: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: FastOneTimePerformanceParameters) => {
1
+ import type { FastOneTimePerformanceParameters, FastSustainedPerformanceParameters, OneTimePerformanceParameters, SlowOneTimePerformanceParameters, SlowSustainedPerformanceParameters } from "optolith-database-schema/gen";
2
+ import type { StdReader } from "../../reader.js";
3
+ type RenderedPerformanceParameters = {
10
4
  castingTime: string;
11
5
  cost: string;
12
6
  range: string;
13
7
  duration: string;
14
8
  };
9
+ /**
10
+ * Get the texts for all fast one-time performance parameters.
11
+ */
12
+ export declare const renderFastOneTimePerformanceParameters: (value: FastOneTimePerformanceParameters) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
15
13
  /**
16
14
  * Get the texts for all fast sustained performance parameters.
17
15
  */
18
- export declare const getFastSustainedPerformanceParametersTranslations: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: FastSustainedPerformanceParameters) => {
19
- castingTime: string;
20
- cost: string;
21
- range: string;
22
- duration: string;
23
- };
16
+ export declare const renderFastSustainedPerformanceParameters: (value: FastSustainedPerformanceParameters) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
17
+ /**
18
+ * Renders the performance parameters for a fast activatable skill.
19
+ */
20
+ export declare const renderFastPerformanceParameters: (value: {
21
+ kind: "OneTime";
22
+ OneTime: FastOneTimePerformanceParameters;
23
+ } | {
24
+ kind: "Sustained";
25
+ Sustained: FastSustainedPerformanceParameters;
26
+ }) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
24
27
  /**
25
28
  * Get the texts for all slow one-time performance parameters.
26
29
  */
27
- export declare const getSlowOneTimePerformanceParametersTranslations: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SlowOneTimePerformanceParameters) => {
28
- castingTime: string;
29
- cost: string;
30
- range: string;
31
- duration: string;
32
- };
30
+ export declare const renderSlowOneTimePerformanceParameters: <CastingTime>(renderCastingTime: (value: CastingTime) => StdReader<string, "t" | "rts" | "nms" | "ibi", "SkillModificationLevel">, value: OneTimePerformanceParameters<CastingTime>) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
33
31
  /**
34
32
  * Get the texts for all slow sustained performance parameters.
35
33
  */
36
- export declare const getSlowSustainedPerformanceParametersTranslations: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SlowSustainedPerformanceParameters) => {
37
- castingTime: string;
38
- cost: string;
39
- range: string;
40
- duration: string;
41
- };
34
+ export declare const renderSlowSustainedPerformanceParameters: (value: SlowSustainedPerformanceParameters) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
35
+ /**
36
+ * Renders the performance parameters for a slow activatable skill.
37
+ */
38
+ export declare const renderSlowPerformanceParameters: (value: {
39
+ kind: "OneTime";
40
+ OneTime: SlowOneTimePerformanceParameters;
41
+ } | {
42
+ kind: "Sustained";
43
+ Sustained: SlowSustainedPerformanceParameters;
44
+ }) => StdReader<RenderedPerformanceParameters, "t" | "tm" | "lj" | "eu" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
45
+ export {};
@@ -1,41 +1,76 @@
1
- import { getFastCastingTimeTranslation, getSlowCastingTimeTranslation, } from "./castingTime.js";
2
- import { getOneTimeCostTranslation, getSustainedCostTranslation, } from "./cost.js";
3
- import { getDurationForOneTimeTranslation, getDurationForSustainedTranslation, } from "./duration.js";
4
- import { getTextForActivatableSkillRange } from "./range.js";
1
+ import { assertExhaustive } from "@elyukai/utils/typeSafety";
2
+ import { renderFastCastingTime, renderSlowCastingTime } from "./castingTime.js";
3
+ import { renderOneTimeCost, renderSustainedCost } from "./cost.js";
4
+ import { renderOneTimeDuration, renderSustainedDuration } from "./duration.js";
5
+ import { renderRange } from "./range.js";
5
6
  import { Speed } from "./speed.js";
6
7
  /**
7
8
  * Get the texts for all fast one-time performance parameters.
8
9
  */
9
- export const getFastOneTimePerformanceParametersTranslations = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => ({
10
- castingTime: getFastCastingTimeTranslation(getSkillModificationLevelById, locale, entity, responsiveTextSize, value.casting_time),
11
- cost: getOneTimeCostTranslation(getSkillModificationLevelById, locale, Speed.Fast, entity, responsiveTextSize, value.cost),
12
- range: getTextForActivatableSkillRange(getSkillModificationLevelById, locale, Speed.Fast, responsiveTextSize, entity, value.range),
13
- duration: getDurationForOneTimeTranslation(locale, responsiveTextSize, value.duration),
14
- });
10
+ export const renderFastOneTimePerformanceParameters = (value) => renderFastCastingTime(value.casting_time)
11
+ .thenW(castingTime => renderOneTimeCost(value.cost).then(cost => renderRange(value.range).then(range => renderOneTimeDuration(value.duration).map(duration => ({
12
+ castingTime,
13
+ cost,
14
+ range,
15
+ duration,
16
+ })))))
17
+ .with(env => ({ ...env, speed: Speed.Fast }));
15
18
  /**
16
19
  * Get the texts for all fast sustained performance parameters.
17
20
  */
18
- export const getFastSustainedPerformanceParametersTranslations = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => ({
19
- castingTime: getFastCastingTimeTranslation(getSkillModificationLevelById, locale, entity, responsiveTextSize, value.casting_time),
20
- cost: getSustainedCostTranslation(getSkillModificationLevelById, locale, Speed.Fast, entity, responsiveTextSize, value.cost),
21
- range: getTextForActivatableSkillRange(getSkillModificationLevelById, locale, Speed.Fast, responsiveTextSize, entity, value.range),
22
- duration: getDurationForSustainedTranslation(locale, responsiveTextSize, value.duration),
23
- });
21
+ export const renderFastSustainedPerformanceParameters = (value) => renderFastCastingTime(value.casting_time)
22
+ .thenW(castingTime => renderSustainedCost(value.cost).then(cost => renderRange(value.range).then(range => renderSustainedDuration(value.duration).map(duration => ({
23
+ castingTime,
24
+ cost,
25
+ range,
26
+ duration,
27
+ })))))
28
+ .with(env => ({ ...env, speed: Speed.Fast }));
29
+ /**
30
+ * Renders the performance parameters for a fast activatable skill.
31
+ */
32
+ export const renderFastPerformanceParameters = (value) => {
33
+ switch (value.kind) {
34
+ case "OneTime":
35
+ return renderFastOneTimePerformanceParameters(value.OneTime);
36
+ case "Sustained":
37
+ return renderFastSustainedPerformanceParameters(value.Sustained);
38
+ default:
39
+ return assertExhaustive(value);
40
+ }
41
+ };
24
42
  /**
25
43
  * Get the texts for all slow one-time performance parameters.
26
44
  */
27
- export const getSlowOneTimePerformanceParametersTranslations = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => ({
28
- castingTime: getSlowCastingTimeTranslation(getSkillModificationLevelById, locale, entity, responsiveTextSize, value.casting_time),
29
- cost: getOneTimeCostTranslation(getSkillModificationLevelById, locale, Speed.Slow, entity, responsiveTextSize, value.cost),
30
- range: getTextForActivatableSkillRange(getSkillModificationLevelById, locale, Speed.Slow, responsiveTextSize, entity, value.range),
31
- duration: getDurationForOneTimeTranslation(locale, responsiveTextSize, value.duration),
32
- });
45
+ export const renderSlowOneTimePerformanceParameters = (renderCastingTime, value) => renderCastingTime(value.casting_time)
46
+ .thenW(castingTime => renderOneTimeCost(value.cost).then(cost => renderRange(value.range).then(range => renderOneTimeDuration(value.duration).map(duration => ({
47
+ castingTime,
48
+ cost,
49
+ range,
50
+ duration,
51
+ })))))
52
+ .with(env => ({ ...env, speed: Speed.Slow }));
33
53
  /**
34
54
  * Get the texts for all slow sustained performance parameters.
35
55
  */
36
- export const getSlowSustainedPerformanceParametersTranslations = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => ({
37
- castingTime: getSlowCastingTimeTranslation(getSkillModificationLevelById, locale, entity, responsiveTextSize, value.casting_time),
38
- cost: getSustainedCostTranslation(getSkillModificationLevelById, locale, Speed.Slow, entity, responsiveTextSize, value.cost),
39
- range: getTextForActivatableSkillRange(getSkillModificationLevelById, locale, Speed.Slow, responsiveTextSize, entity, value.range),
40
- duration: getDurationForSustainedTranslation(locale, responsiveTextSize, value.duration),
41
- });
56
+ export const renderSlowSustainedPerformanceParameters = (value) => renderSlowCastingTime(value.casting_time)
57
+ .thenW(castingTime => renderSustainedCost(value.cost).then(cost => renderRange(value.range).then(range => renderSustainedDuration(value.duration).map(duration => ({
58
+ castingTime,
59
+ cost,
60
+ range,
61
+ duration,
62
+ })))))
63
+ .with(env => ({ ...env, speed: Speed.Slow }));
64
+ /**
65
+ * Renders the performance parameters for a slow activatable skill.
66
+ */
67
+ export const renderSlowPerformanceParameters = (value) => {
68
+ switch (value.kind) {
69
+ case "OneTime":
70
+ return renderSlowOneTimePerformanceParameters(renderSlowCastingTime, value.OneTime);
71
+ case "Sustained":
72
+ return renderSlowSustainedPerformanceParameters(value.Sustained);
73
+ default:
74
+ return assertExhaustive(value);
75
+ }
76
+ };
@@ -1,20 +1,19 @@
1
- import { LocaleEnvironment } from "../../../../helpers/locale.js";
2
- import { ResponsiveTextSize } from "../../responsiveText.js";
1
+ import { type StdReader } from "../../reader.js";
3
2
  /**
4
3
  * Wraps the text in a translation that indicates it’s a minimum value.
5
4
  */
6
- export declare const wrapAsMinimum: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, text: string) => string;
5
+ export declare const wrapAsMinimum: (text: string) => StdReader<string, "t" | "rts">;
7
6
  /**
8
7
  * Wraps the text in a translation that indicates it’s a minimum value if the
9
8
  * `is_minimum` property says it’s a minimum value.
10
9
  */
11
- export declare const wrapIfMinimum: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, is_minimum: boolean | undefined, text: string) => string;
10
+ export declare const wrapIfMinimum: (is_minimum: boolean | undefined, text: string) => StdReader<string, "t" | "rts">;
12
11
  /**
13
12
  * Wraps the text in a translation that indicates it’s a maximum value.
14
13
  */
15
- export declare const wrapAsMaximum: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, text: string) => string;
14
+ export declare const wrapAsMaximum: (text: string) => StdReader<string, "t" | "rts">;
16
15
  /**
17
16
  * Wraps the text in a translation that indicates it’s a maximum value if the
18
17
  * `is_maximum` property says it’s a maximum value.
19
18
  */
20
- export declare const wrapIfMaximum: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, is_maximum: boolean | undefined, text: string) => string;
19
+ export declare const wrapIfMaximum: (is_maximum: boolean | undefined, text: string) => StdReader<string, "t" | "rts">;
@@ -1,19 +1,22 @@
1
- import { responsive } from "../../responsiveText.js";
1
+ import { Reader } from "@elyukai/utils/reader";
2
+ import { responsiveTranslateR } from "../../reader.js";
2
3
  /**
3
4
  * Wraps the text in a translation that indicates it’s a minimum value.
4
5
  */
5
- export const wrapAsMinimum = (locale, responsiveTextSize, text) => responsive(responsiveTextSize, () => locale.translate("at least {0}", text), () => locale.translate("min. {0}", text));
6
+ export const wrapAsMinimum = (text) => responsiveTranslateR("at least {$value}", "min. {$value}", { value: text });
6
7
  /**
7
8
  * Wraps the text in a translation that indicates it’s a minimum value if the
8
9
  * `is_minimum` property says it’s a minimum value.
9
10
  */
10
- export const wrapIfMinimum = (locale, responsiveTextSize, is_minimum, text) => is_minimum === true ? wrapAsMinimum(locale, responsiveTextSize, text) : "";
11
+ export const wrapIfMinimum = (is_minimum, text) => is_minimum === true ? wrapAsMinimum(text) : Reader.of("");
11
12
  /**
12
13
  * Wraps the text in a translation that indicates it’s a maximum value.
13
14
  */
14
- export const wrapAsMaximum = (locale, responsiveTextSize, text) => responsive(responsiveTextSize, () => locale.translate("no more than {0}", text), () => locale.translate("max. {0}", text));
15
+ export const wrapAsMaximum = (text) => responsiveTranslateR("no more than {$value}", "max. {$value}", {
16
+ value: text,
17
+ });
15
18
  /**
16
19
  * Wraps the text in a translation that indicates it’s a maximum value if the
17
20
  * `is_maximum` property says it’s a maximum value.
18
21
  */
19
- export const wrapIfMaximum = (locale, responsiveTextSize, is_maximum, text) => is_maximum === true ? wrapAsMaximum(locale, responsiveTextSize, text) : "";
22
+ export const wrapIfMaximum = (is_maximum, text) => is_maximum === true ? wrapAsMaximum(text) : Reader.of("");
@@ -1,6 +1,4 @@
1
- import { LocaleEnvironment } from "../../../../helpers/locale.js";
2
- import { ResponsiveTextSize } from "../../responsiveText.js";
3
- import { Entity } from "./entity.js";
1
+ import { type StdReader } from "../../reader.js";
4
2
  /**
5
3
  * A parameter that is designed to be modifiable.
6
4
  */
@@ -13,4 +11,4 @@ export declare enum ModifiableParameter {
13
11
  * Returns the suffix for the text of a non-modifiable parameter that indicates
14
12
  * that the parameter cannot be modified.
15
13
  */
16
- export declare const getNonModifiableSuffixTranslation: (locale: LocaleEnvironment, entity: Entity, param: ModifiableParameter, responsiveTextSize: ResponsiveTextSize) => string;
14
+ export declare const appendNonModifiableSuffix: (param: ModifiableParameter, base: string) => StdReader<string, "t" | "rts" | "nms">;
@@ -1,7 +1,5 @@
1
- import { mapNullable } from "@optolith/helpers/nullable";
2
- import { assertExhaustive } from "@optolith/helpers/typeSafety";
3
- import { responsive } from "../../responsiveText.js";
4
- import { Entity } from "./entity.js";
1
+ import { Reader } from "@elyukai/utils/reader";
2
+ import { responsiveTranslateR, } from "../../reader.js";
5
3
  /**
6
4
  * A parameter that is designed to be modifiable.
7
5
  */
@@ -11,45 +9,12 @@ export var ModifiableParameter;
11
9
  ModifiableParameter[ModifiableParameter["Cost"] = 1] = "Cost";
12
10
  ModifiableParameter[ModifiableParameter["Range"] = 2] = "Range";
13
11
  })(ModifiableParameter || (ModifiableParameter = {}));
14
- const translationKeyForNonModifiableSuffix = {
15
- [Entity.Spell]: {
16
- [ModifiableParameter.CastingTime]: " (you cannot use a modification on this spell’s casting time)",
17
- [ModifiableParameter.Cost]: " (you cannot use a modification on this spell’s cost)",
18
- [ModifiableParameter.Range]: " (you cannot use a modification on this spell’s range)",
19
- },
20
- [Entity.Ritual]: {
21
- [ModifiableParameter.CastingTime]: " (you cannot use a modification on this ritual’s ritual time)",
22
- [ModifiableParameter.Cost]: " (you cannot use a modification on this ritual’s cost)",
23
- [ModifiableParameter.Range]: " (you cannot use a modification on this ritual’s range)",
24
- },
25
- [Entity.LiturgicalChant]: {
26
- [ModifiableParameter.CastingTime]: " (you cannot use a modification on this chant’s liturgical time)",
27
- [ModifiableParameter.Cost]: " (you cannot use a modification on this chant’s cost)",
28
- [ModifiableParameter.Range]: " (you cannot use a modification on this chant’s range)",
29
- },
30
- [Entity.Ceremony]: {
31
- [ModifiableParameter.CastingTime]: " (you cannot use a modification on this ceremony’s ceremonial time)",
32
- [ModifiableParameter.Cost]: " (you cannot use a modification on this ceremony’s cost)",
33
- [ModifiableParameter.Range]: " (you cannot use a modification on this ceremony’s range)",
34
- },
35
- [Entity.Cantrip]: undefined,
36
- [Entity.Blessing]: undefined,
37
- };
38
12
  /**
39
13
  * Returns the suffix for the text of a non-modifiable parameter that indicates
40
14
  * that the parameter cannot be modified.
41
15
  */
42
- export const getNonModifiableSuffixTranslation = (locale, entity, param, responsiveTextSize) => responsive(responsiveTextSize, () => mapNullable(translationKeyForNonModifiableSuffix[entity]?.[param], (key) => locale.translate(key)) ?? "", () => {
43
- switch (entity) {
44
- case Entity.Spell:
45
- case Entity.Ritual:
46
- case Entity.LiturgicalChant:
47
- case Entity.Ceremony:
48
- return locale.translate(" (cannot modify)");
49
- case Entity.Cantrip:
50
- case Entity.Blessing:
51
- return "";
52
- default:
53
- return assertExhaustive(entity);
54
- }
55
- });
16
+ export const appendNonModifiableSuffix = (param, base) => Reader.asks((ctx) => ctx.nonModifiableSuffix)
17
+ .thenW(suffix => suffix === undefined
18
+ ? Reader.of("")
19
+ : responsiveTranslateR(suffix(param), " (cannot modify)"))
20
+ .map(suffix => base + suffix);
@@ -1,20 +1,28 @@
1
- import { Range } from "optolith-database-schema/types/_ActivatableSkillRange";
2
- import { BlessingRange } from "optolith-database-schema/types/Blessing";
3
- import { CantripRange } from "optolith-database-schema/types/Cantrip";
4
- import { GetById } from "../../../../helpers/getTypes.js";
5
- import { LocaleEnvironment } from "../../../../helpers/locale.js";
6
- import { ResponsiveTextSize } from "../../responsiveText.js";
7
- import { Entity } from "./entity.js";
8
- import { Speed } from "./speed.js";
1
+ import type { CheckResultBasedRange, FixedRange, Range, RangeValue } from "optolith-database-schema/gen";
2
+ import { type StdReader } from "../../reader.js";
9
3
  /**
10
- * Returns the text for the range of an activatable skill.
4
+ * Returns the text for the non-modifiable range of an activatable skill.
11
5
  */
12
- export declare const getTextForActivatableSkillRange: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, speed: Speed, responsiveTextSize: ResponsiveTextSize, entity: Entity, value: Range) => string;
6
+ export declare const renderNonModifiableRange: (value: {
7
+ kind: "Sight";
8
+ } | {
9
+ kind: "Self";
10
+ } | {
11
+ kind: "Global";
12
+ } | {
13
+ kind: "Touch";
14
+ } | {
15
+ kind: "Fixed";
16
+ Fixed: FixedRange;
17
+ } | {
18
+ kind: "CheckResultBased";
19
+ CheckResultBased: CheckResultBasedRange;
20
+ }, shouldAppendNonModifiableSuffix: boolean) => StdReader<string, "t" | "tm" | "rts" | "nms">;
13
21
  /**
14
- * Returns the text for the range of a cantrip.
22
+ * Returns the text for the range of an activatable skill.
15
23
  */
16
- export declare const getTextForCantripRange: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, value: CantripRange) => string;
24
+ export declare const renderRangeValue: (value: RangeValue, shouldAppendNonModifiableSuffix: boolean) => StdReader<string, "t" | "tm" | "rts" | "s" | "nms" | "ibi", "SkillModificationLevel">;
17
25
  /**
18
- * Returns the text for the range of a blessing.
26
+ * Returns the text for the range of an activatable skill.
19
27
  */
20
- export declare const getTextForBlessingRange: (locale: LocaleEnvironment, responsiveTextSize: ResponsiveTextSize, value: BlessingRange) => string;
28
+ export declare const renderRange: (value: Range) => StdReader<string, "t" | "tm" | "rts" | "s" | "nms" | "ibi", "SkillModificationLevel">;
@@ -1,52 +1,56 @@
1
+ import { Reader } from "@elyukai/utils/reader";
1
2
  import { mapNullable } from "@optolith/helpers/nullable";
2
3
  import { assertExhaustive } from "@optolith/helpers/typeSafety";
3
- import { appendNoteIfRequested, replaceTextIfRequested, } from "../../responsiveText.js";
4
- import { formatLength } from "../../units/length.js";
4
+ import { getInstanceByIdFnR, modifiableBySpeedOptionalR, modifiableBySpeedR, translateFnR, translateMapR, translateR, } from "../../reader.js";
5
+ import { appendNoteIfNeeded, replaceTextIfNeeded, } from "../../responsiveText.js";
6
+ import { formatCombinedLengthR, formatLengthR } from "../../units/length.js";
5
7
  import { MISSING_VALUE } from "../../unknown.js";
6
- import { getCheckResultBasedValueTranslation } from "./checkResultBased.js";
7
- import { Entity } from "./entity.js";
8
+ import { renderCheckResultBasedValue } from "./checkResultBased.js";
8
9
  import { wrapIfMaximum } from "./isMinimumMaximum.js";
9
- import { getNonModifiableSuffixTranslation, ModifiableParameter, } from "./nonModifiableSuffix.js";
10
- import { getModifiableBySpeed } from "./speed.js";
11
- const getModifiableRangeTranslation = (getSkillModificationLevelById, locale, speed, responsiveTextSize, value) => mapNullable(getSkillModificationLevelById(value.initial_modification_level), (modificationLevel) => {
12
- const range = getModifiableBySpeed((config) => config.range, (config) => config.range, speed, modificationLevel);
13
- if (range === 1) {
14
- return locale.translate("Touch");
15
- }
16
- return formatLength(locale, responsiveTextSize, "Steps", range);
17
- }) ?? MISSING_VALUE;
18
- const getSightTranslation = (locale) => locale.translate("Sight");
19
- const getSelfTranslation = (locale) => locale.translate("Self");
20
- const getGlobalTranslation = (locale) => locale.translate("Global");
21
- const getTouchTranslation = (locale, entity, responsiveTextSize) => locale.translate("Touch") +
22
- getNonModifiableSuffixTranslation(locale, entity, ModifiableParameter.Range, responsiveTextSize);
23
- const getFixedRangeTranslation = (locale, entity, responsiveTextSize, value) => formatLength(locale, responsiveTextSize, value.unit, value.value) +
24
- getNonModifiableSuffixTranslation(locale, entity, ModifiableParameter.Range, responsiveTextSize);
25
- const wrapIfRadius = (locale, is_radius, text) => (is_radius === true ? `${text} ${locale.translate("Radius")}` : text);
26
- const getCheckResultBasedRangeTranslation = (locale, entity, responsiveTextSize, value) => {
27
- const range = formatLength(locale, responsiveTextSize, value.unit, getCheckResultBasedValueTranslation(locale.translate, value));
28
- const rangeWrappedIfRadius = wrapIfRadius(locale, value.is_radius, range);
29
- const rangeWrappedIfRadiusAndIfMaximum = wrapIfMaximum(locale, responsiveTextSize, value.is_maximum, rangeWrappedIfRadius);
30
- return (rangeWrappedIfRadiusAndIfMaximum +
31
- getNonModifiableSuffixTranslation(locale, entity, ModifiableParameter.Range, responsiveTextSize));
32
- };
33
- const getRangeValueTranslation = (getSkillModificationLevelById, locale, speed, responsiveTextSize, entity, value) => {
34
- switch (value.tag) {
35
- case "Modifiable":
36
- return getModifiableRangeTranslation(getSkillModificationLevelById, locale, speed, responsiveTextSize, value.modifiable);
10
+ import { appendNonModifiableSuffix, ModifiableParameter, } from "./nonModifiableSuffix.js";
11
+ const deriveModifiableRange = (modificationLevelId) => getInstanceByIdFnR().thenW(getInstanceById => mapNullable(getInstanceById("SkillModificationLevel", modificationLevelId), modificationLevel => modifiableBySpeedR("range", modificationLevel).thenW(value => translateMapR(modificationLevel.translations).thenW(translation => translation === undefined
12
+ ? Reader.of({ value, translation: undefined })
13
+ : modifiableBySpeedOptionalR("range", translation).map(valueTranslation => ({
14
+ value,
15
+ translation: valueTranslation,
16
+ }))))) ?? Reader.of(undefined));
17
+ const wrapIfRadius = (is_radius, text) => translateFnR.map(translate => is_radius === true ? `${text} ${translate("Radius")}` : text);
18
+ const renderModifiableRange = (value) => deriveModifiableRange(value.initial_modification_level)
19
+ .thenW(range => range === undefined
20
+ ? Reader.of(MISSING_VALUE)
21
+ : typeof range === "string"
22
+ ? Reader.of(range)
23
+ : formatLengthR("Steps", range.value))
24
+ .then(text => wrapIfRadius(value.is_radius, text))
25
+ .then(text => wrapIfMaximum(value.is_maximum, text));
26
+ const renderFixedRange = (value) => formatCombinedLengthR(value)
27
+ .then(text => wrapIfRadius(value.is_radius, text))
28
+ .then(text => wrapIfMaximum(value.is_maximum, text));
29
+ const getCheckResultBasedRangeTranslation = (value) => renderCheckResultBasedValue(value)
30
+ .thenW(text => formatLengthR(value.unit, text))
31
+ .then(text => wrapIfRadius(value.is_radius, text))
32
+ .then(text => wrapIfMaximum(value.is_maximum, text));
33
+ /**
34
+ * Returns the text for the non-modifiable range of an activatable skill.
35
+ */
36
+ export const renderNonModifiableRange = (value, shouldAppendNonModifiableSuffix) => {
37
+ const appendNonModifiableSuffixIfNeeded = shouldAppendNonModifiableSuffix
38
+ ? (text) => appendNonModifiableSuffix(ModifiableParameter.Range, text)
39
+ : Reader.of;
40
+ switch (value.kind) {
37
41
  case "Sight":
38
- return getSightTranslation(locale);
42
+ return translateR("Sight");
39
43
  case "Self":
40
- return getSelfTranslation(locale);
44
+ return translateR("Self");
41
45
  case "Global":
42
- return getGlobalTranslation(locale);
46
+ return translateR("Global");
43
47
  case "Touch":
44
- return getTouchTranslation(locale, entity, responsiveTextSize);
48
+ return translateR("Touch").thenW(appendNonModifiableSuffixIfNeeded);
45
49
  case "Fixed": {
46
- return getFixedRangeTranslation(locale, entity, responsiveTextSize, value.fixed);
50
+ return renderFixedRange(value.Fixed).thenW(appendNonModifiableSuffixIfNeeded);
47
51
  }
48
52
  case "CheckResultBased":
49
- return getCheckResultBasedRangeTranslation(locale, entity, responsiveTextSize, value.check_result_based);
53
+ return getCheckResultBasedRangeTranslation(value.CheckResultBased).then(appendNonModifiableSuffixIfNeeded);
50
54
  default:
51
55
  return assertExhaustive(value);
52
56
  }
@@ -54,28 +58,24 @@ const getRangeValueTranslation = (getSkillModificationLevelById, locale, speed,
54
58
  /**
55
59
  * Returns the text for the range of an activatable skill.
56
60
  */
57
- export const getTextForActivatableSkillRange = (getSkillModificationLevelById, locale, speed, responsiveTextSize, entity, value) => {
58
- const rangeValue = getRangeValueTranslation(getSkillModificationLevelById, locale, speed, responsiveTextSize, entity, value.value);
59
- const withReplacement = replaceTextIfRequested("replacement", value.translations, locale.translateMap, responsiveTextSize, rangeValue);
60
- return appendNoteIfRequested("note", value.translations, locale.translateMap, responsiveTextSize, withReplacement);
61
- };
62
- const getTextForTinyAcitvatableRange = (locale, responsiveTextSize, entity, value) => {
63
- switch (value.tag) {
61
+ export const renderRangeValue = (value, shouldAppendNonModifiableSuffix) => {
62
+ switch (value.kind) {
63
+ case "Modifiable":
64
+ return renderModifiableRange(value.Modifiable);
65
+ case "Sight":
64
66
  case "Self":
65
- return getSelfTranslation(locale);
67
+ case "Global":
66
68
  case "Touch":
67
- return getTouchTranslation(locale, entity, responsiveTextSize);
68
69
  case "Fixed":
69
- return getFixedRangeTranslation(locale, entity, responsiveTextSize, value.fixed);
70
+ case "CheckResultBased":
71
+ return renderNonModifiableRange(value, shouldAppendNonModifiableSuffix);
70
72
  default:
71
73
  return assertExhaustive(value);
72
74
  }
73
75
  };
74
76
  /**
75
- * Returns the text for the range of a cantrip.
76
- */
77
- export const getTextForCantripRange = (locale, responsiveTextSize, value) => getTextForTinyAcitvatableRange(locale, responsiveTextSize, Entity.Cantrip, value);
78
- /**
79
- * Returns the text for the range of a blessing.
77
+ * Returns the text for the range of an activatable skill.
80
78
  */
81
- export const getTextForBlessingRange = (locale, responsiveTextSize, value) => getTextForTinyAcitvatableRange(locale, responsiveTextSize, Entity.Blessing, value);
79
+ export const renderRange = (value) => renderRangeValue(value.value, true)
80
+ .then(text => replaceTextIfNeeded(value.translations, text))
81
+ .then(text => appendNoteIfNeeded(value.translations, text));
@@ -1,4 +1,4 @@
1
- import { FastSkillModificationLevelConfig, SkillModificationLevel, SlowSkillModificationLevelConfig } from "optolith-database-schema/types/SkillModificationLevel";
1
+ import { FastSkillModificationLevelConfig, SkillModificationLevel, SlowSkillModificationLevelConfig } from "optolith-database-schema/gen";
2
2
  /**
3
3
  * The speed of an activatable skill.
4
4
  */
@@ -6,7 +6,16 @@ export declare enum Speed {
6
6
  Fast = 0,
7
7
  Slow = 1
8
8
  }
9
+ type SpeedMap = {
10
+ [Speed.Fast]: FastSkillModificationLevelConfig;
11
+ [Speed.Slow]: SlowSkillModificationLevelConfig;
12
+ };
9
13
  /**
10
14
  * Returns a common value for a skill modification level depending on the speed.
11
15
  */
12
- export declare const getModifiableBySpeed: <T>(fast: (config: FastSkillModificationLevelConfig) => T, slow: (config: SlowSkillModificationLevelConfig) => T, speed: Speed, level: SkillModificationLevel) => T;
16
+ export declare const getModifiableBySpeed: <S extends Speed, K extends keyof SpeedMap[S]>(speed: S, key: K, level: SkillModificationLevel) => SpeedMap[S][K];
17
+ /**
18
+ * Returns a common value for a skill modification level depending on the speed.
19
+ */
20
+ export declare const getMapModifiableBySpeed: <T>(fast: (config: FastSkillModificationLevelConfig) => T, slow: (config: SlowSkillModificationLevelConfig) => T, speed: Speed, level: SkillModificationLevel) => T;
21
+ export {};
@@ -10,7 +10,20 @@ export var Speed;
10
10
  /**
11
11
  * Returns a common value for a skill modification level depending on the speed.
12
12
  */
13
- export const getModifiableBySpeed = (fast, slow, speed, level) => {
13
+ export const getModifiableBySpeed = (speed, key, level) => {
14
+ switch (speed) {
15
+ case Speed.Fast:
16
+ return level.fast[key];
17
+ case Speed.Slow:
18
+ return level.slow[key];
19
+ default:
20
+ return assertExhaustive(speed);
21
+ }
22
+ };
23
+ /**
24
+ * Returns a common value for a skill modification level depending on the speed.
25
+ */
26
+ export const getMapModifiableBySpeed = (fast, slow, speed, level) => {
14
27
  switch (speed) {
15
28
  case Speed.Fast:
16
29
  return fast(level.fast);