@optolith/entity-descriptions 0.11.1 → 0.11.2
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 +8 -0
- package/lib/entities/activatable.js +11 -5
- package/lib/entities/elixir.js +9 -1
- package/lib/entities/influence.js +10 -1
- package/lib/entities/partial/activatableNameChunks.d.ts +2 -2
- package/lib/entities/partial/activatableNameChunks.js +18 -4
- package/lib/entities/partial/adventurePointsValue.js +19 -12
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/enhancements.js +13 -4
- package/lib/entities/partial/map.d.ts +1 -1
- package/lib/entities/partial/prerequisites/displayOption.d.ts +2 -7
- package/lib/entities/partial/prerequisites/displayOption.js +1 -18
- package/lib/entities/partial/prerequisites/index.d.ts +22 -20
- package/lib/entities/partial/prerequisites/index.js +68 -65
- package/lib/entities/partial/prerequisites/part.d.ts +3 -4
- package/lib/entities/partial/prerequisites/part.js +13 -11
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +16 -18
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +90 -82
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +4 -5
- package/lib/entities/partial/prerequisites/single/activatable.js +21 -29
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/animistPower.js +6 -9
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/anySpecialAbilityOfGroup.js +4 -7
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +15 -17
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +9 -6
- package/lib/entities/partial/prerequisites/single/culture.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/culture.js +8 -15
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/enhancement.js +1 -1
- package/lib/entities/partial/prerequisites/single/influence.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/influence.js +7 -10
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +10 -12
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +4 -3
- package/lib/entities/partial/prerequisites/single/pact.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/pact.js +17 -18
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +21 -22
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +6 -8
- package/lib/entities/partial/prerequisites/single/profession.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/profession.js +11 -14
- package/lib/entities/partial/prerequisites/single/publication.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/publication.js +7 -13
- package/lib/entities/partial/prerequisites/single/race.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/race.js +8 -15
- package/lib/entities/partial/prerequisites/single/rated.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/rated.js +7 -9
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +52 -53
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/ratedSum.js +15 -15
- package/lib/entities/partial/prerequisites/single/rule.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/rule.js +2 -1
- package/lib/entities/partial/prerequisites/single/sex.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/sex.js +7 -6
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +11 -8
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/socialStatus.js +9 -15
- package/lib/entities/partial/prerequisites/single/state.d.ts +2 -3
- package/lib/entities/partial/prerequisites/single/state.js +8 -15
- package/lib/entities/partial/prerequisites/single/text.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/text.js +4 -3
- package/lib/entities/partial/prerequisites/single/tinyActivatable.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/tinyActivatable.js +5 -8
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/cost.d.ts +3 -3
- package/lib/entities/partial/rated/activatable/duration.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/duration.js +1 -1
- package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +1 -1
- package/lib/entities/partial/rated/activatable/range.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
- package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
- package/lib/entities/partial/rated/skillCheck.d.ts +1 -1
- package/lib/entities/partial/reader.d.ts +2 -57
- package/lib/entities/partial/responsiveText.d.ts +1 -1
- package/lib/entities/partial/units/length.d.ts +1 -1
- package/lib/entities/partial/units/timeSpan.d.ts +3 -4
- package/lib/entities/personalityTrait.js +8 -1
- package/lib/entities/poison.js +5 -1
- package/lib/entities/profession.js +9 -15
- package/lib/entities/race.d.ts +1 -1
- package/lib/entities/race.js +16 -12
- package/lib/entities/spell.js +5 -2
- package/lib/env.d.ts +66 -0
- package/lib/env.js +1 -0
- package/lib/references/publicationOptions.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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.11.2](https://github.com/Optolith/entity-descriptions/compare/v0.11.1...v0.11.2) (2026-09-14)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* activatable prerequisite disjunctions ([7895f89](https://github.com/Optolith/entity-descriptions/commit/7895f89735315a6a97a7a03bbcdc1c58361763b9)), closes [#52](https://github.com/Optolith/entity-descriptions/issues/52)
|
|
10
|
+
* correctly signed and labeled AP value depending on active entries ([27e3a7a](https://github.com/Optolith/entity-descriptions/commit/27e3a7a4975368651b443520f08bdd918e81a019))
|
|
11
|
+
* correctly signed value in IC derived AP value ([99fa203](https://github.com/Optolith/entity-descriptions/commit/99fa20395d8e9a378194673388d38e26938982bd))
|
|
12
|
+
* derived combat technique ap value ([0ad0554](https://github.com/Optolith/entity-descriptions/commit/0ad0554f2eee7857dbaa7717a3742e70b5735f1f))
|
|
5
13
|
## [0.11.1](https://github.com/Optolith/entity-descriptions/compare/v0.11.0...v0.11.1) (2026-09-13)
|
|
6
14
|
|
|
7
15
|
### Features
|
|
@@ -22,7 +22,7 @@ import { printAdvantageDisadvantagePrerequisites, printGeneralPrerequisites, } f
|
|
|
22
22
|
import { printActivatableName, } from "./partial/prerequisites/single/activatable.js";
|
|
23
23
|
import { renderStandaloneCostMap } from "./partial/rated/activatable/cost.js";
|
|
24
24
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
25
|
-
import { attributedNameR, localeSortR, nameR, translateR
|
|
25
|
+
import { attributedNameR, localeSortR, nameR, translateR } from "./partial/reader.js";
|
|
26
26
|
import { getResponsiveText, getResponsiveTextOptional, ResponsiveTextSize, } from "./partial/responsiveText.js";
|
|
27
27
|
import { formatTimeSpan } from "./partial/units/timeSpan.js";
|
|
28
28
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
@@ -545,7 +545,12 @@ const normalizeId = (entityName, id) => {
|
|
|
545
545
|
};
|
|
546
546
|
const renderAdvancedSpecialAbilityName = (translate, translateMap, getInstanceById, getResolvedSelectOptionById, entityName, id, option) => {
|
|
547
547
|
const normalizedId = normalizeId(entityName, id);
|
|
548
|
-
return `^[${mapNullable(printActivatableName(
|
|
548
|
+
return `^[${mapNullable(printActivatableName(normalizedId, option, undefined).run({
|
|
549
|
+
getInstanceById,
|
|
550
|
+
translate,
|
|
551
|
+
getResolvedSelectOptionById,
|
|
552
|
+
displayedInProfession: false,
|
|
553
|
+
}), name => renderActivatableNameComponents(translateMap, name, false)) ?? MISSING_VALUE}](entity: "${normalizedId.kind}", instance: "${fromUniformCase(normalizedId)}", style: "normal")`;
|
|
549
554
|
};
|
|
550
555
|
const renderAdvancedValue = (translate, translateMap, localeJoin, localeCompare, getInstanceById, getResolvedSelectOptionById, entityName, advanced) => {
|
|
551
556
|
if (advanced.every(entry => entry.kind === "OneOf") &&
|
|
@@ -792,6 +797,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
792
797
|
getInstanceById,
|
|
793
798
|
localeCompare: locale.compare,
|
|
794
799
|
localeJoin: locale.join,
|
|
800
|
+
getResolvedSelectOptionById,
|
|
795
801
|
};
|
|
796
802
|
const baseEntry = entry;
|
|
797
803
|
const wrappedId = Case(entityName, id);
|
|
@@ -870,11 +876,11 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
870
876
|
mapNullable(entry.prerequisites ?? (isAdvancedSpecialAbilityKind(entityName) ? [] : undefined), prerequisites => ({
|
|
871
877
|
label: translate("Prerequisites"),
|
|
872
878
|
value: wrappedId.kind === "Advantage" || wrappedId.kind === "Disadvantage"
|
|
873
|
-
? printAdvantageDisadvantagePrerequisites(
|
|
874
|
-
: printGeneralPrerequisites(
|
|
879
|
+
? printAdvantageDisadvantagePrerequisites(prerequisites, translation.name, wrappedId.kind).run(env)
|
|
880
|
+
: printGeneralPrerequisites(prerequisites, mapNullable(baseEntry.levels, levels => ({
|
|
875
881
|
id: wrappedId,
|
|
876
882
|
levels,
|
|
877
|
-
})), renderTrailingAdvancedPrerequisitesNote(translate, entityName)),
|
|
883
|
+
})), renderTrailingAdvancedPrerequisitesNote(translate, entityName)).run(env),
|
|
878
884
|
})),
|
|
879
885
|
mapNullable(baseEntry.combat_techniques, combatTechniques => ({
|
|
880
886
|
label: translate("Combat Techniques"),
|
package/lib/entities/elixir.js
CHANGED
|
@@ -13,6 +13,14 @@ export const getElixirEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
13
13
|
if (translation === undefined) {
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
16
|
+
const env = {
|
|
17
|
+
translate,
|
|
18
|
+
translateMap,
|
|
19
|
+
getInstanceById,
|
|
20
|
+
localeCompare: locale.compare,
|
|
21
|
+
localeJoin: locale.join,
|
|
22
|
+
getResolvedSelectOptionById,
|
|
23
|
+
};
|
|
16
24
|
return {
|
|
17
25
|
title: translation.name,
|
|
18
26
|
className: "elixir",
|
|
@@ -48,7 +56,7 @@ export const getElixirEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
48
56
|
value: translate("{$value} AP", {
|
|
49
57
|
value: entry.trade_secret.ap_value,
|
|
50
58
|
}) +
|
|
51
|
-
parensIf(mapNullable(entry.trade_secret.prerequisites, prerequisites => `${translate("Prerequisites")}: ${printPlainGeneralPrerequisites(
|
|
59
|
+
parensIf(mapNullable(entry.trade_secret.prerequisites, prerequisites => `${translate("Prerequisites")}: ${printPlainGeneralPrerequisites(prerequisites).run(env)}`)),
|
|
52
60
|
},
|
|
53
61
|
translation.special === undefined
|
|
54
62
|
? undefined
|
|
@@ -9,6 +9,15 @@ export const getInfluenceEntityDescription = createEntityDescriptionCreator(({ g
|
|
|
9
9
|
if (translation === undefined) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
+
const env = {
|
|
13
|
+
translate,
|
|
14
|
+
translateMap,
|
|
15
|
+
getInstanceById,
|
|
16
|
+
localeCompare: locale.compare,
|
|
17
|
+
localeJoin: locale.join,
|
|
18
|
+
getResolvedSelectOptionById,
|
|
19
|
+
getChildInstancesForInstanceId,
|
|
20
|
+
};
|
|
12
21
|
return {
|
|
13
22
|
title: translation.name,
|
|
14
23
|
className: "influence",
|
|
@@ -32,7 +41,7 @@ export const getInfluenceEntityDescription = createEntityDescriptionCreator(({ g
|
|
|
32
41
|
? undefined
|
|
33
42
|
: {
|
|
34
43
|
label: translate("Prerequisites"),
|
|
35
|
-
value: printInfluencePrerequisites(
|
|
44
|
+
value: printInfluencePrerequisites(entry.prerequisites).run(env),
|
|
36
45
|
},
|
|
37
46
|
],
|
|
38
47
|
},
|
|
@@ -43,7 +43,7 @@ export declare const combineNameComponents: (elements: ActivatableNameComponents
|
|
|
43
43
|
/**
|
|
44
44
|
* Renders the name components of an activatable entry, combining multiple options into one string.
|
|
45
45
|
*/
|
|
46
|
-
export declare const renderCombinedActivatableNameComponents: (translateMap: TranslateMap, components: CombinedActivatableNameComponents, formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
46
|
+
export declare const renderCombinedActivatableNameComponents: (translateMap: TranslateMap, components: CombinedActivatableNameComponents, formatAsPrerequisite: boolean, join?: (list: string[]) => string, context?: string) => string;
|
|
47
47
|
/**
|
|
48
48
|
* Renders the name components of multiple activatable entries.
|
|
49
49
|
*/
|
|
@@ -51,7 +51,7 @@ export declare const renderMultipleStandaloneActivatableNameComponents: (transla
|
|
|
51
51
|
/**
|
|
52
52
|
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
53
53
|
*/
|
|
54
|
-
export declare const renderActivatableNameComponentsCombinedIfPossible: (translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
54
|
+
export declare const renderActivatableNameComponentsCombinedIfPossible: (translate: Translate, translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
55
55
|
/**
|
|
56
56
|
* Renders the options of an activatable entry, combining them if necessary.
|
|
57
57
|
*/
|
|
@@ -6,6 +6,8 @@ import { isNotNullish } from "@elyukai/utils/nullable";
|
|
|
6
6
|
import { mapObject } from "@optolith/helpers/object";
|
|
7
7
|
import { romanize } from "@optolith/helpers/roman";
|
|
8
8
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
9
|
+
import { fromUniformCase } from "tsondb/schema/gen";
|
|
10
|
+
import { attributedInstance } from "./markdown.js";
|
|
9
11
|
import { MISSING_VALUE } from "./unknown.js";
|
|
10
12
|
const combineChunks = (a, b, join) => {
|
|
11
13
|
if (typeof a === "string") {
|
|
@@ -127,22 +129,34 @@ export const combineNameComponents = (elements) => {
|
|
|
127
129
|
/**
|
|
128
130
|
* Renders the name components of an activatable entry, combining multiple options into one string.
|
|
129
131
|
*/
|
|
130
|
-
export const renderCombinedActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => renderActivatableNameComponents(translateMap, {
|
|
132
|
+
export const renderCombinedActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", "), context = "prerequisite") => attributedInstance(renderActivatableNameComponents(translateMap, {
|
|
131
133
|
...components,
|
|
132
134
|
nameBuilderRules: {
|
|
133
135
|
...components.nameBuilderRules,
|
|
134
136
|
useParenthesis: true,
|
|
135
137
|
},
|
|
136
138
|
options: join(components.options.map(chunk => renderActivatableNameChunk(translateMap, normalizeChunks(chunk)))),
|
|
137
|
-
}, formatAsPrerequisite);
|
|
139
|
+
}, formatAsPrerequisite), components.id.kind, fromUniformCase(components.id), { context });
|
|
138
140
|
/**
|
|
139
141
|
* Renders the name components of multiple activatable entries.
|
|
140
142
|
*/
|
|
141
|
-
export const renderMultipleStandaloneActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => join(components.map(item => renderActivatableNameComponents(translateMap, item, formatAsPrerequisite)));
|
|
143
|
+
export const renderMultipleStandaloneActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => join(components.map(item => attributedInstance(renderActivatableNameComponents(translateMap, item, formatAsPrerequisite), item.id.kind, fromUniformCase(item.id), { context: '"prerequisite"' })));
|
|
142
144
|
/**
|
|
143
145
|
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
144
146
|
*/
|
|
145
|
-
export const renderActivatableNameComponentsCombinedIfPossible = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => {
|
|
147
|
+
export const renderActivatableNameComponentsCombinedIfPossible = (translate, translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => {
|
|
148
|
+
if (isNotEmpty(components) &&
|
|
149
|
+
components.length > 1 &&
|
|
150
|
+
(components.every(c => c.id.kind === "MagicalTradition") ||
|
|
151
|
+
components.every(c => c.id.kind === "BlessedTradition"))) {
|
|
152
|
+
return (attributedInstance(`${translate("Tradition")} (`, components[0].id.kind, undefined, {
|
|
153
|
+
context: '"prerequisite"',
|
|
154
|
+
}) +
|
|
155
|
+
join(components.map(c => c.options === undefined
|
|
156
|
+
? MISSING_VALUE
|
|
157
|
+
: attributedInstance(renderActivatableNameChunk(translateMap, normalizeChunks(c.options)), c.id.kind, fromUniformCase(c.id), { context: '"prerequisite"' }))) +
|
|
158
|
+
attributedInstance(`)`, components[0].id.kind, undefined, { context: '"prerequisite"' }));
|
|
159
|
+
}
|
|
146
160
|
const combined = combineNameComponents(components);
|
|
147
161
|
if (combined === undefined) {
|
|
148
162
|
return renderMultipleStandaloneActivatableNameComponents(translateMap, components, formatAsPrerequisite, join);
|
|
@@ -35,7 +35,7 @@ const renderFixedSelectOptionsAdventurePointsValue = (locale, getAllSelectOption
|
|
|
35
35
|
.join("; ");
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, getAllSelectOptions, getNameForSelectOptionId, config, applyNegative) => {
|
|
38
|
+
const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, derivedRangeStart, getAllSelectOptions, getNameForSelectOptionId, config, applyNegative) => {
|
|
39
39
|
if (config === undefined) {
|
|
40
40
|
return MISSING_VALUE;
|
|
41
41
|
}
|
|
@@ -43,8 +43,8 @@ const renderSelectOptionsAdventurePointsValue = (locale, derivedLabel, getAllSel
|
|
|
43
43
|
case "DerivedFromImprovementCost": {
|
|
44
44
|
const start = derivedLabel();
|
|
45
45
|
return `${start}: ${locale.translate("{$value} Adventure Points", {
|
|
46
|
-
value: Array.from({ length:
|
|
47
|
-
(config.DerivedFromImprovementCost.offset ?? 0)).join("/"),
|
|
46
|
+
value: Array.from({ length: 5 - derivedRangeStart }, (_, index) => applyNegative((index + derivedRangeStart) * (config.DerivedFromImprovementCost.multiplier ?? 1) +
|
|
47
|
+
(config.DerivedFromImprovementCost.offset ?? 0))).join("/"),
|
|
48
48
|
})}`;
|
|
49
49
|
}
|
|
50
50
|
case "Fixed":
|
|
@@ -220,9 +220,9 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
220
220
|
default:
|
|
221
221
|
return translate("A/B/C/D ability");
|
|
222
222
|
}
|
|
223
|
-
}, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.Skills.ap_value, applyNegative);
|
|
223
|
+
}, 1, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.Skills.ap_value, applyNegative);
|
|
224
224
|
case "CombatTechniques":
|
|
225
|
-
return renderSelectOptionsAdventurePointsValue(locale, () => translate("B/C/D combat technique"), getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.CombatTechniques.ap_value, applyNegative);
|
|
225
|
+
return renderSelectOptionsAdventurePointsValue(locale, () => translate("B/C/D combat technique"), 2, getAllSelectOptions, getNameForSelectOptionId, derivedSelectOptions.CombatTechniques.ap_value, applyNegative);
|
|
226
226
|
case "TargetCategories":
|
|
227
227
|
return MISSING_VALUE;
|
|
228
228
|
default:
|
|
@@ -231,20 +231,27 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
231
231
|
}
|
|
232
232
|
case "DependingOnActive":
|
|
233
233
|
return `${translate(".input {$value :number} {{{$value} Adventure Points}}", {
|
|
234
|
-
value: value.DependingOnActive.inactive,
|
|
234
|
+
value: applyNegative(value.DependingOnActive.inactive),
|
|
235
235
|
})} (${translate(".input {$value :number} {{{$value} Adventure Points with {$name}}}", {
|
|
236
|
-
value: value.DependingOnActive.active,
|
|
236
|
+
value: applyNegative(value.DependingOnActive.active),
|
|
237
237
|
name: getNameForId(value.DependingOnActive.id) ?? MISSING_VALUE,
|
|
238
238
|
})})`;
|
|
239
239
|
case "DependingOnActiveInstances":
|
|
240
240
|
switch (value.DependingOnActiveInstances.kind) {
|
|
241
241
|
case "Threshold":
|
|
242
|
-
|
|
243
|
-
value: value
|
|
244
|
-
|
|
242
|
+
if (entry.levels === undefined) {
|
|
243
|
+
return translate(".input {$value :number} {{{$value} Adventure Points}}", {
|
|
244
|
+
value: applyNegative(value.DependingOnActiveInstances.Threshold.normal),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
return translate(".input {$value :number} {{{$value} Adventure Points per level}}", {
|
|
249
|
+
value: applyNegative(value.DependingOnActiveInstances.Threshold.normal),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
245
252
|
case "Expression": {
|
|
246
253
|
const expression = value.DependingOnActiveInstances.Expression;
|
|
247
|
-
const values = Array.from({ length: entry.maximum ?? 3 }, (_, index) => evaluateMathOperation(expression, exprValue => {
|
|
254
|
+
const values = Array.from({ length: entry.maximum ?? 3 }, (_, index) => applyNegative(evaluateMathOperation(expression, exprValue => {
|
|
248
255
|
switch (exprValue.kind) {
|
|
249
256
|
case "Constant":
|
|
250
257
|
return exprValue.Constant;
|
|
@@ -253,7 +260,7 @@ export const renderAdventurePointsValue = (locale, getNameForId, getNameForSelec
|
|
|
253
260
|
default:
|
|
254
261
|
return assertExhaustive(exprValue);
|
|
255
262
|
}
|
|
256
|
-
})).join("/");
|
|
263
|
+
}))).join("/");
|
|
257
264
|
const labels = Array.from({ length: entry.maximum ?? 3 }, (_, index) => `${(index + 1).toFixed()}.`).join("/");
|
|
258
265
|
if (entry.maximum !== undefined) {
|
|
259
266
|
return translate("{$values} Adventure Points for the {$labels} purchase", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonnessRatedAdvantageDisadvantage } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdReader } from "../../env.js";
|
|
2
3
|
import type { TranslationKeysWithoutParams } from "../../helpers/translate.js";
|
|
3
4
|
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../index.js";
|
|
4
|
-
import type { StdReader } from "./reader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Render the names of either commonness-rated advantages or commonness-rated disadvantages.
|
|
7
7
|
*/
|
|
@@ -50,7 +50,7 @@ const renderCommonnessRatedAdvantageOrDisadvantageName = (translateMap, getInsta
|
|
|
50
50
|
level,
|
|
51
51
|
nameBuilderRules: makeNameBuilderRulesWithDefaults(instance.nameBuilderRules),
|
|
52
52
|
options,
|
|
53
|
-
}, false, list => list.toSorted(localeCompare).join(", "));
|
|
53
|
+
}, false, list => list.toSorted(localeCompare).join(", "), "commonness");
|
|
54
54
|
}, entity, item.id) ?? MISSING_VALUE);
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImprovementCost, RatedIdentifier, SkillWithEnhancementsIdentifier } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdReader } from "../../env.js";
|
|
2
3
|
import type { RawEntityDescriptionSection } from "../../index.js";
|
|
3
|
-
import { type StdReader } from "./reader.js";
|
|
4
4
|
/**
|
|
5
5
|
* Render the enhancements section for an entity description, if applicable.
|
|
6
6
|
*/
|
|
@@ -6,7 +6,7 @@ import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
|
6
6
|
import { getAdventurePointsForActivation } from "@optolith/adventure-points/improvement-cost";
|
|
7
7
|
import { filterIncludedPublicationEntriesMapR } from "../../references/publicationOptions.js";
|
|
8
8
|
import { printEnhancementPrerequisites } from "./prerequisites/index.js";
|
|
9
|
-
import { getChildInstancesForInstanceIdR, translateMapR, translateR
|
|
9
|
+
import { getChildInstancesForInstanceIdR, translateMapR, translateR } from "./reader.js";
|
|
10
10
|
const getEnhancementAPValue = (adventurePoints, parentImprovementCost) => {
|
|
11
11
|
switch (adventurePoints.kind) {
|
|
12
12
|
case "DerivedFromImprovementCost":
|
|
@@ -18,9 +18,18 @@ const getEnhancementAPValue = (adventurePoints, parentImprovementCost) => {
|
|
|
18
18
|
return assertExhaustive(adventurePoints);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
const renderEnhancement = (enhancement, parentImprovementCost) =>
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const renderEnhancement = (enhancement, parentImprovementCost) => {
|
|
22
|
+
const { prerequisites } = enhancement.content;
|
|
23
|
+
return translateMapR(enhancement.content.translations).thenW(translation => translation === undefined
|
|
24
|
+
? Reader.of(undefined)
|
|
25
|
+
: translateR("SR {$value}", { value: enhancement.content.skill_rating }).thenW(sr => translateR("{$value} AP", {
|
|
26
|
+
value: getEnhancementAPValue(enhancement.content.adventurePoints, parentImprovementCost),
|
|
27
|
+
}).thenW(ap => (prerequisites === undefined
|
|
28
|
+
? Reader.of("")
|
|
29
|
+
: translateR(".input {$hiddenCount :number} {{Prerequisites}}", {
|
|
30
|
+
hiddenCount: prerequisites.length,
|
|
31
|
+
}).thenW(prerequisitesLabel => printEnhancementPrerequisites(prerequisites).map(prerequisitesText => ` ${prerequisitesLabel}: ${prerequisitesText}`))).map(prerequisitesText => `- ^[${translation.name}](entity: "Enhancement") (${sr}, ${ap}): ${translation.effect.split("\n").join("\n ")}${prerequisitesText}`))));
|
|
32
|
+
};
|
|
24
33
|
/**
|
|
25
34
|
* Render the enhancements section for an entity description, if applicable.
|
|
26
35
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
2
|
import type { ParameterMapStyle, ResponsiveTextOptional } from "@optolith/database-schema/gen";
|
|
3
|
+
import type { StdEnv, StdReader } from "../../env.js";
|
|
3
4
|
import type { LocaleMap } from "../../helpers/translate.js";
|
|
4
|
-
import { type StdEnv, type StdReader } from "./reader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Renders a map of options to a string.
|
|
7
7
|
*/
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { DisplayOption } from "@optolith/database-schema/gen";
|
|
2
|
-
import type {
|
|
3
|
-
import type { StdReader } from "../reader.js";
|
|
2
|
+
import type { StdReader } from "../../../env.js";
|
|
4
3
|
import type { PrerequisitePart } from "./part.js";
|
|
5
4
|
/**
|
|
6
5
|
* Get the translation of a display option.
|
|
7
6
|
*/
|
|
8
|
-
export declare const printDisplayOption: (
|
|
9
|
-
/**
|
|
10
|
-
* Get the translation of a display option.
|
|
11
|
-
*/
|
|
12
|
-
export declare const printDisplayOptionR: (displayOption: DisplayOption) => StdReader<PrerequisitePart | undefined, "tm">;
|
|
7
|
+
export declare const printDisplayOption: (displayOption: DisplayOption) => StdReader<PrerequisitePart | undefined, "tm">;
|
|
@@ -4,24 +4,7 @@ import { MISSING_VALUE } from "../unknown.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Get the translation of a display option.
|
|
6
6
|
*/
|
|
7
|
-
export const printDisplayOption = (
|
|
8
|
-
switch (displayOption.kind) {
|
|
9
|
-
case "Hide":
|
|
10
|
-
return undefined;
|
|
11
|
-
case "ReplaceWith":
|
|
12
|
-
return {
|
|
13
|
-
value: translateMap(displayOption.ReplaceWith.translations)?.replacement ?? MISSING_VALUE,
|
|
14
|
-
sentenceType: displayOption.ReplaceWith.sentence_type,
|
|
15
|
-
isMeta: false,
|
|
16
|
-
};
|
|
17
|
-
default:
|
|
18
|
-
return assertExhaustive(displayOption);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Get the translation of a display option.
|
|
23
|
-
*/
|
|
24
|
-
export const printDisplayOptionR = (displayOption) => {
|
|
7
|
+
export const printDisplayOption = (displayOption) => {
|
|
25
8
|
switch (displayOption.kind) {
|
|
26
9
|
case "Hide":
|
|
27
10
|
return Reader.of(undefined);
|
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
+
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisites, AnimistPowerPrerequisites, ArcaneTraditionPrerequisites, DerivedCharacteristicPrerequisites, EnhancementPrerequisites, GeneralPrerequisites, GeodeRitualPrerequisites, InfluencePrerequisites, LanguagePrerequisites, LiturgyPrerequisites, PersonalityTraitPrerequisites, PlainGeneralPrerequisites, ProfessionPrerequisites, PublicationPrerequisites, SpellworkPrerequisites } from "@optolith/database-schema/gen";
|
|
3
|
+
import type { StdEnv } from "../../../env.js";
|
|
4
|
+
import { printAdvantageDisadvantagePrerequisiteGroup, printAnimistPowerPrerequisiteGroup, printArcaneTraditionPrerequisiteGroup, printDerivedCharacteristicPrerequisiteGroup, printEnhancementPrerequisiteGroup, printGeneralPrerequisiteGroup, printGeodeRitualPrerequisiteGroup, printInfluencePrerequisiteGroup, printLanguagePrerequisiteGroup, printLiturgyPrerequisiteGroup, printPersonalityTraitPrerequisiteGroup, printProfessionPrerequisiteGroup, printPublicationPrerequisiteGroup, printSpellworkPrerequisiteGroup } from "./prerequisiteGroups.js";
|
|
5
|
+
type DeriveEnvF<T extends (...args: any[]) => any> = ReturnType<T> extends Reader<infer E, unknown> ? E : never;
|
|
5
6
|
/**
|
|
6
7
|
* Print derived characteristic prerequisites as a string.
|
|
7
8
|
*/
|
|
8
|
-
export declare const printDerivedCharacteristicPrerequisites: (
|
|
9
|
+
export declare const printDerivedCharacteristicPrerequisites: (value: DerivedCharacteristicPrerequisites) => Reader<DeriveEnvF<typeof printDerivedCharacteristicPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
9
10
|
/**
|
|
10
11
|
* Print publication prerequisites as a string.
|
|
11
12
|
*/
|
|
12
|
-
export declare const printPublicationPrerequisites: (
|
|
13
|
+
export declare const printPublicationPrerequisites: (value: PublicationPrerequisites) => Reader<DeriveEnvF<typeof printPublicationPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
13
14
|
/**
|
|
14
15
|
* Print plain general prerequisites as a string.
|
|
15
16
|
*/
|
|
16
|
-
export declare const printPlainGeneralPrerequisites: (
|
|
17
|
+
export declare const printPlainGeneralPrerequisites: (value: PlainGeneralPrerequisites) => Reader<DeriveEnvF<typeof printGeneralPrerequisiteGroup>, string>;
|
|
17
18
|
/**
|
|
18
19
|
* Print general prerequisites as a string.
|
|
19
20
|
*/
|
|
20
|
-
export declare const printGeneralPrerequisites: (
|
|
21
|
+
export declare const printGeneralPrerequisites: (value: GeneralPrerequisites, printPreviousLevelPrerequisites?: {
|
|
21
22
|
id: ActivatableIdentifier;
|
|
22
23
|
levels: number;
|
|
23
|
-
}, trailingText?: string) => string
|
|
24
|
+
}, trailingText?: string) => Reader<DeriveEnvF<typeof printGeneralPrerequisiteGroup>, string>;
|
|
24
25
|
/**
|
|
25
26
|
* Print profession prerequisites as a string.
|
|
26
27
|
*/
|
|
27
|
-
export declare const printProfessionPrerequisites: (
|
|
28
|
+
export declare const printProfessionPrerequisites: (value: ProfessionPrerequisites) => Reader<DeriveEnvF<typeof printProfessionPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
28
29
|
/**
|
|
29
30
|
* Print advantage disadvantage prerequisites as a string.
|
|
30
31
|
*/
|
|
31
|
-
export declare const printAdvantageDisadvantagePrerequisites: (
|
|
32
|
+
export declare const printAdvantageDisadvantagePrerequisites: (value: AdvantageDisadvantagePrerequisites, name: string, type: "Advantage" | "Disadvantage") => Reader<DeriveEnvF<typeof printAdvantageDisadvantagePrerequisiteGroup>, string>;
|
|
32
33
|
/**
|
|
33
34
|
* Print arcane tradition prerequisites as a string.
|
|
34
35
|
*/
|
|
35
|
-
export declare const printArcaneTraditionPrerequisites: (
|
|
36
|
+
export declare const printArcaneTraditionPrerequisites: (value: ArcaneTraditionPrerequisites) => Reader<DeriveEnvF<typeof printArcaneTraditionPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
36
37
|
/**
|
|
37
38
|
* Print personality trait prerequisites as a string.
|
|
38
39
|
*/
|
|
39
|
-
export declare const printPersonalityTraitPrerequisites: (
|
|
40
|
+
export declare const printPersonalityTraitPrerequisites: (value: PersonalityTraitPrerequisites) => Reader<DeriveEnvF<typeof printPersonalityTraitPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
40
41
|
/**
|
|
41
42
|
* Print spellwork prerequisites as a string.
|
|
42
43
|
*/
|
|
43
|
-
export declare const printSpellworkPrerequisites: (
|
|
44
|
+
export declare const printSpellworkPrerequisites: (value: SpellworkPrerequisites) => Reader<DeriveEnvF<typeof printSpellworkPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
44
45
|
/**
|
|
45
46
|
* Print liturgy prerequisites as a string.
|
|
46
47
|
*/
|
|
47
|
-
export declare const printLiturgyPrerequisites: (
|
|
48
|
+
export declare const printLiturgyPrerequisites: (value: LiturgyPrerequisites) => Reader<DeriveEnvF<typeof printLiturgyPrerequisiteGroup> & StdEnv<"t" | "tm" | "lj" | "lc">, string>;
|
|
48
49
|
/**
|
|
49
50
|
* Print influence prerequisites as a string.
|
|
50
51
|
*/
|
|
51
|
-
export declare const printInfluencePrerequisites: (
|
|
52
|
+
export declare const printInfluencePrerequisites: (value: InfluencePrerequisites) => Reader<DeriveEnvF<typeof printInfluencePrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
52
53
|
/**
|
|
53
54
|
* Print language prerequisites as a string.
|
|
54
55
|
*/
|
|
55
|
-
export declare const printLanguagePrerequisites: (
|
|
56
|
+
export declare const printLanguagePrerequisites: (value: LanguagePrerequisites) => Reader<DeriveEnvF<typeof printLanguagePrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
56
57
|
/**
|
|
57
58
|
* Print animist power prerequisites as a string.
|
|
58
59
|
*/
|
|
59
|
-
export declare const printAnimistPowerPrerequisites: (
|
|
60
|
+
export declare const printAnimistPowerPrerequisites: (value: AnimistPowerPrerequisites) => Reader<DeriveEnvF<typeof printAnimistPowerPrerequisiteGroup> & StdEnv<"t" | "lj" | "lc">, string>;
|
|
60
61
|
/**
|
|
61
62
|
* Print geode ritual prerequisites as a string.
|
|
62
63
|
*/
|
|
63
|
-
export declare const printGeodeRitualPrerequisites: (
|
|
64
|
+
export declare const printGeodeRitualPrerequisites: (value: GeodeRitualPrerequisites) => Reader<DeriveEnvF<typeof printGeodeRitualPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
64
65
|
/**
|
|
65
66
|
* Print enhancement prerequisites as a string.
|
|
66
67
|
*/
|
|
67
|
-
export declare const printEnhancementPrerequisites: (
|
|
68
|
+
export declare const printEnhancementPrerequisites: (value: EnhancementPrerequisites) => Reader<DeriveEnvF<typeof printEnhancementPrerequisiteGroup> & StdEnv<"lj" | "lc">, string>;
|
|
69
|
+
export {};
|