@optolith/entity-descriptions 0.2.1 → 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.
- package/CHANGELOG.md +58 -0
- package/lib/creator.d.ts +32 -0
- package/lib/creator.js +72 -0
- package/lib/entities/activatable.d.ts +52 -0
- package/lib/entities/activatable.js +609 -0
- package/lib/entities/alternativeRule.d.ts +7 -0
- package/lib/entities/alternativeRule.js +21 -0
- package/lib/entities/attribute.d.ts +6 -0
- package/lib/entities/attribute.js +15 -0
- package/lib/entities/combatTechnique.d.ts +5 -7
- package/lib/entities/combatTechnique.js +34 -24
- package/lib/entities/condition.d.ts +12 -0
- package/lib/entities/condition.js +63 -0
- package/lib/entities/culture.d.ts +8 -0
- package/lib/entities/culture.js +309 -0
- package/lib/entities/curriculum.d.ts +11 -0
- package/lib/entities/curriculum.js +266 -0
- package/lib/entities/derivedCharacteristic.d.ts +9 -0
- package/lib/entities/derivedCharacteristic.js +91 -0
- package/lib/entities/disease.d.ts +9 -0
- package/lib/entities/disease.js +88 -0
- package/lib/entities/elixir.d.ts +10 -0
- package/lib/entities/elixir.js +76 -0
- package/lib/entities/equipment.d.ts +24 -0
- package/lib/entities/equipment.js +613 -0
- package/lib/entities/equipmentPackage.d.ts +8 -0
- package/lib/entities/equipmentPackage.js +301 -0
- package/lib/entities/experienceLevel.d.ts +3 -2
- package/lib/entities/experienceLevel.js +33 -28
- package/lib/entities/focusRule.d.ts +3 -4
- package/lib/entities/focusRule.js +13 -5
- package/lib/entities/influence.d.ts +7 -0
- package/lib/entities/influence.js +35 -0
- package/lib/entities/liturgicalChant.d.ts +10 -23
- package/lib/entities/liturgicalChant.js +169 -131
- package/lib/entities/optionalRule.d.ts +3 -2
- package/lib/entities/optionalRule.js +4 -3
- package/lib/entities/partial/activatableNameChunks.d.ts +58 -0
- package/lib/entities/partial/activatableNameChunks.js +356 -0
- package/lib/entities/partial/adventurePointsValue.d.ts +9 -0
- package/lib/entities/partial/adventurePointsValue.js +243 -0
- package/lib/entities/partial/animalTypes.d.ts +11 -0
- package/lib/entities/partial/animalTypes.js +13 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +16 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +40 -0
- package/lib/entities/partial/dice.d.ts +10 -0
- package/lib/entities/partial/dice.js +13 -0
- package/lib/entities/partial/herbary.d.ts +28 -0
- package/lib/entities/partial/herbary.js +65 -0
- package/lib/entities/partial/map.d.ts +49 -0
- package/lib/entities/partial/map.js +43 -0
- package/lib/entities/partial/mathOperation.d.ts +36 -0
- package/lib/entities/partial/mathOperation.js +107 -0
- package/lib/entities/partial/prerequisites/displayOption.d.ts +7 -0
- package/lib/entities/partial/prerequisites/displayOption.js +19 -0
- package/lib/entities/partial/prerequisites/index.d.ts +67 -0
- package/lib/entities/partial/prerequisites/index.js +189 -0
- package/lib/entities/partial/prerequisites/part.d.ts +26 -0
- package/lib/entities/partial/prerequisites/part.js +88 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +65 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +269 -0
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +18 -0
- package/lib/entities/partial/prerequisites/single/activatable.js +40 -0
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/animistPower.js +23 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +32 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +19 -0
- package/lib/entities/partial/prerequisites/single/culture.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/culture.js +20 -0
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/enhancement.js +41 -0
- package/lib/entities/partial/prerequisites/single/influence.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/influence.js +17 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +27 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +8 -0
- package/lib/entities/partial/prerequisites/single/pact.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/pact.js +30 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +28 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +15 -0
- package/lib/entities/partial/prerequisites/single/publication.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/publication.js +19 -0
- package/lib/entities/partial/prerequisites/single/race.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/race.js +20 -0
- package/lib/entities/partial/prerequisites/single/rated.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/rated.js +41 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +89 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.js +21 -0
- package/lib/entities/partial/prerequisites/single/rule.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/rule.js +4 -0
- package/lib/entities/partial/prerequisites/single/sex.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sex.js +19 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +21 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.js +21 -0
- package/lib/entities/partial/prerequisites/single/state.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/state.js +20 -0
- package/lib/entities/partial/prerequisites/single/text.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/text.js +9 -0
- package/lib/entities/partial/professions.d.ts +15 -0
- package/lib/entities/partial/professions.js +19 -0
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +16 -7
- package/lib/entities/partial/rated/activatable/castingTime.js +35 -20
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +18 -3
- package/lib/entities/partial/rated/activatable/checkResultBased.js +18 -10
- package/lib/entities/partial/rated/activatable/cost.d.ts +88 -8
- package/lib/entities/partial/rated/activatable/cost.js +183 -115
- package/lib/entities/partial/rated/activatable/duration.d.ts +36 -13
- package/lib/entities/partial/rated/activatable/duration.js +72 -61
- package/lib/entities/partial/rated/activatable/effect.d.ts +4 -4
- package/lib/entities/partial/rated/activatable/effect.js +32 -25
- package/lib/entities/partial/rated/activatable/index.d.ts +31 -27
- package/lib/entities/partial/rated/activatable/index.js +63 -28
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +5 -6
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +8 -5
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +2 -4
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +7 -42
- package/lib/entities/partial/rated/activatable/range.d.ts +22 -14
- package/lib/entities/partial/rated/activatable/range.js +54 -54
- package/lib/entities/partial/rated/activatable/speed.d.ts +11 -2
- package/lib/entities/partial/rated/activatable/speed.js +14 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +4 -5
- package/lib/entities/partial/rated/activatable/targetCategory.js +19 -24
- package/lib/entities/partial/rated/improvementCost.d.ts +16 -4
- package/lib/entities/partial/rated/improvementCost.js +63 -4
- package/lib/entities/partial/rated/skillCheck.d.ts +20 -17
- package/lib/entities/partial/rated/skillCheck.js +56 -54
- package/lib/entities/partial/reader.d.ts +266 -0
- package/lib/entities/partial/reader.js +175 -0
- package/lib/entities/partial/responsiveText.d.ts +10 -5
- package/lib/entities/partial/responsiveText.js +19 -3
- package/lib/entities/partial/units/energy.d.ts +5 -8
- package/lib/entities/partial/units/energy.js +5 -23
- package/lib/entities/partial/units/length.d.ts +20 -2
- package/lib/entities/partial/units/length.js +24 -5
- package/lib/entities/partial/units/timeSpan.d.ts +25 -4
- package/lib/entities/partial/units/timeSpan.js +27 -15
- package/lib/entities/partial/unknown.d.ts +5 -1
- package/lib/entities/partial/unknown.js +5 -1
- package/lib/entities/personalityTrait.d.ts +7 -0
- package/lib/entities/personalityTrait.js +56 -0
- package/lib/entities/poison.d.ts +12 -0
- package/lib/entities/poison.js +356 -0
- package/lib/entities/profession.d.ts +12 -0
- package/lib/entities/profession.js +585 -0
- package/lib/entities/race.d.ts +9 -0
- package/lib/entities/race.js +146 -0
- package/lib/entities/sexPractice.d.ts +6 -0
- package/lib/entities/sexPractice.js +33 -0
- package/lib/entities/skill.d.ts +9 -9
- package/lib/entities/skill.js +124 -91
- package/lib/entities/spell.d.ts +83 -26
- package/lib/entities/spell.js +835 -147
- package/lib/entities/state.d.ts +6 -0
- package/lib/entities/state.js +17 -0
- package/lib/helpers/enums.d.ts +11 -0
- package/lib/helpers/enums.js +6 -0
- package/lib/helpers/getTypes.d.ts +12 -482
- package/lib/helpers/getTypes.js +1 -0
- package/lib/helpers/identifiers.d.ts +314 -0
- package/lib/helpers/identifiers.js +333 -0
- package/lib/helpers/locale.d.ts +21 -2
- package/lib/helpers/translate.d.ts +47 -5
- package/lib/helpers/translate.js +13 -6
- package/lib/index.d.ts +848 -21
- package/lib/index.js +182 -17
- package/lib/references/index.d.ts +6 -3
- package/lib/references/index.js +25 -33
- package/lib/references/page.d.ts +1 -1
- package/lib/references/page.js +14 -14
- package/lib/references/pageRange.d.ts +1 -5
- package/lib/references/pageRange.js +7 -16
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -10
- package/.prettierrc.yml +0 -1
- package/lib/entities/partial/rated/activatable/entity.d.ts +0 -11
- package/lib/entities/partial/rated/activatable/entity.js +0 -12
- package/lib/references/occurrence.d.ts +0 -4
- package/lib/references/occurrence.js +0 -3
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { isNotNullish } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
import { createEntityDescriptionCreator
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
3
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
4
|
+
import { renderOneTimeDuration } from "./partial/rated/activatable/duration.js";
|
|
5
|
+
import { renderEffect } from "./partial/rated/activatable/effect.js";
|
|
6
|
+
import { renderFastPerformanceParameters, renderSlowPerformanceParameters, } from "./partial/rated/activatable/index.js";
|
|
7
|
+
import { ModifiableParameter } from "./partial/rated/activatable/nonModifiableSuffix.js";
|
|
8
|
+
import { renderNonModifiableRange } from "./partial/rated/activatable/range.js";
|
|
9
|
+
import { renderTargetCategory } from "./partial/rated/activatable/targetCategory.js";
|
|
10
|
+
import { renderImprovementCost } from "./partial/rated/improvementCost.js";
|
|
11
|
+
import { renderSkillCheckWithPenalty } from "./partial/rated/skillCheck.js";
|
|
12
12
|
import { ResponsiveTextSize } from "./partial/responsiveText.js";
|
|
13
13
|
const getTextForTraditions = (deps, values) => {
|
|
14
|
-
const getAspectName = (
|
|
14
|
+
const getAspectName = (aspectId) => deps.translateMap(deps.getInstanceById("Aspect", aspectId)?.translations)
|
|
15
|
+
?.name;
|
|
15
16
|
const text = values
|
|
16
|
-
.map(
|
|
17
|
-
switch (trad.
|
|
17
|
+
.map(trad => {
|
|
18
|
+
switch (trad.kind) {
|
|
18
19
|
case "GeneralAspect":
|
|
19
|
-
return getAspectName(trad.
|
|
20
|
+
return getAspectName(trad.GeneralAspect);
|
|
20
21
|
case "Tradition": {
|
|
21
|
-
const traditionTranslation = deps.translateMap(deps.
|
|
22
|
+
const traditionTranslation = deps.translateMap(deps.getInstanceById("BlessedTradition", trad.Tradition.tradition)
|
|
23
|
+
?.translations);
|
|
22
24
|
const name = traditionTranslation?.name_compressed ?? traditionTranslation?.name;
|
|
23
25
|
if (name === undefined) {
|
|
24
26
|
return undefined;
|
|
25
27
|
}
|
|
26
|
-
const aspects = trad.
|
|
28
|
+
const aspects = trad.Tradition.aspects
|
|
27
29
|
?.map(getAspectName)
|
|
28
30
|
.filter(isNotNullish)
|
|
29
31
|
.sort(deps.localeCompare) ?? [];
|
|
@@ -46,170 +48,206 @@ const getTextForTraditions = (deps, values) => {
|
|
|
46
48
|
/**
|
|
47
49
|
* Get a JSON representation of the rules text for a blessing.
|
|
48
50
|
*/
|
|
49
|
-
export const getBlessingEntityDescription = createEntityDescriptionCreator(({
|
|
51
|
+
export const getBlessingEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content: entry }) => {
|
|
50
52
|
const { translate, translateMap } = locale;
|
|
51
53
|
const translation = translateMap(entry.translations);
|
|
52
54
|
if (translation === undefined) {
|
|
53
55
|
return undefined;
|
|
54
56
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
+
const env = {
|
|
58
|
+
translate,
|
|
59
|
+
translateMap,
|
|
60
|
+
getInstanceById,
|
|
61
|
+
responsiveTextSize: ResponsiveTextSize.Full,
|
|
62
|
+
};
|
|
63
|
+
const range = renderNonModifiableRange(entry.parameters.range, false).run(env);
|
|
64
|
+
const duration = renderOneTimeDuration(entry.parameters.duration).run(env);
|
|
57
65
|
return {
|
|
58
66
|
title: translation.name,
|
|
59
67
|
className: "blessing",
|
|
60
68
|
body: [
|
|
61
69
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
type: "definitionList",
|
|
71
|
+
items: [
|
|
72
|
+
{
|
|
73
|
+
label: translate("Effect"),
|
|
74
|
+
value: translation.effect,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: translate("Range"),
|
|
78
|
+
value: range !== translation.range
|
|
79
|
+
? `***${range}*** (${translation.range})`
|
|
80
|
+
: range,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: translate("Duration"),
|
|
84
|
+
value: duration !== translation.duration
|
|
85
|
+
? `***${duration}*** (${translation.duration})`
|
|
86
|
+
: duration,
|
|
87
|
+
},
|
|
88
|
+
renderTargetCategory(entry.target).run(env),
|
|
89
|
+
],
|
|
70
90
|
},
|
|
71
|
-
{
|
|
72
|
-
label: translate("Duration"),
|
|
73
|
-
value: duration !== translation.duration
|
|
74
|
-
? `***${duration}*** (${translation.duration})`
|
|
75
|
-
: duration,
|
|
76
|
-
},
|
|
77
|
-
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
78
91
|
],
|
|
92
|
+
errata: translation.errata,
|
|
79
93
|
references: entry.src,
|
|
80
94
|
};
|
|
81
95
|
});
|
|
82
96
|
/**
|
|
83
97
|
* Get a JSON representation of the rules text for a liturgical chant.
|
|
84
98
|
*/
|
|
85
|
-
export const getLiturgicalChantEntityDescription = createEntityDescriptionCreator(({
|
|
99
|
+
export const getLiturgicalChantEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
|
|
86
100
|
const { translate, translateMap, compare: localeCompare } = locale;
|
|
87
101
|
const translation = translateMap(entry.translations);
|
|
88
102
|
if (translation === undefined) {
|
|
89
103
|
return undefined;
|
|
90
104
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
const env = {
|
|
106
|
+
translate,
|
|
107
|
+
translateMap,
|
|
108
|
+
getInstanceById,
|
|
109
|
+
localeJoin: locale.join,
|
|
110
|
+
energyUnit: "KarmaPoints",
|
|
111
|
+
responsiveTextSize: ResponsiveTextSize.Full,
|
|
112
|
+
nonModifiableSuffix: (param) => {
|
|
113
|
+
switch (param) {
|
|
114
|
+
case ModifiableParameter.CastingTime:
|
|
115
|
+
return " (you cannot use a modification on this chant’s liturgical time)";
|
|
116
|
+
case ModifiableParameter.Cost:
|
|
117
|
+
return " (you cannot use a modification on this chant’s cost)";
|
|
118
|
+
case ModifiableParameter.Range:
|
|
119
|
+
return " (you cannot use a modification on this chant’s range)";
|
|
120
|
+
default:
|
|
121
|
+
return assertExhaustive(param);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const { castingTime, cost, range, duration } = renderFastPerformanceParameters(entry.parameters).run(env);
|
|
101
126
|
return {
|
|
102
127
|
title: translation.name,
|
|
103
128
|
className: "liturgical-chant",
|
|
104
129
|
body: [
|
|
105
|
-
getTextForCheck({ translate, translateMap, getAttributeById }, entry.check, {
|
|
106
|
-
value: entry.check_penalty,
|
|
107
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
108
|
-
getSpirit,
|
|
109
|
-
getToughness,
|
|
110
|
-
}),
|
|
111
|
-
...getTextForEffect(locale, translation.effect),
|
|
112
|
-
{
|
|
113
|
-
label: translate("Liturgical Time"),
|
|
114
|
-
value: castingTime !== translation.casting_time.full
|
|
115
|
-
? `***${castingTime}*** (${translation.casting_time.full})`
|
|
116
|
-
: castingTime,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
label: translate("KP Cost"),
|
|
120
|
-
value: cost !== translation.cost.full
|
|
121
|
-
? `***${cost}*** (${translation.cost.full})`
|
|
122
|
-
: cost,
|
|
123
|
-
},
|
|
124
130
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
type: "definitionList",
|
|
132
|
+
items: [
|
|
133
|
+
renderSkillCheckWithPenalty(entry.check, entry.check_penalty, idMap).run(env),
|
|
134
|
+
renderEffect(translation.effect).run(env),
|
|
135
|
+
{
|
|
136
|
+
label: translate("Liturgical Time"),
|
|
137
|
+
value: translation.casting_time &&
|
|
138
|
+
castingTime !== translation.casting_time.full
|
|
139
|
+
? `***${castingTime}*** (${translation.casting_time.full})`
|
|
140
|
+
: castingTime,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: translate("KP Cost"),
|
|
144
|
+
value: translation.cost && cost !== translation.cost.full
|
|
145
|
+
? `***${cost}*** (${translation.cost.full})`
|
|
146
|
+
: cost,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
label: translate("Range"),
|
|
150
|
+
value: translation.range && range !== translation.range.full
|
|
151
|
+
? `***${range}*** (${translation.range.full})`
|
|
152
|
+
: range,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: translate("Duration"),
|
|
156
|
+
value: translation.duration && duration !== translation.duration.full
|
|
157
|
+
? `***${duration}*** (${translation.duration.full})`
|
|
158
|
+
: duration,
|
|
159
|
+
},
|
|
160
|
+
renderTargetCategory(entry.target).run(env),
|
|
161
|
+
getTextForTraditions({
|
|
162
|
+
translate,
|
|
163
|
+
translateMap,
|
|
164
|
+
localeCompare,
|
|
165
|
+
getInstanceById,
|
|
166
|
+
}, entry.traditions),
|
|
167
|
+
renderImprovementCost(entry.improvement_cost).run(env),
|
|
168
|
+
],
|
|
129
169
|
},
|
|
130
|
-
{
|
|
131
|
-
label: translate("Duration"),
|
|
132
|
-
value: duration !== translation.duration.full
|
|
133
|
-
? `***${duration}*** (${translation.duration.full})`
|
|
134
|
-
: duration,
|
|
135
|
-
},
|
|
136
|
-
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
137
|
-
getTextForTraditions({
|
|
138
|
-
translate,
|
|
139
|
-
translateMap,
|
|
140
|
-
localeCompare,
|
|
141
|
-
getBlessedTraditionById,
|
|
142
|
-
getAspectById,
|
|
143
|
-
}, entry.traditions),
|
|
144
|
-
createImprovementCost(translate, entry.improvement_cost),
|
|
145
170
|
],
|
|
171
|
+
errata: translation.errata,
|
|
146
172
|
references: entry.src,
|
|
147
173
|
};
|
|
148
174
|
});
|
|
149
175
|
/**
|
|
150
176
|
* Get a JSON representation of the rules text for a ceremony.
|
|
151
177
|
*/
|
|
152
|
-
export const getCeremonyEntityDescription = createEntityDescriptionCreator(({
|
|
178
|
+
export const getCeremonyEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { content: entry }) => {
|
|
153
179
|
const { translate, translateMap, compare: localeCompare } = locale;
|
|
154
180
|
const translation = translateMap(entry.translations);
|
|
155
181
|
if (translation === undefined) {
|
|
156
182
|
return undefined;
|
|
157
183
|
}
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
184
|
+
const env = {
|
|
185
|
+
translate,
|
|
186
|
+
translateMap,
|
|
187
|
+
getInstanceById,
|
|
188
|
+
localeJoin: locale.join,
|
|
189
|
+
energyUnit: "KarmaPoints",
|
|
190
|
+
responsiveTextSize: ResponsiveTextSize.Full,
|
|
191
|
+
nonModifiableSuffix: (param) => {
|
|
192
|
+
switch (param) {
|
|
193
|
+
case ModifiableParameter.CastingTime:
|
|
194
|
+
return " (you cannot use a modification on this ceremony’s ceremonial time)";
|
|
195
|
+
case ModifiableParameter.Cost:
|
|
196
|
+
return " (you cannot use a modification on this ceremony’s cost)";
|
|
197
|
+
case ModifiableParameter.Range:
|
|
198
|
+
return " (you cannot use a modification on this ceremony’s range)";
|
|
199
|
+
default:
|
|
200
|
+
return assertExhaustive(param);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
const { castingTime, cost, range, duration } = renderSlowPerformanceParameters(entry.parameters).run(env);
|
|
168
205
|
return {
|
|
169
206
|
title: translation.name,
|
|
170
207
|
className: "ceremony",
|
|
171
208
|
body: [
|
|
172
|
-
getTextForCheck({ translate, translateMap, getAttributeById }, entry.check, {
|
|
173
|
-
value: entry.check_penalty,
|
|
174
|
-
responsiveText: ResponsiveTextSize.Full,
|
|
175
|
-
getSpirit,
|
|
176
|
-
getToughness,
|
|
177
|
-
}),
|
|
178
|
-
...getTextForEffect(locale, translation.effect),
|
|
179
|
-
{
|
|
180
|
-
label: translate("Ceremonial Time"),
|
|
181
|
-
value: castingTime !== translation.casting_time.full
|
|
182
|
-
? `***${castingTime}*** (${translation.casting_time.full})`
|
|
183
|
-
: castingTime,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
label: translate("KP Cost"),
|
|
187
|
-
value: cost !== translation.cost.full
|
|
188
|
-
? `***${cost}*** (${translation.cost.full})`
|
|
189
|
-
: cost,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
label: translate("Range"),
|
|
193
|
-
value: range !== translation.range.full
|
|
194
|
-
? `***${range}*** (${translation.range.full})`
|
|
195
|
-
: range,
|
|
196
|
-
},
|
|
197
209
|
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
210
|
+
type: "definitionList",
|
|
211
|
+
items: [
|
|
212
|
+
renderSkillCheckWithPenalty(entry.check, entry.check_penalty, idMap).run(env),
|
|
213
|
+
renderEffect(translation.effect).run(env),
|
|
214
|
+
{
|
|
215
|
+
label: translate("Ceremonial Time"),
|
|
216
|
+
value: translation.casting_time &&
|
|
217
|
+
castingTime !== translation.casting_time.full
|
|
218
|
+
? `***${castingTime}*** (${translation.casting_time.full})`
|
|
219
|
+
: castingTime,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
label: translate("KP Cost"),
|
|
223
|
+
value: translation.cost && cost !== translation.cost.full
|
|
224
|
+
? `***${cost}*** (${translation.cost.full})`
|
|
225
|
+
: cost,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
label: translate("Range"),
|
|
229
|
+
value: translation.range && range !== translation.range.full
|
|
230
|
+
? `***${range}*** (${translation.range.full})`
|
|
231
|
+
: range,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
label: translate("Duration"),
|
|
235
|
+
value: translation.duration && duration !== translation.duration.full
|
|
236
|
+
? `***${duration}*** (${translation.duration.full})`
|
|
237
|
+
: duration,
|
|
238
|
+
},
|
|
239
|
+
renderTargetCategory(entry.target).run(env),
|
|
240
|
+
getTextForTraditions({
|
|
241
|
+
translate,
|
|
242
|
+
translateMap,
|
|
243
|
+
localeCompare,
|
|
244
|
+
getInstanceById,
|
|
245
|
+
}, entry.traditions),
|
|
246
|
+
renderImprovementCost(entry.improvement_cost).run(env),
|
|
247
|
+
],
|
|
202
248
|
},
|
|
203
|
-
getTargetCategoryTranslation(getTargetCategoryById, locale, entry.target),
|
|
204
|
-
getTextForTraditions({
|
|
205
|
-
translate,
|
|
206
|
-
translateMap,
|
|
207
|
-
localeCompare,
|
|
208
|
-
getBlessedTraditionById,
|
|
209
|
-
getAspectById,
|
|
210
|
-
}, entry.traditions),
|
|
211
|
-
createImprovementCost(translate, entry.improvement_cost),
|
|
212
249
|
],
|
|
250
|
+
errata: translation.errata,
|
|
213
251
|
references: entry.src,
|
|
214
252
|
};
|
|
215
253
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { OptionalRule } from "optolith-database-schema/types/rule/OptionalRule";
|
|
2
1
|
/**
|
|
3
2
|
* Get a JSON representation of the rules text for an optional rule.
|
|
4
3
|
*/
|
|
5
|
-
export declare const getOptionalRuleEntityDescription: import("../
|
|
4
|
+
export declare const getOptionalRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"OptionalRule", {
|
|
5
|
+
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createEntityDescriptionCreator } from "../
|
|
1
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
2
2
|
/**
|
|
3
3
|
* Get a JSON representation of the rules text for an optional rule.
|
|
4
4
|
*/
|
|
5
|
-
export const getOptionalRuleEntityDescription = createEntityDescriptionCreator((_, { translateMap }, entry) => {
|
|
5
|
+
export const getOptionalRuleEntityDescription = createEntityDescriptionCreator((_, { translateMap }, { content: entry }) => {
|
|
6
6
|
const translation = translateMap(entry.translations);
|
|
7
7
|
if (translation === undefined) {
|
|
8
8
|
return undefined;
|
|
@@ -10,7 +10,8 @@ export const getOptionalRuleEntityDescription = createEntityDescriptionCreator((
|
|
|
10
10
|
return {
|
|
11
11
|
title: translation.name,
|
|
12
12
|
className: "optional-rule",
|
|
13
|
-
body: [{
|
|
13
|
+
body: [{ type: "plain", text: translation.description }],
|
|
14
|
+
errata: translation.errata,
|
|
14
15
|
references: entry.src,
|
|
15
16
|
};
|
|
16
17
|
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ActivatableIdentifier, ActivatableNameBuilderRules, RequirableSelectOptionIdentifier } from "optolith-database-schema/gen";
|
|
2
|
+
import type { LocaleMap, Translate, TranslateMap } from "../../helpers/translate.js";
|
|
3
|
+
import type { GetResolvedSelectOptionById } from "./prerequisites/single/activatable.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the full name of the activatable entry as well as its components.
|
|
6
|
+
*/
|
|
7
|
+
export type ActivatableNameComponents = {
|
|
8
|
+
id: ActivatableIdentifier;
|
|
9
|
+
base: ActivatableNameChunk;
|
|
10
|
+
options: ActivatableNameChunk | [ActivatableNameChunk, ActivatableNameChunk] | undefined;
|
|
11
|
+
level: number | undefined;
|
|
12
|
+
nameBuilderRules: Required<ActivatableNameBuilderRules>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Returns the full name of the activatable entry as well as its components.
|
|
16
|
+
*/
|
|
17
|
+
export type CombinedActivatableNameComponents = {
|
|
18
|
+
id: ActivatableIdentifier;
|
|
19
|
+
base: ActivatableNameChunk;
|
|
20
|
+
options: (ActivatableNameChunk | [ActivatableNameChunk, ActivatableNameChunk])[];
|
|
21
|
+
level: number | undefined;
|
|
22
|
+
nameBuilderRules: Required<ActivatableNameBuilderRules>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A part of the name, which can be a locale map, a string for all locales or a
|
|
26
|
+
* function returning a string.
|
|
27
|
+
*/
|
|
28
|
+
export type ActivatableNameChunk = LocaleMap<string> | string | ((translateMap: TranslateMap) => string);
|
|
29
|
+
/**
|
|
30
|
+
* This can be used to render an activatable entry with a selectable level, as it splits the text where the level should be inserted.
|
|
31
|
+
*/
|
|
32
|
+
export declare const renderActivatableNameComponentsWithoutLevel: (translateMap: TranslateMap, components: ActivatableNameComponents) => [beforeLevel: string, afterLevel?: string];
|
|
33
|
+
/**
|
|
34
|
+
* Renders the name components of an activatable entry.
|
|
35
|
+
*/
|
|
36
|
+
export declare const renderActivatableNameComponents: (translateMap: TranslateMap, components: ActivatableNameComponents, formatAsPrerequisite: boolean) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Combines multiple name components into a single one when all values except for options are the same, joining options according to the passed function.
|
|
39
|
+
*
|
|
40
|
+
* Returns `undefined` if the components cannot be combined.
|
|
41
|
+
*/
|
|
42
|
+
export declare const combineNameComponents: (elements: ActivatableNameComponents[]) => CombinedActivatableNameComponents | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Renders the name components of an activatable entry, combining multiple options into one string.
|
|
45
|
+
*/
|
|
46
|
+
export declare const renderCombinedActivatableNameComponents: (translateMap: TranslateMap, components: CombinedActivatableNameComponents, formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Renders the name components of multiple activatable entries.
|
|
49
|
+
*/
|
|
50
|
+
export declare const renderMultipleStandaloneActivatableNameComponents: (translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
53
|
+
*/
|
|
54
|
+
export declare const renderActivatableNameComponentsCombinedIfPossible: (translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the name components for an activatable entry.
|
|
57
|
+
*/
|
|
58
|
+
export declare const getNameComponents: <T>(translate: Translate, id: ActivatableIdentifier, options: RequirableSelectOptionIdentifier[] | undefined, level: number | undefined, nameBuilderRules: ActivatableNameBuilderRules | undefined, translations: LocaleMap<T>, getBaseName: (translation: T) => string, getResolvedSelectOptionById: GetResolvedSelectOptionById, displayedInProfession: boolean) => ActivatableNameComponents;
|