@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
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { ensureNonEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
|
+
import { isNotNullish, mapNullable } from "@elyukai/utils/nullable";
|
|
3
|
+
import { sign } from "@elyukai/utils/string/number";
|
|
4
|
+
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
5
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
6
|
+
import { renderDice, renderDiceAndFlat } from "./partial/dice.js";
|
|
7
|
+
import { renderAlternativeNames, renderChance, renderLaboratoryLevel, renderResistance, } from "./partial/herbary.js";
|
|
8
|
+
import { renderMathOperation } from "./partial/mathOperation.js";
|
|
9
|
+
import { printPlainGeneralPrerequisites } from "./partial/prerequisites/index.js";
|
|
10
|
+
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
11
|
+
import { ResponsiveTextSize } from "./partial/responsiveText.js";
|
|
12
|
+
import { formatTimeSpan } from "./partial/units/timeSpan.js";
|
|
13
|
+
import { MISSING_VALUE, UNHANDLED_VALUE } from "./partial/unknown.js";
|
|
14
|
+
const renderApplicationType = (translate, localeJoin, localeCompare, applicationType) => translate("{$types} poison", {
|
|
15
|
+
types: localeJoin(applicationType
|
|
16
|
+
.map(type => {
|
|
17
|
+
switch (type.kind) {
|
|
18
|
+
case "Weapon":
|
|
19
|
+
return translate("Weapon (poison)");
|
|
20
|
+
case "Ingestion":
|
|
21
|
+
return translate("Ingestion (poison)");
|
|
22
|
+
case "Inhalation":
|
|
23
|
+
return translate("Inhalation (poison)");
|
|
24
|
+
case "Contact":
|
|
25
|
+
return translate("Contact (poison)");
|
|
26
|
+
default:
|
|
27
|
+
return assertExhaustive(type);
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.toSorted(localeCompare)
|
|
31
|
+
.map((type, index, arr) => index === arr.length - 1 && type.at(-1) === "-"
|
|
32
|
+
? type.slice(0, -1)
|
|
33
|
+
: type), "conjunction"),
|
|
34
|
+
});
|
|
35
|
+
const renderLevel = (translate, translateMap, level) => {
|
|
36
|
+
switch (level.kind) {
|
|
37
|
+
case "QualityLevel":
|
|
38
|
+
return translate("QL");
|
|
39
|
+
case "Constant":
|
|
40
|
+
return typeof level.Constant === "number"
|
|
41
|
+
? level.Constant
|
|
42
|
+
: level.Constant.value;
|
|
43
|
+
case "BySubtype":
|
|
44
|
+
return level.BySubtype.map(subtype => `${subtype.value} (${translateMap(subtype.translations)?.name ?? MISSING_VALUE})`).join(", ");
|
|
45
|
+
default:
|
|
46
|
+
return assertExhaustive(level);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const renderAddiction = (translate, translateMap, getInstanceById, addiction) => [
|
|
50
|
+
ensureNonEmpty([
|
|
51
|
+
mapNullable(renderChance(translate, translateMap, addiction), chance => chance +
|
|
52
|
+
parensIf(addiction.check === undefined
|
|
53
|
+
? undefined
|
|
54
|
+
: addiction.check.onlySameMonth === true
|
|
55
|
+
? translate(".input {$count :number} {{check required every {$count}. application in the same month}}", { count: addiction.check.interval })
|
|
56
|
+
: translate(".input {$count :number} {{check required every {$count}. application}}", { count: addiction.check.interval }))),
|
|
57
|
+
mapNullable(addiction.disease, diseaseId => {
|
|
58
|
+
const disease = getInstanceById("Disease", diseaseId);
|
|
59
|
+
const diseaseTranslation = translateMap(disease?.translations);
|
|
60
|
+
return translate("see {$link}", {
|
|
61
|
+
link: diseaseTranslation?.name ?? MISSING_VALUE,
|
|
62
|
+
});
|
|
63
|
+
}),
|
|
64
|
+
].filter(isNotNullish))?.join(", "),
|
|
65
|
+
mapNullable(addiction.withdrawalPrevention, withdrawalPrevention => translate(".input {$value :number} {{{$value} applications every {$interval}}}", {
|
|
66
|
+
value: withdrawalPrevention.amount,
|
|
67
|
+
interval: formatTimeSpan(translate, ResponsiveTextSize.Full, { kind: "Days" }, (() => {
|
|
68
|
+
switch (withdrawalPrevention.interval.kind) {
|
|
69
|
+
case "Constant":
|
|
70
|
+
return withdrawalPrevention.interval.Constant.value;
|
|
71
|
+
case "DiceBased":
|
|
72
|
+
return renderDice(translate, withdrawalPrevention.interval.DiceBased.dice);
|
|
73
|
+
default:
|
|
74
|
+
return assertExhaustive(withdrawalPrevention.interval);
|
|
75
|
+
}
|
|
76
|
+
})()),
|
|
77
|
+
})),
|
|
78
|
+
]
|
|
79
|
+
.filter(isNotNullish)
|
|
80
|
+
.join("; ");
|
|
81
|
+
const renderIntoxicantValues = (translate, translateMap, getInstanceById, intoxicant) => {
|
|
82
|
+
const translation = translateMap(intoxicant.translations);
|
|
83
|
+
return {
|
|
84
|
+
ingestion: translation?.ingestion ?? MISSING_VALUE,
|
|
85
|
+
sideEffect: translation?.side_effect,
|
|
86
|
+
overdose: translation?.overdose ?? MISSING_VALUE,
|
|
87
|
+
legality: intoxicant.legality.is_legal
|
|
88
|
+
? translate("legal")
|
|
89
|
+
: translate("illegal"),
|
|
90
|
+
special: translation?.special,
|
|
91
|
+
addiction: intoxicant?.addiction === undefined
|
|
92
|
+
? undefined
|
|
93
|
+
: renderAddiction(translate, translateMap, getInstanceById, intoxicant.addiction),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const renderSourceTypeBasedValues = (translate, translateMap, getInstanceById, sourceType) => {
|
|
97
|
+
switch (sourceType.kind) {
|
|
98
|
+
case "AnimalVenom":
|
|
99
|
+
return {
|
|
100
|
+
level: renderLevel(translate, translateMap, sourceType.AnimalVenom.level),
|
|
101
|
+
sourceType: translate("animal venom"),
|
|
102
|
+
};
|
|
103
|
+
case "AlchemicalPoison": {
|
|
104
|
+
const translation = translateMap(sourceType.AlchemicalPoison.translations);
|
|
105
|
+
return {
|
|
106
|
+
level: translate("QL"),
|
|
107
|
+
sourceType: translate("alchemical poison"),
|
|
108
|
+
...(sourceType.AlchemicalPoison.intoxicant === undefined
|
|
109
|
+
? undefined
|
|
110
|
+
: renderIntoxicantValues(translate, translateMap, getInstanceById, sourceType.AlchemicalPoison.intoxicant)),
|
|
111
|
+
typicalIngredients: translation?.typical_ingredients.join(", "),
|
|
112
|
+
priceOfIngedientsPerLevel: translate("{$cost} per level", {
|
|
113
|
+
cost: translate(".input {$value :number} {{{$value} silverthalers}}", { value: sourceType.AlchemicalPoison.cost_per_ingredient_level }),
|
|
114
|
+
}),
|
|
115
|
+
laboratory: renderLaboratoryLevel(translate, sourceType.AlchemicalPoison.laboratory),
|
|
116
|
+
brewingDifficulty: sign(sourceType.AlchemicalPoison.brewing_difficulty),
|
|
117
|
+
prerequisitesBrewingProcess: translation?.brewing_process_prerequisites ?? translate("none"),
|
|
118
|
+
tradeSecret: mapNullable(sourceType.AlchemicalPoison.trade_secret, tradeSecret => ({
|
|
119
|
+
apValue: tradeSecret.ap_value,
|
|
120
|
+
prerequisites: tradeSecret.prerequisites,
|
|
121
|
+
})),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
case "MineralPoison":
|
|
125
|
+
return {
|
|
126
|
+
level: sourceType.MineralPoison.level,
|
|
127
|
+
sourceType: translate("mineral poison"),
|
|
128
|
+
};
|
|
129
|
+
case "PlantPoison":
|
|
130
|
+
return {
|
|
131
|
+
level: sourceType.PlantPoison.level,
|
|
132
|
+
sourceType: translate("plant poison"),
|
|
133
|
+
...(sourceType.PlantPoison.intoxicant === undefined
|
|
134
|
+
? undefined
|
|
135
|
+
: renderIntoxicantValues(translate, translateMap, getInstanceById, sourceType.PlantPoison.intoxicant)),
|
|
136
|
+
};
|
|
137
|
+
case "DemonicPoison": {
|
|
138
|
+
const translation = translateMap(sourceType.DemonicPoison.translations);
|
|
139
|
+
return {
|
|
140
|
+
level: renderLevel(translate, translateMap, sourceType.DemonicPoison.level),
|
|
141
|
+
sourceType: translate("demonic poison"),
|
|
142
|
+
note: translation?.note,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
default:
|
|
146
|
+
return assertExhaustive(sourceType);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const renderStart = (translate, translateMap, start) => {
|
|
150
|
+
switch (start.kind) {
|
|
151
|
+
case "Immediate":
|
|
152
|
+
return translate("immediate");
|
|
153
|
+
case "Constant":
|
|
154
|
+
return formatTimeSpan(translate, ResponsiveTextSize.Full, start.Constant.unit, start.Constant.value);
|
|
155
|
+
case "DiceBased":
|
|
156
|
+
return formatTimeSpan(translate, ResponsiveTextSize.Full, start.DiceBased.unit, renderDiceAndFlat(translate, start.DiceBased.dice, start.DiceBased.flat));
|
|
157
|
+
case "Indefinite":
|
|
158
|
+
return (translateMap(start.Indefinite.translations)?.description ??
|
|
159
|
+
MISSING_VALUE);
|
|
160
|
+
default:
|
|
161
|
+
return assertExhaustive(start);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const renderDuration = (translate, translateMap, duration) => {
|
|
165
|
+
switch (duration.kind) {
|
|
166
|
+
case "Instant":
|
|
167
|
+
return translate("instant");
|
|
168
|
+
case "Constant":
|
|
169
|
+
return formatTimeSpan(translate, ResponsiveTextSize.Full, duration.Constant.unit, duration.Constant.value);
|
|
170
|
+
case "DiceBased":
|
|
171
|
+
return formatTimeSpan(translate, ResponsiveTextSize.Full, duration.DiceBased.unit, renderDiceAndFlat(translate, duration.DiceBased.dice, duration.DiceBased.flat));
|
|
172
|
+
case "ExpressionBased":
|
|
173
|
+
return renderMathOperation(duration.ExpressionBased.value, value => {
|
|
174
|
+
switch (value.kind) {
|
|
175
|
+
case "Constant":
|
|
176
|
+
return value.Constant.toString();
|
|
177
|
+
case "Dice":
|
|
178
|
+
return renderDice(translate, value.Dice);
|
|
179
|
+
default:
|
|
180
|
+
return assertExhaustive(value);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
case "Indefinite":
|
|
184
|
+
return (translateMap(duration.Indefinite.translations)?.description ??
|
|
185
|
+
UNHANDLED_VALUE);
|
|
186
|
+
default:
|
|
187
|
+
return assertExhaustive(duration);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const renderCost = (translate, translateMap, cost) => {
|
|
191
|
+
switch (cost.kind) {
|
|
192
|
+
case "CannotBeExtracted":
|
|
193
|
+
return translate("cannot be extracted");
|
|
194
|
+
case "None":
|
|
195
|
+
return translate("none");
|
|
196
|
+
case "Constant":
|
|
197
|
+
return translate(".input {$value :number} {{{$value} silverthalers}}", {
|
|
198
|
+
value: cost.Constant,
|
|
199
|
+
});
|
|
200
|
+
case "Indefinite":
|
|
201
|
+
return (translateMap(cost.Indefinite.translations)?.description ?? MISSING_VALUE);
|
|
202
|
+
default:
|
|
203
|
+
return assertExhaustive(cost);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const renderValueCost = (translate, translateMap, cost, value) => value === undefined
|
|
207
|
+
? {
|
|
208
|
+
label: translate("Cost"),
|
|
209
|
+
value: renderCost(translate, translateMap, cost),
|
|
210
|
+
}
|
|
211
|
+
: {
|
|
212
|
+
label: translate("Value/Cost"),
|
|
213
|
+
value: `${translate(".input {$value :number} {{{$value} silverthalers}}", {
|
|
214
|
+
value,
|
|
215
|
+
})} / ${renderCost(translate, translateMap, cost)}`,
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Get a JSON representation of the rules text for a poison.
|
|
219
|
+
*/
|
|
220
|
+
export const getPoisonEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getResolvedSelectOptionById, idMap }, locale, { content: entry }) => {
|
|
221
|
+
const { translate, translateMap, join: localeJoin, compare: localeCompare, } = locale;
|
|
222
|
+
const translation = translateMap(entry.translations);
|
|
223
|
+
if (translation === undefined) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const applicationType = renderApplicationType(translate, localeJoin, localeCompare, entry.application_type);
|
|
227
|
+
const { level, sourceType, ingestion, sideEffect, overdose, legality, special, addiction, typicalIngredients, priceOfIngedientsPerLevel, laboratory, brewingDifficulty, prerequisitesBrewingProcess, tradeSecret, note, } = renderSourceTypeBasedValues(translate, translateMap, getInstanceById, entry.source_type);
|
|
228
|
+
return {
|
|
229
|
+
title: translation.name,
|
|
230
|
+
className: "poison",
|
|
231
|
+
body: [
|
|
232
|
+
{
|
|
233
|
+
type: "definitionList",
|
|
234
|
+
items: [
|
|
235
|
+
renderAlternativeNames(translate, translation.alternative_names),
|
|
236
|
+
{
|
|
237
|
+
label: translate("Level"),
|
|
238
|
+
value: level.toString(),
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
label: translate("Type"),
|
|
242
|
+
value: `${applicationType}, ${sourceType}`,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
label: translate("Resistance"),
|
|
246
|
+
value: renderResistance(translate, translateMap, getInstanceById, idMap, entry.resistance),
|
|
247
|
+
},
|
|
248
|
+
ingestion === undefined
|
|
249
|
+
? undefined
|
|
250
|
+
: {
|
|
251
|
+
label: translate("Ingestion"),
|
|
252
|
+
value: ingestion,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: translate("Effect"),
|
|
256
|
+
value: translation.effect.default +
|
|
257
|
+
(translation.effect.reduced === undefined
|
|
258
|
+
? ""
|
|
259
|
+
: ` / ${translation.effect.reduced}`),
|
|
260
|
+
},
|
|
261
|
+
sideEffect === undefined
|
|
262
|
+
? undefined
|
|
263
|
+
: {
|
|
264
|
+
label: translate("Side Effect"),
|
|
265
|
+
value: sideEffect,
|
|
266
|
+
},
|
|
267
|
+
overdose === undefined
|
|
268
|
+
? undefined
|
|
269
|
+
: {
|
|
270
|
+
label: translate("Overdose"),
|
|
271
|
+
value: overdose,
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
label: translate("Start"),
|
|
275
|
+
value: renderStart(translate, translateMap, entry.start),
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
label: translate("Duration"),
|
|
279
|
+
value: renderDuration(translate, translateMap, entry.duration.default) +
|
|
280
|
+
(entry.duration.reduced === undefined
|
|
281
|
+
? ""
|
|
282
|
+
: ` / ${renderDuration(translate, translateMap, entry.duration.reduced)}`),
|
|
283
|
+
},
|
|
284
|
+
legality === undefined
|
|
285
|
+
? undefined
|
|
286
|
+
: {
|
|
287
|
+
label: translate("Legality"),
|
|
288
|
+
value: legality,
|
|
289
|
+
},
|
|
290
|
+
renderValueCost(translate, translateMap, entry.cost, entry.value),
|
|
291
|
+
special === undefined
|
|
292
|
+
? undefined
|
|
293
|
+
: {
|
|
294
|
+
label: translate("Special"),
|
|
295
|
+
value: special,
|
|
296
|
+
},
|
|
297
|
+
addiction === undefined
|
|
298
|
+
? undefined
|
|
299
|
+
: {
|
|
300
|
+
label: translate("Addiction"),
|
|
301
|
+
value: addiction,
|
|
302
|
+
},
|
|
303
|
+
typicalIngredients === undefined
|
|
304
|
+
? undefined
|
|
305
|
+
: {
|
|
306
|
+
label: translate("Typical Ingredients"),
|
|
307
|
+
value: typicalIngredients,
|
|
308
|
+
},
|
|
309
|
+
priceOfIngedientsPerLevel === undefined
|
|
310
|
+
? undefined
|
|
311
|
+
: {
|
|
312
|
+
label: translate("Price of Ingredients/Level"),
|
|
313
|
+
value: priceOfIngedientsPerLevel,
|
|
314
|
+
},
|
|
315
|
+
laboratory === undefined
|
|
316
|
+
? undefined
|
|
317
|
+
: {
|
|
318
|
+
label: translate("Laboratory"),
|
|
319
|
+
value: laboratory,
|
|
320
|
+
},
|
|
321
|
+
brewingDifficulty === undefined
|
|
322
|
+
? undefined
|
|
323
|
+
: {
|
|
324
|
+
label: translate("Brewing Difficulty"),
|
|
325
|
+
value: brewingDifficulty,
|
|
326
|
+
},
|
|
327
|
+
prerequisitesBrewingProcess === undefined
|
|
328
|
+
? undefined
|
|
329
|
+
: {
|
|
330
|
+
label: `${translate("Prerequisites")} (${translate("Brewing Process")})`,
|
|
331
|
+
value: prerequisitesBrewingProcess,
|
|
332
|
+
},
|
|
333
|
+
tradeSecret === undefined
|
|
334
|
+
? undefined
|
|
335
|
+
: {
|
|
336
|
+
label: `${translate("AP Value")} (${translate("Trade Secret")})`,
|
|
337
|
+
value: translate("{$value} AP", { value: tradeSecret.apValue }) +
|
|
338
|
+
parensIf(mapNullable(tradeSecret.prerequisites, prerequisites => `${translate("Prerequisites")}: ${printPlainGeneralPrerequisites(getInstanceById, getResolvedSelectOptionById, locale, prerequisites)}`)),
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
label: translate("Quality Levels"),
|
|
342
|
+
value: translate("The poison levels equals the QL."),
|
|
343
|
+
},
|
|
344
|
+
note === undefined
|
|
345
|
+
? undefined
|
|
346
|
+
: {
|
|
347
|
+
label: translate("Note"),
|
|
348
|
+
value: note,
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
errata: translation.errata,
|
|
354
|
+
references: entry.src,
|
|
355
|
+
};
|
|
356
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type MagicalActionIdentifier, type RatedIdentifier, type SpecialAbilityIdentifier } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
|
+
import { type GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get a JSON representation of the rules text for a profession version.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getProfessionVersionEntityDescription: import("../creator.js").EntityDescriptionCreator<"ProfessionVersion", {
|
|
8
|
+
getInstanceById: GetInstanceById<"Publication" | "ExperienceLevel" | "Advantage" | "Disadvantage" | SpecialAbilityIdentifier["kind"] | "Aspect" | RatedIdentifier["kind"] | "Race" | "Culture" | MagicalActionIdentifier["kind"] | "SkillGroup" | "Cantrip" | "Blessing">;
|
|
9
|
+
getAllInstances: GetAllInstances<"SkillGroup">;
|
|
10
|
+
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionPackage" | "ProfessionVariant">;
|
|
11
|
+
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
12
|
+
}, import("../index.js").EntityDescription>;
|