@optolith/entity-descriptions 0.1.1 → 0.2.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.
- package/CHANGELOG.md +32 -0
- package/lib/entities/combatTechnique.d.ts +4 -4
- package/lib/entities/combatTechnique.js +7 -7
- package/lib/entities/experienceLevel.d.ts +1 -1
- package/lib/entities/experienceLevel.js +3 -3
- package/lib/entities/focusRule.d.ts +8 -0
- package/lib/entities/focusRule.js +18 -0
- package/lib/entities/liturgicalChant.d.ts +6 -6
- package/lib/entities/liturgicalChant.js +27 -56
- package/lib/entities/optionalRule.d.ts +5 -0
- package/lib/entities/optionalRule.js +16 -0
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +3 -15
- package/lib/entities/partial/rated/activatable/castingTime.js +19 -34
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/checkResultBased.js +2 -2
- package/lib/entities/partial/rated/activatable/cost.d.ts +3 -19
- package/lib/entities/partial/rated/activatable/cost.js +82 -99
- package/lib/entities/partial/rated/activatable/duration.d.ts +5 -24
- package/lib/entities/partial/rated/activatable/duration.js +40 -57
- package/lib/entities/partial/rated/activatable/effect.d.ts +3 -3
- package/lib/entities/partial/rated/activatable/effect.js +7 -7
- package/lib/entities/partial/rated/activatable/index.d.ts +5 -33
- package/lib/entities/partial/rated/activatable/index.js +23 -41
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +20 -0
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +19 -0
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +16 -0
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +55 -0
- package/lib/entities/partial/rated/activatable/parensIf.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/parensIf.js +3 -1
- package/lib/entities/partial/rated/activatable/range.d.ts +4 -20
- package/lib/entities/partial/rated/activatable/range.js +59 -100
- package/lib/entities/partial/rated/activatable/speed.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/speed.js +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +3 -7
- package/lib/entities/partial/rated/activatable/targetCategory.js +30 -26
- package/lib/entities/partial/rated/improvementCost.d.ts +2 -2
- package/lib/entities/partial/rated/skillCheck.d.ts +2 -2
- package/lib/entities/partial/responsiveText.d.ts +7 -4
- package/lib/entities/partial/responsiveText.js +8 -2
- package/lib/entities/partial/units/energy.d.ts +12 -0
- package/lib/entities/partial/units/energy.js +30 -0
- package/lib/entities/partial/units/length.d.ts +8 -0
- package/lib/entities/partial/units/length.js +12 -0
- package/lib/entities/partial/units/timeSpan.d.ts +8 -0
- package/lib/entities/partial/units/timeSpan.js +22 -0
- package/lib/entities/skill.d.ts +2 -2
- package/lib/entities/skill.js +3 -3
- package/lib/entities/spell.d.ts +6 -6
- package/lib/entities/spell.js +27 -56
- package/lib/helpers/locale.d.ts +8 -0
- package/lib/helpers/locale.js +1 -0
- package/lib/index.d.ts +45 -1
- package/lib/index.js +22 -1
- package/lib/references/index.d.ts +4 -0
- package/lib/references/index.js +46 -0
- package/lib/references/occurrence.d.ts +4 -0
- package/lib/references/occurrence.js +3 -0
- package/lib/references/page.d.ts +23 -0
- package/lib/references/page.js +61 -0
- package/lib/references/pageRange.d.ts +30 -0
- package/lib/references/pageRange.js +58 -0
- package/package.json +7 -3
- package/lib/entities/partial/rated/activatable/isMaximum.d.ts +0 -6
- package/lib/entities/partial/rated/activatable/isMaximum.js +0 -10
- package/lib/entities/partial/rated/activatable/modifiableParameter.d.ts +0 -8
- package/lib/entities/partial/rated/activatable/modifiableParameter.js +0 -9
- package/lib/entities/partial/rated/activatable/nonModifiable.d.ts +0 -9
- package/lib/entities/partial/rated/activatable/nonModifiable.js +0 -75
- package/lib/entities/partial/rated/activatable/units.d.ts +0 -13
- package/lib/entities/partial/rated/activatable/units.js +0 -53
- package/lib/libraryEntry.d.ts +0 -52
- package/lib/libraryEntry.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
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.2.1](https://github.com/Optolith/entity-descriptions/compare/v0.2.0...v0.2.1) (2024-10-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* default database accessors type always throws error when function is called ([31bcb85](https://github.com/Optolith/entity-descriptions/commit/31bcb850a7d962417a65c4517090fb9c9d581fef))
|
|
11
|
+
|
|
12
|
+
## [0.2.0](https://github.com/Optolith/entity-descriptions/compare/v0.1.1...v0.2.0) (2024-10-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### ⚠ BREAKING CHANGES
|
|
16
|
+
|
|
17
|
+
* **npm:** define exports
|
|
18
|
+
* rename entity description creator exports to match previous renames
|
|
19
|
+
* remove partial application functionality from createEntityDescriptionCreator
|
|
20
|
+
* rename library entry to entity description to match repository
|
|
21
|
+
|
|
22
|
+
### build
|
|
23
|
+
|
|
24
|
+
* **npm:** define exports ([52291cf](https://github.com/Optolith/entity-descriptions/commit/52291cf55342d700da972df8b67346f8304f7e13))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
* remove partial application functionality from createEntityDescriptionCreator ([840510b](https://github.com/Optolith/entity-descriptions/commit/840510bad64c696f089fd025ebce05e68722b8ea))
|
|
28
|
+
* rename entity description creator exports to match previous renames ([e09c884](https://github.com/Optolith/entity-descriptions/commit/e09c884bddfebd68faf6263a1ce552b4d4e82965))
|
|
29
|
+
* rename library entry to entity description to match repository ([82878f8](https://github.com/Optolith/entity-descriptions/commit/82878f8ddce5f7c7db01c8b32af6435cb4e154c5))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add focus rule and optional rule description generators ([512c894](https://github.com/Optolith/entity-descriptions/commit/512c8940cfcae2ee19e51989de5aa5884c75e5ba))
|
|
35
|
+
* print references ([381394f](https://github.com/Optolith/entity-descriptions/commit/381394fd4efebd8fe4f6f3f8181557df83ffbefa))
|
|
36
|
+
|
|
5
37
|
## [0.1.1](https://github.com/Optolith/entity-descriptions/compare/v0.1.0...v0.1.1) (2024-10-04)
|
|
6
38
|
|
|
7
39
|
## 0.1.0 (2024-10-04)
|
|
@@ -4,12 +4,12 @@ import { GetById } from "../helpers/getTypes.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Get a JSON representation of the rules text for a close combat technique.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getCloseCombatTechniqueEntityDescription: import("../index.js").EntityDescriptionCreator<CloseCombatTechnique | undefined, {
|
|
8
8
|
getAttributeById: GetById.Static.Attribute;
|
|
9
|
-
}, import("../
|
|
9
|
+
}, import("../index.js").EntityDescription>;
|
|
10
10
|
/**
|
|
11
11
|
* Get a JSON representation of the rules text for a ranged combat technique.
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const getRangedCombatTechniqueEntityDescription: import("../index.js").EntityDescriptionCreator<RangedCombatTechnique | undefined, {
|
|
14
14
|
getAttributeById: GetById.Static.Attribute;
|
|
15
|
-
}, import("../
|
|
15
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mapNullable } from "@optolith/helpers/nullable";
|
|
2
|
-
import {
|
|
2
|
+
import { createEntityDescriptionCreator } from "../index.js";
|
|
3
3
|
import { createImprovementCost } from "./partial/rated/improvementCost.js";
|
|
4
4
|
/**
|
|
5
5
|
* Get a JSON representation of the rules text for a close combat technique.
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const getCloseCombatTechniqueEntityDescription = createEntityDescriptionCreator(({ getAttributeById }, { translate, translateMap }, entry) => {
|
|
8
8
|
const translation = translateMap(entry.translations);
|
|
9
9
|
if (translation === undefined) {
|
|
10
10
|
return undefined;
|
|
@@ -12,7 +12,7 @@ export const getCloseCombatTechniqueLibraryEntry = createLibraryEntryCreator((en
|
|
|
12
12
|
return {
|
|
13
13
|
title: translation.name,
|
|
14
14
|
className: "combat-technique close-combat-technique",
|
|
15
|
-
|
|
15
|
+
body: [
|
|
16
16
|
mapNullable(translation.special, (value) => ({
|
|
17
17
|
label: translate("Special"),
|
|
18
18
|
value,
|
|
@@ -26,13 +26,13 @@ export const getCloseCombatTechniqueLibraryEntry = createLibraryEntryCreator((en
|
|
|
26
26
|
},
|
|
27
27
|
createImprovementCost(translate, entry.improvement_cost),
|
|
28
28
|
],
|
|
29
|
-
|
|
29
|
+
references: entry.src,
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
32
|
/**
|
|
33
33
|
* Get a JSON representation of the rules text for a ranged combat technique.
|
|
34
34
|
*/
|
|
35
|
-
export const
|
|
35
|
+
export const getRangedCombatTechniqueEntityDescription = createEntityDescriptionCreator(({ getAttributeById }, { translate, translateMap }, entry) => {
|
|
36
36
|
const translation = translateMap(entry.translations);
|
|
37
37
|
if (translation === undefined) {
|
|
38
38
|
return undefined;
|
|
@@ -40,7 +40,7 @@ export const getRangedCombatTechniqueLibraryEntry = createLibraryEntryCreator((e
|
|
|
40
40
|
return {
|
|
41
41
|
title: translation.name,
|
|
42
42
|
className: "combat-technique ranged-combat-technique",
|
|
43
|
-
|
|
43
|
+
body: [
|
|
44
44
|
mapNullable(translation.special, (value) => ({
|
|
45
45
|
label: translate("Special"),
|
|
46
46
|
value,
|
|
@@ -54,6 +54,6 @@ export const getRangedCombatTechniqueLibraryEntry = createLibraryEntryCreator((e
|
|
|
54
54
|
},
|
|
55
55
|
createImprovementCost(translate, entry.improvement_cost),
|
|
56
56
|
],
|
|
57
|
-
|
|
57
|
+
references: entry.src,
|
|
58
58
|
};
|
|
59
59
|
});
|
|
@@ -2,4 +2,4 @@ import { ExperienceLevel } from "optolith-database-schema/types/ExperienceLevel"
|
|
|
2
2
|
/**
|
|
3
3
|
* Get a JSON representation of the rules text for an experience level.
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getExperienceLevelEntityDescription: import("../index.js").EntityDescriptionCreator<ExperienceLevel | undefined, object, import("../index.js").EntityDescription>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createEntityDescriptionCreator } from "../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Get a JSON representation of the rules text for an experience level.
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const getExperienceLevelEntityDescription = createEntityDescriptionCreator((_, { translate, translateMap }, entry) => {
|
|
6
6
|
const translation = translateMap(entry.translations);
|
|
7
7
|
if (translation === undefined) {
|
|
8
8
|
return undefined;
|
|
@@ -10,7 +10,7 @@ export const getExperienceLevelLibraryEntry = createLibraryEntryCreator((entry)
|
|
|
10
10
|
return {
|
|
11
11
|
title: translation.name,
|
|
12
12
|
className: "experience-level",
|
|
13
|
-
|
|
13
|
+
body: [
|
|
14
14
|
{
|
|
15
15
|
label: translate("Adventure Points"),
|
|
16
16
|
value: entry.adventure_points,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FocusRule } from "optolith-database-schema/types/rule/FocusRule";
|
|
2
|
+
import { GetById } from "../helpers/getTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get a JSON representation of the rules text for a focus rule.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getFocusRuleEntityDescription: import("../index.js").EntityDescriptionCreator<FocusRule | undefined, {
|
|
7
|
+
getSubjectById: GetById.Static.Subject;
|
|
8
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { romanize } from "@optolith/helpers/roman";
|
|
2
|
+
import { createEntityDescriptionCreator } from "../index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get a JSON representation of the rules text for a focus rule.
|
|
5
|
+
*/
|
|
6
|
+
export const getFocusRuleEntityDescription = createEntityDescriptionCreator(({ getSubjectById }, { translateMap }, entry) => {
|
|
7
|
+
const translation = translateMap(entry.translations);
|
|
8
|
+
if (translation === undefined) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
title: `${translation.name} (${romanize(entry.level)})`,
|
|
13
|
+
subtitle: translateMap(getSubjectById(entry.subject.id.subject)?.translations)?.name,
|
|
14
|
+
className: "focus-rule",
|
|
15
|
+
body: [{ value: translation.description }],
|
|
16
|
+
references: entry.src,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -6,13 +6,13 @@ import { GetById } from "../helpers/getTypes.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* Get a JSON representation of the rules text for a blessing.
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const getBlessingEntityDescription: import("../index.js").EntityDescriptionCreator<Blessing | undefined, {
|
|
10
10
|
getTargetCategoryById: GetById.Static.TargetCategory;
|
|
11
|
-
}, import("../
|
|
11
|
+
}, import("../index.js").EntityDescription>;
|
|
12
12
|
/**
|
|
13
13
|
* Get a JSON representation of the rules text for a liturgical chant.
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const getLiturgicalChantEntityDescription: import("../index.js").EntityDescriptionCreator<LiturgicalChant | undefined, {
|
|
16
16
|
getAttributeById: GetById.Static.Attribute;
|
|
17
17
|
getSpirit: () => DerivedCharacteristic | undefined;
|
|
18
18
|
getToughness: () => DerivedCharacteristic | undefined;
|
|
@@ -20,11 +20,11 @@ export declare const getLiturgicalChantLibraryEntry: import("../libraryEntry.js"
|
|
|
20
20
|
getTargetCategoryById: GetById.Static.TargetCategory;
|
|
21
21
|
getBlessedTraditionById: GetById.Static.BlessedTradition;
|
|
22
22
|
getAspectById: GetById.Static.Aspect;
|
|
23
|
-
}, import("../
|
|
23
|
+
}, import("../index.js").EntityDescription>;
|
|
24
24
|
/**
|
|
25
25
|
* Get a JSON representation of the rules text for a ceremony.
|
|
26
26
|
*/
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const getCeremonyEntityDescription: import("../index.js").EntityDescriptionCreator<Ceremony | undefined, {
|
|
28
28
|
getAttributeById: GetById.Static.Attribute;
|
|
29
29
|
getSpirit: () => DerivedCharacteristic | undefined;
|
|
30
30
|
getToughness: () => DerivedCharacteristic | undefined;
|
|
@@ -32,4 +32,4 @@ export declare const getCeremonyLibraryEntry: import("../libraryEntry.js").Libra
|
|
|
32
32
|
getTargetCategoryById: GetById.Static.TargetCategory;
|
|
33
33
|
getBlessedTraditionById: GetById.Static.BlessedTradition;
|
|
34
34
|
getAspectById: GetById.Static.Aspect;
|
|
35
|
-
}, import("../
|
|
35
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isNotNullish } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createEntityDescriptionCreator, } from "../index.js";
|
|
4
|
+
import { getDurationTranslationForBlessing } from "./partial/rated/activatable/duration.js";
|
|
5
5
|
import { getTextForEffect } from "./partial/rated/activatable/effect.js";
|
|
6
6
|
import { Entity } from "./partial/rated/activatable/entity.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getFastOneTimePerformanceParametersTranslations, getFastSustainedPerformanceParametersTranslations, getSlowOneTimePerformanceParametersTranslations, getSlowSustainedPerformanceParametersTranslations, } from "./partial/rated/activatable/index.js";
|
|
8
8
|
import { getTextForBlessingRange } from "./partial/rated/activatable/range.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getTargetCategoryTranslation } from "./partial/rated/activatable/targetCategory.js";
|
|
10
10
|
import { createImprovementCost } from "./partial/rated/improvementCost.js";
|
|
11
11
|
import { getTextForCheck } from "./partial/rated/skillCheck.js";
|
|
12
12
|
import { ResponsiveTextSize } from "./partial/responsiveText.js";
|
|
@@ -46,21 +46,18 @@ const getTextForTraditions = (deps, values) => {
|
|
|
46
46
|
/**
|
|
47
47
|
* Get a JSON representation of the rules text for a blessing.
|
|
48
48
|
*/
|
|
49
|
-
export const
|
|
49
|
+
export const getBlessingEntityDescription = createEntityDescriptionCreator(({ getTargetCategoryById }, locale, entry) => {
|
|
50
|
+
const { translate, translateMap } = locale;
|
|
50
51
|
const translation = translateMap(entry.translations);
|
|
51
52
|
if (translation === undefined) {
|
|
52
53
|
return undefined;
|
|
53
54
|
}
|
|
54
|
-
const range = getTextForBlessingRange(
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
const duration = getTextForBlessingDuration({ translate, translateMap }, entry.parameters.duration, {
|
|
58
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
59
|
-
});
|
|
55
|
+
const range = getTextForBlessingRange(locale, ResponsiveTextSize.Full, entry.parameters.range);
|
|
56
|
+
const duration = getDurationTranslationForBlessing(locale, ResponsiveTextSize.Full, entry.parameters.duration);
|
|
60
57
|
return {
|
|
61
58
|
title: translation.name,
|
|
62
59
|
className: "blessing",
|
|
63
|
-
|
|
60
|
+
body: [
|
|
64
61
|
{
|
|
65
62
|
label: translate("Effect"),
|
|
66
63
|
value: translation.effect,
|
|
@@ -77,15 +74,16 @@ export const getBlessingLibraryEntry = createLibraryEntryCreator((entry, { getTa
|
|
|
77
74
|
? `***${duration}*** (${translation.duration})`
|
|
78
75
|
: duration,
|
|
79
76
|
},
|
|
80
|
-
|
|
77
|
+
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
81
78
|
],
|
|
82
|
-
|
|
79
|
+
references: entry.src,
|
|
83
80
|
};
|
|
84
81
|
});
|
|
85
82
|
/**
|
|
86
83
|
* Get a JSON representation of the rules text for a liturgical chant.
|
|
87
84
|
*/
|
|
88
|
-
export const
|
|
85
|
+
export const getLiturgicalChantEntityDescription = createEntityDescriptionCreator(({ getAttributeById, getSpirit, getToughness, getSkillModificationLevelById, getTargetCategoryById, getBlessedTraditionById, getAspectById, }, locale, entry) => {
|
|
86
|
+
const { translate, translateMap, compare: localeCompare } = locale;
|
|
89
87
|
const translation = translateMap(entry.translations);
|
|
90
88
|
if (translation === undefined) {
|
|
91
89
|
return undefined;
|
|
@@ -93,23 +91,9 @@ export const getLiturgicalChantLibraryEntry = createLibraryEntryCreator((entry,
|
|
|
93
91
|
const { castingTime, cost, range, duration } = (() => {
|
|
94
92
|
switch (entry.parameters.tag) {
|
|
95
93
|
case "OneTime":
|
|
96
|
-
return
|
|
97
|
-
getSkillModificationLevelById,
|
|
98
|
-
translate,
|
|
99
|
-
translateMap,
|
|
100
|
-
}, entry.parameters.one_time, {
|
|
101
|
-
entity: Entity.LiturgicalChant,
|
|
102
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
103
|
-
});
|
|
94
|
+
return getFastOneTimePerformanceParametersTranslations(getSkillModificationLevelById, locale, Entity.LiturgicalChant, ResponsiveTextSize.Full, entry.parameters.one_time);
|
|
104
95
|
case "Sustained":
|
|
105
|
-
return
|
|
106
|
-
getSkillModificationLevelById,
|
|
107
|
-
translate,
|
|
108
|
-
translateMap,
|
|
109
|
-
}, entry.parameters.sustained, {
|
|
110
|
-
entity: Entity.LiturgicalChant,
|
|
111
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
112
|
-
});
|
|
96
|
+
return getFastSustainedPerformanceParametersTranslations(getSkillModificationLevelById, locale, Entity.LiturgicalChant, ResponsiveTextSize.Full, entry.parameters.sustained);
|
|
113
97
|
default:
|
|
114
98
|
return assertExhaustive(entry.parameters);
|
|
115
99
|
}
|
|
@@ -117,14 +101,14 @@ export const getLiturgicalChantLibraryEntry = createLibraryEntryCreator((entry,
|
|
|
117
101
|
return {
|
|
118
102
|
title: translation.name,
|
|
119
103
|
className: "liturgical-chant",
|
|
120
|
-
|
|
104
|
+
body: [
|
|
121
105
|
getTextForCheck({ translate, translateMap, getAttributeById }, entry.check, {
|
|
122
106
|
value: entry.check_penalty,
|
|
123
107
|
responsiveText: ResponsiveTextSize.Full,
|
|
124
108
|
getSpirit,
|
|
125
109
|
getToughness,
|
|
126
110
|
}),
|
|
127
|
-
...getTextForEffect(translation.effect
|
|
111
|
+
...getTextForEffect(locale, translation.effect),
|
|
128
112
|
{
|
|
129
113
|
label: translate("Liturgical Time"),
|
|
130
114
|
value: castingTime !== translation.casting_time.full
|
|
@@ -149,7 +133,7 @@ export const getLiturgicalChantLibraryEntry = createLibraryEntryCreator((entry,
|
|
|
149
133
|
? `***${duration}*** (${translation.duration.full})`
|
|
150
134
|
: duration,
|
|
151
135
|
},
|
|
152
|
-
|
|
136
|
+
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
153
137
|
getTextForTraditions({
|
|
154
138
|
translate,
|
|
155
139
|
translateMap,
|
|
@@ -159,13 +143,14 @@ export const getLiturgicalChantLibraryEntry = createLibraryEntryCreator((entry,
|
|
|
159
143
|
}, entry.traditions),
|
|
160
144
|
createImprovementCost(translate, entry.improvement_cost),
|
|
161
145
|
],
|
|
162
|
-
|
|
146
|
+
references: entry.src,
|
|
163
147
|
};
|
|
164
148
|
});
|
|
165
149
|
/**
|
|
166
150
|
* Get a JSON representation of the rules text for a ceremony.
|
|
167
151
|
*/
|
|
168
|
-
export const
|
|
152
|
+
export const getCeremonyEntityDescription = createEntityDescriptionCreator(({ getAttributeById, getSpirit, getToughness, getSkillModificationLevelById, getTargetCategoryById, getBlessedTraditionById, getAspectById, }, locale, entry) => {
|
|
153
|
+
const { translate, translateMap, compare: localeCompare } = locale;
|
|
169
154
|
const translation = translateMap(entry.translations);
|
|
170
155
|
if (translation === undefined) {
|
|
171
156
|
return undefined;
|
|
@@ -173,23 +158,9 @@ export const getCeremonyLibraryEntry = createLibraryEntryCreator((entry, { getAt
|
|
|
173
158
|
const { castingTime, cost, range, duration } = (() => {
|
|
174
159
|
switch (entry.parameters.tag) {
|
|
175
160
|
case "OneTime":
|
|
176
|
-
return
|
|
177
|
-
getSkillModificationLevelById,
|
|
178
|
-
translate,
|
|
179
|
-
translateMap,
|
|
180
|
-
}, entry.parameters.one_time, {
|
|
181
|
-
entity: Entity.Ceremony,
|
|
182
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
183
|
-
});
|
|
161
|
+
return getSlowOneTimePerformanceParametersTranslations(getSkillModificationLevelById, locale, Entity.Ritual, ResponsiveTextSize.Full, entry.parameters.one_time);
|
|
184
162
|
case "Sustained":
|
|
185
|
-
return
|
|
186
|
-
getSkillModificationLevelById,
|
|
187
|
-
translate,
|
|
188
|
-
translateMap,
|
|
189
|
-
}, entry.parameters.sustained, {
|
|
190
|
-
entity: Entity.Ceremony,
|
|
191
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
192
|
-
});
|
|
163
|
+
return getSlowSustainedPerformanceParametersTranslations(getSkillModificationLevelById, locale, Entity.Ceremony, ResponsiveTextSize.Full, entry.parameters.sustained);
|
|
193
164
|
default:
|
|
194
165
|
return assertExhaustive(entry.parameters);
|
|
195
166
|
}
|
|
@@ -197,14 +168,14 @@ export const getCeremonyLibraryEntry = createLibraryEntryCreator((entry, { getAt
|
|
|
197
168
|
return {
|
|
198
169
|
title: translation.name,
|
|
199
170
|
className: "ceremony",
|
|
200
|
-
|
|
171
|
+
body: [
|
|
201
172
|
getTextForCheck({ translate, translateMap, getAttributeById }, entry.check, {
|
|
202
173
|
value: entry.check_penalty,
|
|
203
174
|
responsiveText: ResponsiveTextSize.Full,
|
|
204
175
|
getSpirit,
|
|
205
176
|
getToughness,
|
|
206
177
|
}),
|
|
207
|
-
...getTextForEffect(translation.effect
|
|
178
|
+
...getTextForEffect(locale, translation.effect),
|
|
208
179
|
{
|
|
209
180
|
label: translate("Ceremonial Time"),
|
|
210
181
|
value: castingTime !== translation.casting_time.full
|
|
@@ -229,7 +200,7 @@ export const getCeremonyLibraryEntry = createLibraryEntryCreator((entry, { getAt
|
|
|
229
200
|
? `***${duration}*** (${translation.duration.full})`
|
|
230
201
|
: duration,
|
|
231
202
|
},
|
|
232
|
-
|
|
203
|
+
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
233
204
|
getTextForTraditions({
|
|
234
205
|
translate,
|
|
235
206
|
translateMap,
|
|
@@ -239,6 +210,6 @@ export const getCeremonyLibraryEntry = createLibraryEntryCreator((entry, { getAt
|
|
|
239
210
|
}, entry.traditions),
|
|
240
211
|
createImprovementCost(translate, entry.improvement_cost),
|
|
241
212
|
],
|
|
242
|
-
|
|
213
|
+
references: entry.src,
|
|
243
214
|
};
|
|
244
215
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OptionalRule } from "optolith-database-schema/types/rule/OptionalRule";
|
|
2
|
+
/**
|
|
3
|
+
* Get a JSON representation of the rules text for an optional rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getOptionalRuleEntityDescription: import("../index.js").EntityDescriptionCreator<OptionalRule | undefined, object, import("../index.js").EntityDescription>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createEntityDescriptionCreator } from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get a JSON representation of the rules text for an optional rule.
|
|
4
|
+
*/
|
|
5
|
+
export const getOptionalRuleEntityDescription = createEntityDescriptionCreator((_, { translateMap }, entry) => {
|
|
6
|
+
const translation = translateMap(entry.translations);
|
|
7
|
+
if (translation === undefined) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
title: translation.name,
|
|
12
|
+
className: "optional-rule",
|
|
13
|
+
body: [{ value: translation.description }],
|
|
14
|
+
references: entry.src,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { FastCastingTime, SlowCastingTime } from "optolith-database-schema/types/_ActivatableSkillCastingTime";
|
|
2
2
|
import { GetById } from "../../../../helpers/getTypes.js";
|
|
3
|
-
import {
|
|
3
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
4
|
import { ResponsiveTextSize } from "../../responsiveText.js";
|
|
5
5
|
import { Entity } from "./entity.js";
|
|
6
6
|
/**
|
|
7
7
|
* Get the text for the casting time of a fast activatable skill.
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
10
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
11
|
-
translate: Translate;
|
|
12
|
-
}, value: FastCastingTime, env: {
|
|
13
|
-
entity: Entity;
|
|
14
|
-
responsiveText: ResponsiveTextSize;
|
|
15
|
-
}) => string;
|
|
9
|
+
export declare const getFastCastingTimeTranslation: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: FastCastingTime) => string;
|
|
16
10
|
/**
|
|
17
11
|
* Get the text for the casting time of a slow activatable skill.
|
|
18
12
|
*/
|
|
19
|
-
export declare const
|
|
20
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
21
|
-
translate: Translate;
|
|
22
|
-
}, value: SlowCastingTime, env: {
|
|
23
|
-
entity: Entity;
|
|
24
|
-
responsiveText: ResponsiveTextSize;
|
|
25
|
-
}) => string;
|
|
13
|
+
export declare const getSlowCastingTimeTranslation: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SlowCastingTime) => string;
|
|
@@ -1,50 +1,35 @@
|
|
|
1
1
|
import { isNotNullish, mapNullable } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
+
import { formatTimeSpan } from "../../units/timeSpan.js";
|
|
3
4
|
import { MISSING_VALUE } from "../../unknown.js";
|
|
4
|
-
import { ModifiableParameter } from "./
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
case Speed.Fast:
|
|
11
|
-
return formatTimeSpan(deps.translate, env.responsiveText, "Actions", fastTime);
|
|
12
|
-
case Speed.Slow:
|
|
13
|
-
return formatTimeSpan(deps.translate, env.responsiveText, slowTime.unit, slowTime.value);
|
|
14
|
-
default:
|
|
15
|
-
return assertExhaustive(env.speed);
|
|
16
|
-
}
|
|
17
|
-
}) ?? MISSING_VALUE;
|
|
18
|
-
const getTextForFastSkillNonModifiableCastingTime = (deps, value, env) => formatTimeSpan(deps.translate, env.responsiveText, "Actions", value.actions) +
|
|
19
|
-
getTextForNonModifiableSuffix(deps.translate, env.entity, ModifiableParameter.CastingTime, env.responsiveText);
|
|
20
|
-
const getTextForSlowSkillNonModifiableCastingTime = (deps, value, env) => formatTimeSpan(deps.translate, env.responsiveText, value.unit, value.value) +
|
|
21
|
-
getTextForNonModifiableSuffix(deps.translate, env.entity, ModifiableParameter.CastingTime, env.responsiveText);
|
|
22
|
-
const getTextForCastingTime = (deps, value, env, getTextForNonModifiableCastingTime) => {
|
|
5
|
+
import { getNonModifiableSuffixTranslation, ModifiableParameter, } from "./nonModifiableSuffix.js";
|
|
6
|
+
import { getModifiableBySpeed, Speed } from "./speed.js";
|
|
7
|
+
const getModifiableCastingTimeTranslation = (getSkillModificationLevelById, locale, speed, responsiveTextSize, value) => mapNullable(getSkillModificationLevelById(value.initial_modification_level), (modificationLevel) => getModifiableBySpeed((config) => formatTimeSpan(locale, responsiveTextSize, "Actions", config.casting_time), (config) => formatTimeSpan(locale, responsiveTextSize, config.casting_time.unit, config.casting_time.value), speed, modificationLevel)) ?? MISSING_VALUE;
|
|
8
|
+
const getFastSkillNonModifiableCastingTimeTranslation = (locale, responsiveTextSize, value) => formatTimeSpan(locale, responsiveTextSize, "Actions", value.actions);
|
|
9
|
+
const getSlowSkillNonModifiableCastingTimeTranslation = (locale, responsiveTextSize, value) => formatTimeSpan(locale, responsiveTextSize, value.unit, value.value);
|
|
10
|
+
const getCastingTimeTranslation = (getNonModifiableCastingTimeTranslation, getSkillModificationLevelById, locale, speed, entity, responsiveTextSize, value) => {
|
|
23
11
|
switch (value.tag) {
|
|
24
12
|
case "Modifiable":
|
|
25
|
-
return
|
|
13
|
+
return getModifiableCastingTimeTranslation(getSkillModificationLevelById, locale, speed, responsiveTextSize, value.modifiable);
|
|
26
14
|
case "NonModifiable":
|
|
27
|
-
return
|
|
15
|
+
return (getNonModifiableCastingTimeTranslation(value.non_modifiable) +
|
|
16
|
+
getNonModifiableSuffixTranslation(locale, entity, ModifiableParameter.CastingTime, responsiveTextSize));
|
|
28
17
|
default:
|
|
29
18
|
return assertExhaustive(value);
|
|
30
19
|
}
|
|
31
20
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export const getTextForFastCastingTime = (deps, value, env) => [
|
|
37
|
-
mapNullable(value.default, (def) => getTextForCastingTime(deps, def, { ...env, speed: Speed.Fast }, (nonModifiableValue) => getTextForFastSkillNonModifiableCastingTime(deps, nonModifiableValue, env))),
|
|
38
|
-
mapNullable(value.during_lovemaking, (duringLovemaking) => getTextForCastingTimeDuringLovemaking(deps, duringLovemaking, env)),
|
|
21
|
+
const getCastingTimeDuringLovemakingTranslation = (locale, responsiveTextSize, value) => formatTimeSpan(locale, responsiveTextSize, value.unit, value.value);
|
|
22
|
+
const getCastingTimeIncludingLovemakingTranslation = (getNonModifiableCastingTimeTranslation, getSkillModificationLevelById, locale, speed, entity, responsiveTextSize, value) => [
|
|
23
|
+
mapNullable(value.default, (def) => getCastingTimeTranslation(getNonModifiableCastingTimeTranslation, getSkillModificationLevelById, locale, speed, entity, responsiveTextSize, def)),
|
|
24
|
+
mapNullable(value.during_lovemaking, (duringLovemaking) => getCastingTimeDuringLovemakingTranslation(locale, responsiveTextSize, duringLovemaking)),
|
|
39
25
|
]
|
|
40
26
|
.filter(isNotNullish)
|
|
41
27
|
.join(" / ");
|
|
28
|
+
/**
|
|
29
|
+
* Get the text for the casting time of a fast activatable skill.
|
|
30
|
+
*/
|
|
31
|
+
export const getFastCastingTimeTranslation = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => getCastingTimeIncludingLovemakingTranslation((nonModifiableValue) => getFastSkillNonModifiableCastingTimeTranslation(locale, responsiveTextSize, nonModifiableValue), getSkillModificationLevelById, locale, Speed.Fast, entity, responsiveTextSize, value);
|
|
42
32
|
/**
|
|
43
33
|
* Get the text for the casting time of a slow activatable skill.
|
|
44
34
|
*/
|
|
45
|
-
export const
|
|
46
|
-
mapNullable(value.default, (def) => getTextForCastingTime(deps, def, { ...env, speed: Speed.Slow }, (nonModifiableValue) => getTextForSlowSkillNonModifiableCastingTime(deps, nonModifiableValue, env))),
|
|
47
|
-
mapNullable(value.during_lovemaking, (duringLovemaking) => getTextForCastingTimeDuringLovemaking(deps, duringLovemaking, env)),
|
|
48
|
-
]
|
|
49
|
-
.filter(isNotNullish)
|
|
50
|
-
.join(" / ");
|
|
35
|
+
export const getSlowCastingTimeTranslation = (getSkillModificationLevelById, locale, entity, responsiveTextSize, value) => getCastingTimeIncludingLovemakingTranslation((nonModifiableValue) => getSlowSkillNonModifiableCastingTimeTranslation(locale, responsiveTextSize, nonModifiableValue), getSkillModificationLevelById, locale, Speed.Slow, entity, responsiveTextSize, value);
|
|
@@ -4,4 +4,4 @@ import { Translate } from "../../../../helpers/translate.js";
|
|
|
4
4
|
* Returns the value text for a check-result-based parameter of an activatable
|
|
5
5
|
* skill.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getCheckResultBasedValueTranslation: (translate: Translate, value: CheckResultBased) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mapNullableDefault } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
const
|
|
3
|
+
const getCheckResultBaseValueTranslation = (translate, baseValue) => {
|
|
4
4
|
switch (baseValue) {
|
|
5
5
|
case "QualityLevels":
|
|
6
6
|
return translate("QL");
|
|
@@ -24,5 +24,5 @@ const getArithmeticSymbol = (arithmetic) => {
|
|
|
24
24
|
* Returns the value text for a check-result-based parameter of an activatable
|
|
25
25
|
* skill.
|
|
26
26
|
*/
|
|
27
|
-
export const
|
|
27
|
+
export const getCheckResultBasedValueTranslation = (translate, value) => getCheckResultBaseValueTranslation(translate, value.base) +
|
|
28
28
|
mapNullableDefault(value.modifier, (modifier) => getArithmeticSymbol(modifier.arithmetic) + modifier.value, "");
|
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
import { OneTimeCost, SustainedCost } from "optolith-database-schema/types/_ActivatableSkillCost";
|
|
2
2
|
import { GetById } from "../../../../helpers/getTypes.js";
|
|
3
|
-
import {
|
|
3
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
4
|
import { ResponsiveTextSize } from "../../responsiveText.js";
|
|
5
5
|
import { Entity } from "./entity.js";
|
|
6
6
|
import { Speed } from "./speed.js";
|
|
7
7
|
/**
|
|
8
8
|
* Returns the text for the cost of a one-time activatable skill.
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
11
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
12
|
-
translate: Translate;
|
|
13
|
-
translateMap: TranslateMap;
|
|
14
|
-
}, value: OneTimeCost, env: {
|
|
15
|
-
speed: Speed;
|
|
16
|
-
responsiveText: ResponsiveTextSize;
|
|
17
|
-
entity: Entity;
|
|
18
|
-
}) => string;
|
|
10
|
+
export declare const getOneTimeCostTranslation: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: OneTimeCost) => string;
|
|
19
11
|
/**
|
|
20
12
|
* Returns the text for the cost of a sustained activatable skill.
|
|
21
13
|
*/
|
|
22
|
-
export declare const
|
|
23
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
24
|
-
translate: Translate;
|
|
25
|
-
translateMap: TranslateMap;
|
|
26
|
-
}, value: SustainedCost, env: {
|
|
27
|
-
speed: Speed;
|
|
28
|
-
responsiveText: ResponsiveTextSize;
|
|
29
|
-
entity: Entity;
|
|
30
|
-
}) => string;
|
|
14
|
+
export declare const getSustainedCostTranslation: (getSkillModificationLevelById: GetById.Static.SkillModificationLevel, locale: LocaleEnvironment, speed: Speed, entity: Entity, responsiveTextSize: ResponsiveTextSize, value: SustainedCost) => string;
|