@optolith/entity-descriptions 0.4.26 → 0.6.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 +33 -0
  2. package/lib/entities/activatable.d.ts +3 -3
  3. package/lib/entities/activatable.js +60 -29
  4. package/lib/entities/equipment.d.ts +2 -2
  5. package/lib/entities/equipment.js +7 -7
  6. package/lib/entities/liturgicalChant.js +19 -12
  7. package/lib/entities/partial/enhancements.js +2 -2
  8. package/lib/entities/partial/map.d.ts +25 -36
  9. package/lib/entities/partial/map.js +16 -15
  10. package/lib/entities/partial/prerequisites/prerequisiteGroups.js +9 -2
  11. package/lib/entities/partial/prerequisites/single/enhancement.d.ts +7 -3
  12. package/lib/entities/partial/prerequisites/single/enhancement.js +19 -25
  13. package/lib/entities/partial/rated/activatable/castingTime.d.ts +5 -5
  14. package/lib/entities/partial/rated/activatable/castingTime.js +6 -3
  15. package/lib/entities/partial/rated/activatable/cost.d.ts +20 -14
  16. package/lib/entities/partial/rated/activatable/cost.js +62 -27
  17. package/lib/entities/partial/rated/activatable/duration.d.ts +3 -3
  18. package/lib/entities/partial/rated/activatable/index.d.ts +6 -6
  19. package/lib/entities/partial/rated/activatable/index.js +4 -4
  20. package/lib/entities/partial/reader.d.ts +10 -0
  21. package/lib/entities/partial/reader.js +5 -1
  22. package/lib/entities/partial/units/timeSpan.d.ts +23 -15
  23. package/lib/entities/partial/units/timeSpan.js +17 -3
  24. package/lib/entities/poison.js +9 -9
  25. package/lib/entities/profession.js +17 -15
  26. package/lib/entities/spell.js +34 -18
  27. package/lib/helpers/enums.d.ts +2 -1
  28. package/lib/helpers/enums.js +1 -3
  29. package/lib/index.d.ts +56 -56
  30. package/lib/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +11 -10
@@ -1,5 +1,6 @@
1
1
  import { Reader } from "@elyukai/utils/reader";
2
2
  import { responsive } from "../responsiveText.js";
3
+ import { MISSING_VALUE } from "../unknown.js";
3
4
  // prettier-ignore
4
5
  const timeSpanUnitTranslationKeys = {
5
6
  Seconds: [".input {$value :number} .input {$style :string} {{{$value} seconds}}", "{$value} seconds", ".input {$value :number} .input {$style :string} {{{$value} s}}", "{$value} s"],
@@ -19,7 +20,20 @@ const timeSpanUnitTranslationKeys = {
19
20
  /**
20
21
  * Returns the text for a time span unit.
21
22
  */
22
- export const formatTimeSpan = (translate, responsiveTextSize, unit, value, interval = false) => {
23
+ export const formatTimeSpan = (translate, translateMap, format, responsiveTextSize, unit, value, interval = false) => {
24
+ if (typeof unit === "object" && unit.kind === "Custom") {
25
+ const translation = translateMap(unit.Custom.translations);
26
+ if (translation === undefined) {
27
+ return MISSING_VALUE;
28
+ }
29
+ return responsive(responsiveTextSize, () => format(typeof value === "number" ? translation.fullNumber : translation.full, {
30
+ value,
31
+ style: interval ? "interval" : "default",
32
+ }), () => format(typeof value === "number" ? translation.compressedNumber : translation.compressed, {
33
+ value,
34
+ style: interval ? "interval" : "default",
35
+ }));
36
+ }
23
37
  const [fullNumberKey, fullKey, compressedNumberKey, compressedKey] = timeSpanUnitTranslationKeys[typeof unit === "string" ? unit : unit.kind];
24
38
  return responsive(responsiveTextSize, () => translate(typeof value === "number" ? fullNumberKey : fullKey, {
25
39
  value,
@@ -32,11 +46,11 @@ export const formatTimeSpan = (translate, responsiveTextSize, unit, value, inter
32
46
  /**
33
47
  * Returns the text for a time span unit.
34
48
  */
35
- export const formatCombinedTimeSpan = (translate, responsiveTextSize, object, interval = false) => formatTimeSpan(translate, responsiveTextSize, object.unit, object.value, interval);
49
+ export const formatCombinedTimeSpan = (translate, translateMap, format, responsiveTextSize, object, interval = false) => formatTimeSpan(translate, translateMap, format, responsiveTextSize, object.unit, object.value, interval);
36
50
  /**
37
51
  * Returns the text for a time span unit.
38
52
  */
39
- export const formatTimeSpanR = (unit, value, interval) => Reader.asks(({ translate, responsiveTextSize }) => formatTimeSpan(translate, responsiveTextSize, unit, value, interval));
53
+ export const formatTimeSpanR = (unit, value, interval) => Reader.asks(({ translate, translateMap, format, responsiveTextSize }) => formatTimeSpan(translate, translateMap, format, responsiveTextSize, unit, value, interval));
40
54
  /**
41
55
  * Returns the text for a time span unit.
42
56
  */
@@ -42,7 +42,7 @@ const renderLevel = (translate, translateMap, level) => {
42
42
  return assertExhaustive(level);
43
43
  }
44
44
  };
45
- const renderAddiction = (translate, translateMap, getInstanceById, addiction) => [
45
+ const renderAddiction = (translate, translateMap, format, getInstanceById, addiction) => [
46
46
  ensureNonEmpty([
47
47
  mapNullable(renderChance(translate, translateMap, addiction), chance => chance +
48
48
  parensIf(addiction.check === undefined
@@ -60,7 +60,7 @@ const renderAddiction = (translate, translateMap, getInstanceById, addiction) =>
60
60
  ].filter(isNotNullish))?.join(", "),
61
61
  mapNullable(addiction.withdrawalPrevention, withdrawalPrevention => translate(".input {$value :number} {{{$value} applications every {$interval}}}", {
62
62
  value: withdrawalPrevention.amount,
63
- interval: formatTimeSpan(translate, ResponsiveTextSize.Full, { kind: "Days" }, (() => {
63
+ interval: formatTimeSpan(translate, translateMap, format, ResponsiveTextSize.Full, { kind: "Days" }, (() => {
64
64
  switch (withdrawalPrevention.interval.kind) {
65
65
  case "Constant":
66
66
  return withdrawalPrevention.interval.Constant.value;
@@ -74,7 +74,7 @@ const renderAddiction = (translate, translateMap, getInstanceById, addiction) =>
74
74
  ]
75
75
  .filter(isNotNullish)
76
76
  .join("; ");
77
- const renderIntoxicantValues = (translate, translateMap, getInstanceById, intoxicant) => {
77
+ const renderIntoxicantValues = (translate, translateMap, format, getInstanceById, intoxicant) => {
78
78
  const translation = translateMap(intoxicant.translations);
79
79
  return {
80
80
  ingestion: translation?.ingestion ?? MISSING_VALUE,
@@ -84,10 +84,10 @@ const renderIntoxicantValues = (translate, translateMap, getInstanceById, intoxi
84
84
  special: translation?.special,
85
85
  addiction: intoxicant.addiction === undefined
86
86
  ? undefined
87
- : renderAddiction(translate, translateMap, getInstanceById, intoxicant.addiction),
87
+ : renderAddiction(translate, translateMap, format, getInstanceById, intoxicant.addiction),
88
88
  };
89
89
  };
90
- const renderSourceTypeBasedValues = (translate, translateMap, getInstanceById, sourceType) => {
90
+ const renderSourceTypeBasedValues = (translate, translateMap, format, getInstanceById, sourceType) => {
91
91
  switch (sourceType.kind) {
92
92
  case "AnimalVenom":
93
93
  return {
@@ -112,7 +112,7 @@ const renderSourceTypeBasedValues = (translate, translateMap, getInstanceById, s
112
112
  .join(", "),
113
113
  ...(sourceType.AlchemicalPoison.intoxicant === undefined
114
114
  ? undefined
115
- : renderIntoxicantValues(translate, translateMap, getInstanceById, sourceType.AlchemicalPoison.intoxicant)),
115
+ : renderIntoxicantValues(translate, translateMap, format, getInstanceById, sourceType.AlchemicalPoison.intoxicant)),
116
116
  typicalIngredients: translation?.typical_ingredients.join(", "),
117
117
  priceOfIngedientsPerLevel: translate("{$cost} per level", {
118
118
  cost: translate(".input {$value :number} {{{$value} silverthalers}}", {
@@ -144,7 +144,7 @@ const renderSourceTypeBasedValues = (translate, translateMap, getInstanceById, s
144
144
  sourceType: translate("plant poison"),
145
145
  ...(sourceType.PlantPoison.intoxicant === undefined
146
146
  ? undefined
147
- : renderIntoxicantValues(translate, translateMap, getInstanceById, sourceType.PlantPoison.intoxicant)),
147
+ : renderIntoxicantValues(translate, translateMap, format, getInstanceById, sourceType.PlantPoison.intoxicant)),
148
148
  };
149
149
  case "DemonicPoison": {
150
150
  const translation = translateMap(sourceType.DemonicPoison.translations);
@@ -241,13 +241,13 @@ const renderValueCost = (translate, translateMap, cost, value) => value === unde
241
241
  * Get a JSON representation of the rules text for a poison.
242
242
  */
243
243
  export const getPoisonEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getResolvedSelectOptionById, idMap }, locale, { content: entry }) => {
244
- const { translate, translateMap, join: localeJoin, compare: localeCompare } = locale;
244
+ const { translate, translateMap, format, join: localeJoin, compare: localeCompare } = locale;
245
245
  const translation = translateMap(entry.translations);
246
246
  if (translation === undefined) {
247
247
  return undefined;
248
248
  }
249
249
  const applicationType = renderApplicationType(translate, localeJoin, localeCompare, entry.application_type);
250
- const { level, sourceType, ingestion, sideEffect, overdose, legality, special, addiction, typicalIngredients, priceOfIngedientsPerLevel, laboratory, brewingDifficulty, prerequisitesBrewingProcess, tradeSecret, note, } = renderSourceTypeBasedValues(translate, translateMap, getInstanceById, entry.source_type);
250
+ const { level, sourceType, ingestion, sideEffect, overdose, legality, special, addiction, typicalIngredients, priceOfIngedientsPerLevel, laboratory, brewingDifficulty, prerequisitesBrewingProcess, tradeSecret, note, } = renderSourceTypeBasedValues(translate, translateMap, format, getInstanceById, entry.source_type);
251
251
  return {
252
252
  title: translation.name,
253
253
  className: "poison",
@@ -471,25 +471,27 @@ const renderRestrictedBlessings = (restrictedBlessings) => {
471
471
  return assertExhaustive(restrictedBlessings);
472
472
  }
473
473
  };
474
- const renderSingleBlessings = (traditions) => Reader.traverse(traditions, traditionId => getInstanceByIdR("BlessedTradition", traditionId).map(tradition => tradition
475
- ? { restrictedBlessings: tradition.restricted_blessings, type: tradition.type }
476
- : undefined)).thenW(restrictedBlessingsList => !isNotEmpty(restrictedBlessingsList)
474
+ const renderSingleBlessings = (traditions) => Reader.traverse(traditions, traditionId => getInstanceByIdR("BlessedTradition", traditionId).map(tradition => tradition?.type))
475
+ .map(traditionTypes => traditionTypes.filter(isNotNullish))
476
+ .thenW(traditionTypes => !isNotEmpty(traditionTypes)
477
477
  ? Reader.of(undefined)
478
- : restrictedBlessingsList.length === 1
478
+ : traditionTypes.length === 1
479
479
  ? (() => {
480
- const [first] = restrictedBlessingsList;
481
- const { restrictedBlessings, type } = first ?? {};
482
- return type?.kind === "Shamanistic"
483
- ? Reader.of(undefined)
484
- : restrictedBlessings === undefined
485
- ? translateR("The Twelve Blessings")
486
- : translateR("The Twelve Blessings").thenW(base => renderRestrictedBlessings(restrictedBlessings).thenW(list => translateR("except for {$list :list type=conjunction}", {
487
- list,
488
- }).map(note => base + parensIf(note))));
480
+ const [first] = traditionTypes;
481
+ if (first.kind === "Shamanistic") {
482
+ return Reader.of(undefined);
483
+ }
484
+ const { restrictedBlessings } = first.Church;
485
+ return restrictedBlessings === undefined
486
+ ? translateR("The Twelve Blessings")
487
+ : translateR("The Twelve Blessings").thenW(base => renderRestrictedBlessings(restrictedBlessings).thenW(list => translateR("except for {$list :list type=conjunction}", {
488
+ list,
489
+ }).map(note => base + parensIf(note))));
489
490
  })()
490
- : restrictedBlessingsList.every(trad => trad?.type.kind === "Shamanistic")
491
+ : traditionTypes.every(trad => trad.kind === "Shamanistic")
491
492
  ? Reader.of(undefined)
492
- : restrictedBlessingsList.some(trad => trad?.restrictedBlessings !== undefined || trad?.type.kind === "Shamanistic")
493
+ : traditionTypes.some(trad => (trad.kind === "Church" && trad.Church.restrictedBlessings !== undefined) ||
494
+ trad.kind === "Shamanistic")
493
495
  ? translateR("The Twelve Blessings").map2(translateR("depends on selected tradition"), (base, note) => base + parensIf(note))
494
496
  : translateR("The Twelve Blessings"));
495
497
  const renderBlessings = (traditions) => {
@@ -14,7 +14,7 @@ import { renderEnhancements } from "./partial/enhancements.js";
14
14
  import { attributedCustomName, attributedName } from "./partial/markdown.js";
15
15
  import { printAnimistPowerPrerequisites, printGeodeRitualPrerequisites, } from "./partial/prerequisites/index.js";
16
16
  import { renderCastingTime, renderFastSkillNonModifiableCastingTime, renderSlowSkillNonModifiableCastingTime, } from "./partial/rated/activatable/castingTime.js";
17
- import { renderMagicalActionCost, renderModifiableOneTimeCost, renderNonModifiableOneTimeCost, renderNonModifiableSustainedCost, renderOneTimeCostMap, } from "./partial/rated/activatable/cost.js";
17
+ import { renderMagicalActionCost, renderModifiableOneTimeCost, renderNonModifiableOneTimeCost, renderNonModifiableSustainedCost, renderStandaloneCostMap, } from "./partial/rated/activatable/cost.js";
18
18
  import { renderExpressionBasedDuration, renderMusicDuration, renderOneTimeDuration, renderSustainedDuration, } from "./partial/rated/activatable/duration.js";
19
19
  import { renderEffect } from "./partial/rated/activatable/effect.js";
20
20
  import { combineGeneratedTextWithStaticTranslation, renderFastPerformanceParameters, renderSlowOneTimePerformanceParameters, renderSlowPerformanceParameters, } from "./partial/rated/activatable/index.js";
@@ -57,7 +57,7 @@ const getTraditionNameForArcaneSpellworksById = (id, getInstanceById, translateM
57
57
  * Get a JSON representation of the rules text for a cantrip.
58
58
  */
59
59
  export const getCantripEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content: entry }) => {
60
- const { translate, translateMap, compare: localeCompare } = locale;
60
+ const { translate, translateMap, format, compare: localeCompare } = locale;
61
61
  const translation = translateMap(entry.translations);
62
62
  if (translation === undefined) {
63
63
  return undefined;
@@ -65,6 +65,7 @@ export const getCantripEntityDescription = createEntityDescriptionCreator(({ get
65
65
  const env = {
66
66
  translate,
67
67
  translateMap,
68
+ format,
68
69
  getInstanceById,
69
70
  responsiveTextSize: ResponsiveTextSize.Full,
70
71
  };
@@ -128,7 +129,7 @@ export const getCantripEntityDescription = createEntityDescriptionCreator(({ get
128
129
  * Get a JSON representation of the rules text for a skill.
129
130
  */
130
131
  export const getSpellEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId, idMap }, locale, { content: entry, entity, id }, options) => {
131
- const { translate, translateMap, compare: localeCompare } = locale;
132
+ const { translate, translateMap, format, compare: localeCompare } = locale;
132
133
  const translation = translateMap(entry.translations);
133
134
  if (translation === undefined) {
134
135
  return undefined;
@@ -136,6 +137,7 @@ export const getSpellEntityDescription = createEntityDescriptionCreator(({ getIn
136
137
  const env = {
137
138
  translate,
138
139
  translateMap,
140
+ format,
139
141
  getInstanceById,
140
142
  getChildInstancesForInstanceId,
141
143
  localeJoin: locale.join,
@@ -186,7 +188,7 @@ export const getSpellEntityDescription = createEntityDescriptionCreator(({ getIn
186
188
  * Get a JSON representation of the rules text for a ritual.
187
189
  */
188
190
  export const getRitualEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId, idMap }, locale, { content: entry, entity, id }, options) => {
189
- const { translate, translateMap, compare: localeCompare } = locale;
191
+ const { translate, translateMap, format, compare: localeCompare } = locale;
190
192
  const translation = translateMap(entry.translations);
191
193
  if (translation === undefined) {
192
194
  return undefined;
@@ -194,6 +196,7 @@ export const getRitualEntityDescription = createEntityDescriptionCreator(({ getI
194
196
  const env = {
195
197
  translate,
196
198
  translateMap,
199
+ format,
197
200
  getInstanceById,
198
201
  getChildInstancesForInstanceId,
199
202
  localeJoin: locale.join,
@@ -244,7 +247,7 @@ export const getRitualEntityDescription = createEntityDescriptionCreator(({ getI
244
247
  * Get a JSON representation of the rules text for a curse.
245
248
  */
246
249
  export const getCurseEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
247
- const { translate, translateMap } = locale;
250
+ const { translate, translateMap, format } = locale;
248
251
  const translation = translateMap(entry.translations);
249
252
  if (translation === undefined) {
250
253
  return undefined;
@@ -252,6 +255,7 @@ export const getCurseEntityDescription = createEntityDescriptionCreator(({ getIn
252
255
  const env = {
253
256
  translate,
254
257
  translateMap,
258
+ format,
255
259
  getInstanceById,
256
260
  localeJoin: locale.join,
257
261
  energyUnit: "ArcaneEnergy",
@@ -293,7 +297,7 @@ const renderMagicalActionSkill = (skill) => Reader.asks(({ translate, translateM
293
297
  * Get a JSON representation of the rules text for an Elven magical song.
294
298
  */
295
299
  export const getElvenMagicalSongEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
296
- const { translate, translateMap } = locale;
300
+ const { translate, translateMap, format } = locale;
297
301
  const translation = translateMap(entry.translations);
298
302
  if (translation === undefined) {
299
303
  return undefined;
@@ -301,6 +305,7 @@ export const getElvenMagicalSongEntityDescription = createEntityDescriptionCreat
301
305
  const env = {
302
306
  translate,
303
307
  translateMap,
308
+ format,
304
309
  getInstanceById,
305
310
  localeJoin: locale.join,
306
311
  localeCompare: locale.compare,
@@ -332,7 +337,7 @@ export const getElvenMagicalSongEntityDescription = createEntityDescriptionCreat
332
337
  * Get a JSON representation of the rules text for a domination ritual.
333
338
  */
334
339
  export const getDominationRitualEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
335
- const { translate, translateMap } = locale;
340
+ const { translate, translateMap, format } = locale;
336
341
  const translation = translateMap(entry.translations);
337
342
  if (translation === undefined) {
338
343
  return undefined;
@@ -340,6 +345,7 @@ export const getDominationRitualEntityDescription = createEntityDescriptionCreat
340
345
  const env = {
341
346
  translate,
342
347
  translateMap,
348
+ format,
343
349
  getInstanceById,
344
350
  speed: Speed.Slow,
345
351
  energyUnit: "ArcaneEnergy",
@@ -381,7 +387,7 @@ const renderMusicTradition = (translate, translateMap, localeCompare, getInstanc
381
387
  * Get a JSON representation of the rules text for a magical dance.
382
388
  */
383
389
  export const getMagicalDanceEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content: entry }) => {
384
- const { translate, translateMap } = locale;
390
+ const { translate, translateMap, format } = locale;
385
391
  const translation = translateMap(entry.translations);
386
392
  if (translation === undefined) {
387
393
  return undefined;
@@ -389,6 +395,7 @@ export const getMagicalDanceEntityDescription = createEntityDescriptionCreator((
389
395
  const env = {
390
396
  translate,
391
397
  translateMap,
398
+ format,
392
399
  getInstanceById,
393
400
  localeJoin: locale.join,
394
401
  energyUnit: "ArcaneEnergy",
@@ -421,7 +428,7 @@ export const getMagicalDanceEntityDescription = createEntityDescriptionCreator((
421
428
  * Get a JSON representation of the rules text for a magical melody.
422
429
  */
423
430
  export const getMagicalMelodyEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content: entry }) => {
424
- const { translate, translateMap } = locale;
431
+ const { translate, translateMap, format } = locale;
425
432
  const translation = translateMap(entry.translations);
426
433
  if (translation === undefined) {
427
434
  return undefined;
@@ -429,6 +436,7 @@ export const getMagicalMelodyEntityDescription = createEntityDescriptionCreator(
429
436
  const env = {
430
437
  translate,
431
438
  translateMap,
439
+ format,
432
440
  getInstanceById,
433
441
  localeCompare: locale.compare,
434
442
  localeJoin: locale.join,
@@ -495,7 +503,7 @@ const renderFamiliarsTrickPerformanceParameters = (params) => {
495
503
  * Get a JSON representation of the rules text for a familiar’s trick.
496
504
  */
497
505
  export const getFamiliarsTrickEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content: entry }) => {
498
- const { translate, translateMap } = locale;
506
+ const { translate, translateMap, format } = locale;
499
507
  const translation = translateMap(entry.translations);
500
508
  if (translation === undefined) {
501
509
  return undefined;
@@ -503,6 +511,7 @@ export const getFamiliarsTrickEntityDescription = createEntityDescriptionCreator
503
511
  const env = {
504
512
  translate,
505
513
  translateMap,
514
+ format,
506
515
  getInstanceById,
507
516
  localeJoin: locale.join,
508
517
  energyUnit: "ArcaneEnergy",
@@ -584,7 +593,7 @@ const renderAnimistPowerImprovementCost = (improvementCost) => {
584
593
  * Get a JSON representation of the rules text for a animist power.
585
594
  */
586
595
  export const getAnimistPowerEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
587
- const { translate, translateMap } = locale;
596
+ const { translate, translateMap, format } = locale;
588
597
  const translation = translateMap(entry.translations);
589
598
  if (translation === undefined) {
590
599
  return undefined;
@@ -592,6 +601,7 @@ export const getAnimistPowerEntityDescription = createEntityDescriptionCreator((
592
601
  const env = {
593
602
  translate,
594
603
  translateMap,
604
+ format,
595
605
  getInstanceById,
596
606
  localeJoin: locale.join,
597
607
  energyUnit: "ArcaneEnergy",
@@ -670,7 +680,7 @@ export const getAnimistPowerEntityDescription = createEntityDescriptionCreator((
670
680
  * Get a JSON representation of the rules text for a Goede ritual.
671
681
  */
672
682
  export const getGeodeRitualEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getResolvedSelectOptionById }, locale, { content: entry }) => {
673
- const { translate, translateMap } = locale;
683
+ const { translate, translateMap, format } = locale;
674
684
  const translation = translateMap(entry.translations);
675
685
  if (translation === undefined) {
676
686
  return undefined;
@@ -678,6 +688,7 @@ export const getGeodeRitualEntityDescription = createEntityDescriptionCreator(({
678
688
  const env = {
679
689
  translate,
680
690
  translateMap,
691
+ format,
681
692
  getInstanceById,
682
693
  localeJoin: locale.join,
683
694
  energyUnit: "ArcaneEnergy",
@@ -728,7 +739,7 @@ export const getGeodeRitualEntityDescription = createEntityDescriptionCreator(({
728
739
  * Get a JSON representation of the rules text for a jester trick.
729
740
  */
730
741
  export const getJesterTrickEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
731
- const { translate, translateMap } = locale;
742
+ const { translate, translateMap, format } = locale;
732
743
  const translation = translateMap(entry.translations);
733
744
  if (translation === undefined) {
734
745
  return undefined;
@@ -736,6 +747,7 @@ export const getJesterTrickEntityDescription = createEntityDescriptionCreator(({
736
747
  const env = {
737
748
  translate,
738
749
  translateMap,
750
+ format,
739
751
  getInstanceById,
740
752
  localeJoin: locale.join,
741
753
  energyUnit: "ArcaneEnergy",
@@ -781,7 +793,7 @@ export const getJesterTrickEntityDescription = createEntityDescriptionCreator(({
781
793
  * Get a JSON representation of the rules text for a goblin ritual.
782
794
  */
783
795
  export const getGoblinRitualEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
784
- const { translate, translateMap } = locale;
796
+ const { translate, translateMap, format } = locale;
785
797
  const translation = translateMap(entry.translations);
786
798
  if (translation === undefined) {
787
799
  return undefined;
@@ -789,6 +801,7 @@ export const getGoblinRitualEntityDescription = createEntityDescriptionCreator((
789
801
  const env = {
790
802
  translate,
791
803
  translateMap,
804
+ format,
792
805
  getInstanceById,
793
806
  localeJoin: locale.join,
794
807
  speed: Speed.Slow,
@@ -854,7 +867,7 @@ export const getGoblinRitualEntityDescription = createEntityDescriptionCreator((
854
867
  * Get a JSON representation of the rules text for a Zibilja ritual.
855
868
  */
856
869
  export const getZibiljaRitualEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
857
- const { translate, translateMap } = locale;
870
+ const { translate, translateMap, format } = locale;
858
871
  const translation = translateMap(entry.translations);
859
872
  if (translation === undefined) {
860
873
  return undefined;
@@ -862,6 +875,7 @@ export const getZibiljaRitualEntityDescription = createEntityDescriptionCreator(
862
875
  const env = {
863
876
  translate,
864
877
  translateMap,
878
+ format,
865
879
  getInstanceById,
866
880
  localeCompare: locale.compare,
867
881
  localeJoin: locale.join,
@@ -933,7 +947,7 @@ const renderBannzeichenCost = (options, cost) => {
933
947
  case "Disjunction":
934
948
  return Reader.sequence(cost.Disjunction.list.map(renderSingleEnergyCost)).thenW(text => localeJoinR(text, "disjunction"));
935
949
  case "Map":
936
- return renderOneTimeCostMap(cost.Map);
950
+ return renderStandaloneCostMap(cost.Map);
937
951
  case "DerivedFromOption":
938
952
  return renderOptionDerivedEnergyCost(options, option => option.cost?.value);
939
953
  default:
@@ -974,7 +988,7 @@ const renderSplitMagicalRuneParameterTranslation = (parameter) => responsiveR(()
974
988
  * Get a JSON representation of the rules text for a Bannzeichen.
975
989
  */
976
990
  export const getBannzeichenEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId }, locale, { id, content: entry }) => {
977
- const { translate, translateMap } = locale;
991
+ const { translate, translateMap, format } = locale;
978
992
  const translation = translateMap(entry.translations);
979
993
  if (translation === undefined) {
980
994
  return undefined;
@@ -982,6 +996,7 @@ export const getBannzeichenEntityDescription = createEntityDescriptionCreator(({
982
996
  const env = {
983
997
  translate,
984
998
  translateMap,
999
+ format,
985
1000
  getInstanceById,
986
1001
  localeCompare: locale.compare,
987
1002
  localeJoin: locale.join,
@@ -1046,7 +1061,7 @@ const renderMagicalRuneImprovementCost = (options, improvementCost) => {
1046
1061
  * Get a JSON representation of the rules text for a magical rune.
1047
1062
  */
1048
1063
  export const getMagicalRuneEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId, idMap }, locale, { id, content: entry }) => {
1049
- const { translate, translateMap } = locale;
1064
+ const { translate, translateMap, format } = locale;
1050
1065
  const translation = translateMap(entry.translations);
1051
1066
  if (translation === undefined) {
1052
1067
  return undefined;
@@ -1054,6 +1069,7 @@ export const getMagicalRuneEntityDescription = createEntityDescriptionCreator(({
1054
1069
  const env = {
1055
1070
  translate,
1056
1071
  translateMap,
1072
+ format,
1057
1073
  getInstanceById,
1058
1074
  localeCompare: locale.compare,
1059
1075
  localeJoin: locale.join,
@@ -1,3 +1,4 @@
1
+ import type { AnyNonNullish } from "@elyukai/utils/nullable";
1
2
  /**
2
3
  * Creates an enum case object.
3
4
  */
@@ -5,7 +6,7 @@ export declare const Case: {
5
6
  <K extends string>(kind: K): {
6
7
  kind: K;
7
8
  };
8
- <K extends string, T extends NonNullable<unknown> | null>(kind: K, value: T): {
9
+ <K extends string, T extends AnyNonNullish | null>(kind: K, value: T): {
9
10
  kind: K;
10
11
  } & { [Key in K]: T; };
11
12
  };
@@ -1,6 +1,4 @@
1
1
  /**
2
2
  * Creates an enum case object.
3
3
  */
4
- export const Case = ((kind, value) => (value === undefined
5
- ? { kind }
6
- : { kind, [kind]: value }));
4
+ export const Case = ((kind, value) => (value === undefined ? { kind } : { kind, [kind]: value }));