@archivist-gg/dnd5e 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSES/SRD.md +37 -0
- package/README.md +65 -0
- package/dist/armor/armor.codec.d.ts +10 -0
- package/dist/armor/armor.codec.js +8 -0
- package/dist/armor/armor.entity-type.d.ts +2 -0
- package/dist/armor/armor.parser.d.ts +3 -0
- package/dist/armor/armor.parser.js +7 -0
- package/dist/armor/armor.schema.d.ts +25 -0
- package/dist/armor/armor.schema.js +6 -0
- package/dist/armor/armor.types.d.ts +26 -0
- package/dist/armor/armor.types.js +0 -0
- package/dist/background/background.codec.d.ts +9 -0
- package/dist/background/background.codec.js +11 -0
- package/dist/background/background.entity-type.d.ts +2 -0
- package/dist/background/background.parser.d.ts +3 -0
- package/dist/background/background.parser.js +10 -0
- package/dist/background/background.schema.d.ts +74 -0
- package/dist/background/background.schema.js +9 -0
- package/dist/background/background.types.d.ts +52 -0
- package/dist/background/background.types.js +0 -0
- package/dist/chunk-24GFQU7T.js +18 -0
- package/dist/chunk-3DZ74AKK.js +28 -0
- package/dist/chunk-3TM34RSJ.js +23 -0
- package/dist/chunk-3TRGRSCH.js +8 -0
- package/dist/chunk-4C2KOKLF.js +185 -0
- package/dist/chunk-4F6AIZ36.js +19 -0
- package/dist/chunk-4SSDYJS2.js +86 -0
- package/dist/chunk-4TIJKN6O.js +37 -0
- package/dist/chunk-537BHVSH.js +18 -0
- package/dist/chunk-5INR4NSL.js +18 -0
- package/dist/chunk-5XUXXAQJ.js +30 -0
- package/dist/chunk-656QCX4U.js +22 -0
- package/dist/chunk-66XXW2Z2.js +133 -0
- package/dist/chunk-6NK2MUD3.js +114 -0
- package/dist/chunk-6PXE7T7C.js +79 -0
- package/dist/chunk-7P65Q426.js +158 -0
- package/dist/chunk-A7T5L7SS.js +83 -0
- package/dist/chunk-AFKTJXRA.js +39 -0
- package/dist/chunk-B7UXKNLD.js +46 -0
- package/dist/chunk-BAXWWGFJ.js +45 -0
- package/dist/chunk-BH6AMZVY.js +25 -0
- package/dist/chunk-CDW7R2QT.js +62 -0
- package/dist/chunk-DABBCYTT.js +68 -0
- package/dist/chunk-DC74TZNA.js +46 -0
- package/dist/chunk-DNAJRMNN.js +68 -0
- package/dist/chunk-DRNZJNJP.js +19 -0
- package/dist/chunk-FEOB24KP.js +18 -0
- package/dist/chunk-FFULAF2P.js +63 -0
- package/dist/chunk-FUK7QSN5.js +19 -0
- package/dist/chunk-GIOH5JB5.js +19 -0
- package/dist/chunk-GJOI2GHP.js +25 -0
- package/dist/chunk-GZ46OVGZ.js +31 -0
- package/dist/chunk-HCP3GMHS.js +44 -0
- package/dist/chunk-IDTDACM6.js +19 -0
- package/dist/chunk-IKSMX4TN.js +0 -0
- package/dist/chunk-IXZXFFFW.js +269 -0
- package/dist/chunk-J2RYSZMQ.js +16 -0
- package/dist/chunk-JEYQU3JT.js +36 -0
- package/dist/chunk-LSLSG67V.js +31 -0
- package/dist/chunk-LWFTHJIE.js +24 -0
- package/dist/chunk-MDEJHMKK.js +52 -0
- package/dist/chunk-N2JE7BWL.js +81 -0
- package/dist/chunk-NAEPSZAM.js +88 -0
- package/dist/chunk-NXR3BD2V.js +90 -0
- package/dist/chunk-PKC77VZP.js +18 -0
- package/dist/chunk-PMADYMUI.js +19 -0
- package/dist/chunk-PTXBIDG7.js +63 -0
- package/dist/chunk-PZOWBI3B.js +49 -0
- package/dist/chunk-QQ5W2AZP.js +515 -0
- package/dist/chunk-QS5L5YTJ.js +24 -0
- package/dist/chunk-QYZV2MQA.js +97 -0
- package/dist/chunk-R2ZV233X.js +233 -0
- package/dist/chunk-RAWJTA45.js +271 -0
- package/dist/chunk-RSDRMH54.js +18 -0
- package/dist/chunk-RVYYKYFL.js +18 -0
- package/dist/chunk-SSXBYF3P.js +18 -0
- package/dist/chunk-TJCNX6UZ.js +521 -0
- package/dist/chunk-TZK36BU7.js +38 -0
- package/dist/chunk-UC4FE5X3.js +65 -0
- package/dist/chunk-WP2CX2JO.js +235 -0
- package/dist/chunk-WYGD2UGN.js +14 -0
- package/dist/chunk-XJNECUPT.js +31 -0
- package/dist/chunk-XURS6Q6Q.js +127 -0
- package/dist/chunk-Y4I74YEG.js +33 -0
- package/dist/chunk-Z4TL2V7S.js +18 -0
- package/dist/chunk-Z6GXV2GO.js +121 -0
- package/dist/chunk-ZLG6FQFB.js +237 -0
- package/dist/chunk-ZMR77DDL.js +18 -0
- package/dist/class/class.codec.d.ts +10 -0
- package/dist/class/class.codec.js +15 -0
- package/dist/class/class.entity-type.d.ts +2 -0
- package/dist/class/class.parser.d.ts +3 -0
- package/dist/class/class.parser.js +14 -0
- package/dist/class/class.schema.d.ts +202 -0
- package/dist/class/class.schema.js +13 -0
- package/dist/class/class.slug.d.ts +11 -0
- package/dist/class/class.slug.js +8 -0
- package/dist/class/class.types.d.ts +74 -0
- package/dist/class/class.types.js +0 -0
- package/dist/data-srd/index.generated.d.ts +7 -0
- package/dist/data-srd/index.generated.js +146 -0
- package/dist/dnd/constants.d.ts +16 -0
- package/dist/dnd/constants.js +36 -0
- package/dist/dnd/formula-tags.d.ts +16 -0
- package/dist/dnd/formula-tags.js +119 -0
- package/dist/dnd/math.d.ts +24 -0
- package/dist/dnd/math.js +35 -0
- package/dist/dnd/prose-tags.d.ts +16 -0
- package/dist/dnd/prose-tags.js +18 -0
- package/dist/dnd/resource-die.d.ts +6 -0
- package/dist/dnd/resource-die.js +17 -0
- package/dist/dnd/resource-formula.d.ts +41 -0
- package/dist/dnd/resource-formula.js +159 -0
- package/dist/dnd/srd-tag-converter.d.ts +44 -0
- package/dist/dnd/srd-tag-converter.js +12 -0
- package/dist/dnd/tag-grammar.d.ts +19 -0
- package/dist/dnd/tag-grammar.js +12 -0
- package/dist/encounter/encounter.ai-schema.d.ts +29 -0
- package/dist/encounter/encounter.ai-schema.js +8 -0
- package/dist/encounter/encounter.entity-type.d.ts +2 -0
- package/dist/encounter/encounter.generatable.d.ts +2 -0
- package/dist/entities/base-item-resolver.d.ts +21 -0
- package/dist/entities/base-item-resolver.js +9 -0
- package/dist/entities/slug.d.ts +5 -0
- package/dist/entities/slug.js +6 -0
- package/dist/feat/feat.codec.d.ts +9 -0
- package/dist/feat/feat.codec.js +10 -0
- package/dist/feat/feat.entity-type.d.ts +2 -0
- package/dist/feat/feat.parser.d.ts +3 -0
- package/dist/feat/feat.parser.js +9 -0
- package/dist/feat/feat.schema.d.ts +194 -0
- package/dist/feat/feat.schema.js +8 -0
- package/dist/feat/feat.types.d.ts +42 -0
- package/dist/feat/feat.types.js +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +139149 -0
- package/dist/inline-tag-parser.d.ts +11 -0
- package/dist/inline-tag-parser.js +6 -0
- package/dist/item/item.actions-map.d.ts +41 -0
- package/dist/item/item.actions-map.js +85 -0
- package/dist/item/item.ai-schema.d.ts +35 -0
- package/dist/item/item.ai-schema.js +6 -0
- package/dist/item/item.attunement.d.ts +18 -0
- package/dist/item/item.attunement.js +12 -0
- package/dist/item/item.bonuses.d.ts +2 -0
- package/dist/item/item.bonuses.js +7 -0
- package/dist/item/item.codec.d.ts +3 -0
- package/dist/item/item.codec.js +8 -0
- package/dist/item/item.conditions.d.ts +10 -0
- package/dist/item/item.conditions.js +8 -0
- package/dist/item/item.conditions.types.d.ts +28 -0
- package/dist/item/item.conditions.types.js +0 -0
- package/dist/item/item.enrichment.d.ts +4 -0
- package/dist/item/item.enrichment.js +9 -0
- package/dist/item/item.entity-type.d.ts +2 -0
- package/dist/item/item.generatable.d.ts +2 -0
- package/dist/item/item.parser.d.ts +3 -0
- package/dist/item/item.parser.js +7 -0
- package/dist/item/item.schema.d.ts +174 -0
- package/dist/item/item.schema.js +8 -0
- package/dist/item/item.types.d.ts +108 -0
- package/dist/item/item.types.js +0 -0
- package/dist/monster/monster.ai-schema.d.ts +67 -0
- package/dist/monster/monster.ai-schema.js +6 -0
- package/dist/monster/monster.codec.d.ts +13 -0
- package/dist/monster/monster.enrichment.d.ts +10 -0
- package/dist/monster/monster.enrichment.js +19 -0
- package/dist/monster/monster.entity-type.d.ts +2 -0
- package/dist/monster/monster.generatable.d.ts +2 -0
- package/dist/monster/monster.parser.d.ts +3 -0
- package/dist/monster/monster.parser.js +6 -0
- package/dist/monster/monster.resolve.d.ts +10 -0
- package/dist/monster/monster.types.d.ts +29 -0
- package/dist/monster/monster.types.js +1 -0
- package/dist/npc/npc.ai-schema.d.ts +6 -0
- package/dist/npc/npc.entity-type.d.ts +2 -0
- package/dist/npc/npc.generatable.d.ts +2 -0
- package/dist/optional-feature/optional-feature.codec.d.ts +14 -0
- package/dist/optional-feature/optional-feature.codec.js +11 -0
- package/dist/optional-feature/optional-feature.entity-type.d.ts +2 -0
- package/dist/optional-feature/optional-feature.parser.d.ts +3 -0
- package/dist/optional-feature/optional-feature.parser.js +10 -0
- package/dist/optional-feature/optional-feature.schema.d.ts +236 -0
- package/dist/optional-feature/optional-feature.schema.js +9 -0
- package/dist/pack.d.ts +11 -0
- package/dist/pc/conditions.constants.d.ts +3 -0
- package/dist/pc/conditions.constants.js +8 -0
- package/dist/pc/decision-recognizer.d.ts +4 -0
- package/dist/pc/decision-recognizer.js +8 -0
- package/dist/pc/pc.conditions.d.ts +3 -0
- package/dist/pc/pc.conditions.js +6 -0
- package/dist/pc/pc.decision-engine.d.ts +97 -0
- package/dist/pc/pc.decision-engine.js +19 -0
- package/dist/pc/pc.equipment.d.ts +12 -0
- package/dist/pc/pc.equipment.js +15 -0
- package/dist/pc/pc.feature-effects.d.ts +95 -0
- package/dist/pc/pc.feature-effects.js +9 -0
- package/dist/pc/pc.formula-context.d.ts +4 -0
- package/dist/pc/pc.formula-context.js +11 -0
- package/dist/pc/pc.parser.d.ts +3 -0
- package/dist/pc/pc.parser.js +41 -0
- package/dist/pc/pc.pools.d.ts +12 -0
- package/dist/pc/pc.pools.js +15 -0
- package/dist/pc/pc.proficiencies.d.ts +8 -0
- package/dist/pc/pc.proficiencies.js +47 -0
- package/dist/pc/pc.proficiency-query.d.ts +11 -0
- package/dist/pc/pc.proficiency-query.js +17 -0
- package/dist/pc/pc.recalc.d.ts +105 -0
- package/dist/pc/pc.recalc.js +662 -0
- package/dist/pc/pc.resolver.d.ts +34 -0
- package/dist/pc/pc.resolver.js +267 -0
- package/dist/pc/pc.resource-seed.d.ts +10 -0
- package/dist/pc/pc.resource-seed.js +40 -0
- package/dist/pc/pc.rest.d.ts +23 -0
- package/dist/pc/pc.rest.js +128 -0
- package/dist/pc/pc.schema.d.ts +294 -0
- package/dist/pc/pc.schema.js +7 -0
- package/dist/pc/pc.slotting.d.ts +22 -0
- package/dist/pc/pc.slotting.js +20 -0
- package/dist/pc/pc.spellcasting.d.ts +56 -0
- package/dist/pc/pc.spellcasting.js +16 -0
- package/dist/pc/pc.table-column.d.ts +12 -0
- package/dist/pc/pc.table-column.js +8 -0
- package/dist/pc/pc.types.d.ts +514 -0
- package/dist/pc/pc.types.js +0 -0
- package/dist/race/race.codec.d.ts +9 -0
- package/dist/race/race.codec.js +13 -0
- package/dist/race/race.entity-type.d.ts +2 -0
- package/dist/race/race.parser.d.ts +3 -0
- package/dist/race/race.parser.js +12 -0
- package/dist/race/race.schema.d.ts +67 -0
- package/dist/race/race.schema.js +11 -0
- package/dist/race/race.types.d.ts +44 -0
- package/dist/race/race.types.js +0 -0
- package/dist/schemas/attack-schema.d.ts +38 -0
- package/dist/schemas/choice-schema.d.ts +5 -0
- package/dist/schemas/choice-schema.js +7 -0
- package/dist/schemas/duration-schema.d.ts +13 -0
- package/dist/schemas/duration-schema.js +6 -0
- package/dist/schemas/equipment-grant-schema.d.ts +6 -0
- package/dist/schemas/equipment-grant-schema.js +12 -0
- package/dist/schemas/feature-effect-schema.d.ts +131 -0
- package/dist/schemas/feature-effect-schema.js +6 -0
- package/dist/schemas/feature-schema.d.ts +2 -0
- package/dist/schemas/feature-schema.js +10 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/resource-schema.d.ts +95 -0
- package/dist/schemas/resource-schema.js +12 -0
- package/dist/schemas/selection-pool-schema.d.ts +34 -0
- package/dist/schemas/selection-pool-schema.js +10 -0
- package/dist/spell/spell.access.d.ts +15 -0
- package/dist/spell/spell.access.js +25 -0
- package/dist/spell/spell.ai-schema.d.ts +24 -0
- package/dist/spell/spell.ai-schema.js +6 -0
- package/dist/spell/spell.codec.d.ts +3 -0
- package/dist/spell/spell.codec.js +8 -0
- package/dist/spell/spell.enrichment.d.ts +2 -0
- package/dist/spell/spell.enrichment.js +9 -0
- package/dist/spell/spell.entity-type.d.ts +2 -0
- package/dist/spell/spell.filter.d.ts +15 -0
- package/dist/spell/spell.filter.js +87 -0
- package/dist/spell/spell.generatable.d.ts +2 -0
- package/dist/spell/spell.parser.d.ts +3 -0
- package/dist/spell/spell.parser.js +7 -0
- package/dist/spell/spell.scaling.d.ts +14 -0
- package/dist/spell/spell.scaling.js +28 -0
- package/dist/spell/spell.schema.d.ts +31 -0
- package/dist/spell/spell.schema.js +6 -0
- package/dist/spell/spell.types.d.ts +25 -0
- package/dist/spell/spell.types.js +0 -0
- package/dist/srd-store.d.ts +53 -0
- package/dist/subclass/subclass.codec.d.ts +11 -0
- package/dist/subclass/subclass.codec.js +14 -0
- package/dist/subclass/subclass.entity-type.d.ts +2 -0
- package/dist/subclass/subclass.parser.d.ts +3 -0
- package/dist/subclass/subclass.parser.js +13 -0
- package/dist/subclass/subclass.schema.d.ts +118 -0
- package/dist/subclass/subclass.schema.js +12 -0
- package/dist/subclass/subclass.types.d.ts +20 -0
- package/dist/subclass/subclass.types.js +0 -0
- package/dist/types/abilities.d.ts +8 -0
- package/dist/types/abilities.js +0 -0
- package/dist/types/ac.d.ts +5 -0
- package/dist/types/attack.d.ts +22 -0
- package/dist/types/attack.js +0 -0
- package/dist/types/casting-option.d.ts +14 -0
- package/dist/types/casting-option.js +0 -0
- package/dist/types/choice.d.ts +66 -0
- package/dist/types/choice.js +6 -0
- package/dist/types/edition.d.ts +4 -0
- package/dist/types/edition.js +0 -0
- package/dist/types/equipment-grant.d.ts +41 -0
- package/dist/types/equipment-grant.js +0 -0
- package/dist/types/feature-effect.d.ts +79 -0
- package/dist/types/feature-effect.js +0 -0
- package/dist/types/feature.d.ts +41 -0
- package/dist/types/feature.js +0 -0
- package/dist/types/formula-context.d.ts +7 -0
- package/dist/types/formula-context.js +0 -0
- package/dist/types/hp.d.ts +4 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/item-conditions.types.d.ts +63 -0
- package/dist/types/item-conditions.types.js +0 -0
- package/dist/types/optional-feature.types.d.ts +60 -0
- package/dist/types/optional-feature.types.js +0 -0
- package/dist/types/resource.d.ts +44 -0
- package/dist/types/resource.js +0 -0
- package/dist/types/selection-pool.d.ts +37 -0
- package/dist/types/selection-pool.js +0 -0
- package/dist/types/speed.d.ts +8 -0
- package/dist/weapon/weapon.codec.d.ts +12 -0
- package/dist/weapon/weapon.codec.js +8 -0
- package/dist/weapon/weapon.entity-type.d.ts +2 -0
- package/dist/weapon/weapon.parser.d.ts +3 -0
- package/dist/weapon/weapon.parser.js +7 -0
- package/dist/weapon/weapon.schema.d.ts +34 -0
- package/dist/weapon/weapon.schema.js +6 -0
- package/dist/weapon/weapon.types.d.ts +36 -0
- package/dist/weapon/weapon.types.js +0 -0
- package/package.json +32 -0
- package/src/data-srd/ATTRIBUTION.md +2 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type InlineTagType = "dice" | "damage" | "dc" | "atk" | "mod" | "check";
|
|
2
|
+
export interface FormulaRef {
|
|
3
|
+
ability: string;
|
|
4
|
+
kind: "attack" | "damage" | "dc";
|
|
5
|
+
}
|
|
6
|
+
export interface InlineTag {
|
|
7
|
+
type: InlineTagType;
|
|
8
|
+
content: string;
|
|
9
|
+
formula?: FormulaRef | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseInlineTag(text: string): InlineTag | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { EquipmentEntry } from "../pc/pc.types.js";
|
|
2
|
+
export type ActionCost = "action" | "bonus-action" | "reaction" | "free" | "special";
|
|
3
|
+
export interface ItemAction {
|
|
4
|
+
cost: ActionCost;
|
|
5
|
+
range?: string;
|
|
6
|
+
max_charges?: number;
|
|
7
|
+
recovery?: {
|
|
8
|
+
amount: string;
|
|
9
|
+
reset: "dawn" | "short" | "long" | "special";
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Curated map of canonical SRD chargeable / activated items.
|
|
14
|
+
* Slugs match the SRD compendium slug format. Augmenter reads this map
|
|
15
|
+
* and stamps `actions: ItemAction` onto the augmented entity bundle.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ITEM_ACTIONS: Record<string, ItemAction>;
|
|
18
|
+
/**
|
|
19
|
+
* Look up an ItemAction by slug, accepting either a bare name slug
|
|
20
|
+
* (`wand-of-fireballs`) or a compendium-prefixed slug
|
|
21
|
+
* (`srd-5e_wand-of-fireballs`, `srd-2024_wand-of-fireballs`,
|
|
22
|
+
* `homebrew_wand-of-fireballs`).
|
|
23
|
+
*
|
|
24
|
+
* Compendium-prefixed slugs follow the shape `<prefix>_<name-slug>` where
|
|
25
|
+
* both prefix and name-slug are kebab-case (slugify strips underscores).
|
|
26
|
+
* The first underscore is therefore the unambiguous prefix separator: we
|
|
27
|
+
* try the bare slug after the first underscore first, then fall back to
|
|
28
|
+
* the original slug for legacy bare-slug callers.
|
|
29
|
+
*
|
|
30
|
+
* Returns `undefined` if no map entry matches either form. Does not crash
|
|
31
|
+
* on slugs without an underscore — those are treated as already-bare.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findItemAction(slug: string): ItemAction | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the ItemAction for an equipped entry.
|
|
36
|
+
* Priority: entry.overrides (action + range) merged onto curated map.
|
|
37
|
+
* Returns null when neither source supplies an action cost.
|
|
38
|
+
*
|
|
39
|
+
* Accepts both bare and compendium-prefixed slugs (see `findItemAction`).
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveItemAction(slug: string, entry: EquipmentEntry): ItemAction | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/item/item.actions-map.ts
|
|
2
|
+
var ITEM_ACTIONS = {
|
|
3
|
+
// Wands and rods
|
|
4
|
+
"wand-of-fireballs": { cost: "action", range: "150 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
5
|
+
"wand-of-magic-missiles": { cost: "action", range: "120 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
6
|
+
"wand-of-lightning-bolts": { cost: "action", range: "100 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
7
|
+
"wand-of-paralysis": { cost: "action", range: "60 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
8
|
+
"wand-of-fear": { cost: "action", range: "self", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
9
|
+
"wand-of-binding": { cost: "action", range: "self", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
10
|
+
"wand-of-secrets": { cost: "action", range: "30 ft.", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
11
|
+
"wand-of-web": { cost: "action", range: "60 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
12
|
+
"wand-of-wonder": { cost: "action", range: "120 ft.", max_charges: 7, recovery: { amount: "1d6+1", reset: "dawn" } },
|
|
13
|
+
// Activatable wondrous items
|
|
14
|
+
"boots-of-speed": { cost: "bonus-action", range: "self", max_charges: 1, recovery: { amount: "1", reset: "long" } },
|
|
15
|
+
"boots-of-levitation": { cost: "action", range: "self" },
|
|
16
|
+
"boots-of-striding-and-springing": { cost: "free", range: "self" },
|
|
17
|
+
"broom-of-flying": { cost: "action", range: "touch" },
|
|
18
|
+
"cloak-of-displacement": { cost: "free", range: "self" },
|
|
19
|
+
"cloak-of-the-bat": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "1", reset: "long" } },
|
|
20
|
+
"decanter-of-endless-water": { cost: "action", range: "touch" },
|
|
21
|
+
"drum-of-panic": { cost: "action", range: "120 ft.", max_charges: 1, recovery: { amount: "1", reset: "long" } },
|
|
22
|
+
"eyes-of-charming": { cost: "action", range: "30 ft.", max_charges: 3, recovery: { amount: "3", reset: "dawn" } },
|
|
23
|
+
// Rings
|
|
24
|
+
"ring-of-three-wishes": { cost: "action", range: "self", max_charges: 3, recovery: { amount: "0", reset: "special" } },
|
|
25
|
+
"ring-of-shooting-stars": { cost: "action", range: "60 ft.", max_charges: 6, recovery: { amount: "1d6", reset: "dawn" } },
|
|
26
|
+
"ring-of-the-ram": { cost: "action", range: "60 ft.", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
27
|
+
"ring-of-spell-storing": { cost: "action", range: "self", max_charges: 5 },
|
|
28
|
+
"ring-of-animal-influence": { cost: "action", range: "self", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
29
|
+
"ring-of-elemental-command": { cost: "action", range: "self", max_charges: 5, recovery: { amount: "1d4+1", reset: "dawn" } },
|
|
30
|
+
"ring-of-evasion": { cost: "reaction", range: "self", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
31
|
+
// Necklaces
|
|
32
|
+
"necklace-of-fireballs": { cost: "action", range: "60 ft.", max_charges: 9 },
|
|
33
|
+
// Gems
|
|
34
|
+
"gem-of-brightness": { cost: "action", range: "60 ft.", max_charges: 50 },
|
|
35
|
+
"gem-of-seeing": { cost: "action", range: "self", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
36
|
+
// Helms
|
|
37
|
+
"helm-of-teleportation": { cost: "action", range: "self", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
38
|
+
// Medallions
|
|
39
|
+
"medallion-of-thoughts": { cost: "action", range: "30 ft.", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
40
|
+
// Pipes
|
|
41
|
+
"pipes-of-haunting": { cost: "action", range: "30 ft.", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
42
|
+
"pipes-of-the-sewers": { cost: "action", range: "self", max_charges: 3, recovery: { amount: "1d3", reset: "dawn" } },
|
|
43
|
+
// Cubes / chimes
|
|
44
|
+
"cube-of-force": { cost: "action", range: "self", max_charges: 36, recovery: { amount: "1d20", reset: "dawn" } },
|
|
45
|
+
"chime-of-opening": { cost: "action", range: "120 ft.", max_charges: 10 },
|
|
46
|
+
// Magic weapons with activation actions (surface in items table only via override; weapons table is primary)
|
|
47
|
+
"sun-blade": { cost: "free", range: "self" },
|
|
48
|
+
// Potions / consumables
|
|
49
|
+
"potion-of-healing": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
50
|
+
"potion-of-greater-healing": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
51
|
+
"potion-of-superior-healing": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
52
|
+
"potion-of-supreme-healing": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
53
|
+
"alchemists-fire": { cost: "action", range: "20 ft.", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
54
|
+
"holy-water": { cost: "action", range: "20 ft.", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
55
|
+
"oil-of-sharpness": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } },
|
|
56
|
+
"dust-of-disappearance": { cost: "action", range: "self", max_charges: 1, recovery: { amount: "0", reset: "special" } }
|
|
57
|
+
};
|
|
58
|
+
function findItemAction(slug) {
|
|
59
|
+
if (slug in ITEM_ACTIONS) return ITEM_ACTIONS[slug];
|
|
60
|
+
const underscore = slug.indexOf("_");
|
|
61
|
+
if (underscore < 0) return void 0;
|
|
62
|
+
const bare = slug.slice(underscore + 1);
|
|
63
|
+
return ITEM_ACTIONS[bare];
|
|
64
|
+
}
|
|
65
|
+
function resolveItemAction(slug, entry) {
|
|
66
|
+
var _a;
|
|
67
|
+
const curated = (_a = findItemAction(slug)) != null ? _a : null;
|
|
68
|
+
const override = entry.overrides;
|
|
69
|
+
const overrideCost = override == null ? void 0 : override.action;
|
|
70
|
+
const overrideRange = override == null ? void 0 : override.range;
|
|
71
|
+
if (!curated && !overrideCost) return null;
|
|
72
|
+
const cost = overrideCost != null ? overrideCost : curated == null ? void 0 : curated.cost;
|
|
73
|
+
if (!cost) return null;
|
|
74
|
+
return {
|
|
75
|
+
cost,
|
|
76
|
+
range: overrideRange != null ? overrideRange : curated == null ? void 0 : curated.range,
|
|
77
|
+
max_charges: curated == null ? void 0 : curated.max_charges,
|
|
78
|
+
recovery: curated == null ? void 0 : curated.recovery
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
ITEM_ACTIONS,
|
|
83
|
+
findItemAction,
|
|
84
|
+
resolveItemAction
|
|
85
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const itemInputSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodEnum<{
|
|
5
|
+
weapon: "weapon";
|
|
6
|
+
armor: "armor";
|
|
7
|
+
shield: "shield";
|
|
8
|
+
staff: "staff";
|
|
9
|
+
potion: "potion";
|
|
10
|
+
ring: "ring";
|
|
11
|
+
rod: "rod";
|
|
12
|
+
scroll: "scroll";
|
|
13
|
+
wand: "wand";
|
|
14
|
+
"wondrous item": "wondrous item";
|
|
15
|
+
}>;
|
|
16
|
+
rarity: z.ZodEnum<{
|
|
17
|
+
legendary: "legendary";
|
|
18
|
+
common: "common";
|
|
19
|
+
uncommon: "uncommon";
|
|
20
|
+
rare: "rare";
|
|
21
|
+
"very rare": "very rare";
|
|
22
|
+
artifact: "artifact";
|
|
23
|
+
}>;
|
|
24
|
+
entries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
attunement: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
28
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
damage: z.ZodOptional<z.ZodString>;
|
|
30
|
+
damage_type: z.ZodOptional<z.ZodString>;
|
|
31
|
+
ac: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
charges: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
recharge: z.ZodOptional<z.ZodString>;
|
|
34
|
+
curse: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ArmorEntity } from "../armor/armor.types.js";
|
|
2
|
+
import type { WeaponEntity } from "../weapon/weapon.types.js";
|
|
3
|
+
import type { ItemEntity } from "../item/item.types.js";
|
|
4
|
+
/**
|
|
5
|
+
* `entity.attunement` can be:
|
|
6
|
+
* - undefined / false / "" → not required
|
|
7
|
+
* - true → required, no restriction
|
|
8
|
+
* - "by a wizard" → required, with text restriction
|
|
9
|
+
* - { required: true, restriction? } → required (structured)
|
|
10
|
+
* - { required: false } → not required (structured)
|
|
11
|
+
*
|
|
12
|
+
* This predicate normalizes all five shapes into a single boolean.
|
|
13
|
+
*
|
|
14
|
+
* Accepts any equipped entity. Only items model `attunement`; armor and
|
|
15
|
+
* weapons never require attunement in this domain, so they short-circuit to
|
|
16
|
+
* `false` via the property-presence narrow below.
|
|
17
|
+
*/
|
|
18
|
+
export declare function requiresAttunement(entity: ArmorEntity | WeaponEntity | ItemEntity | null): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/item/item.attunement.ts
|
|
2
|
+
function requiresAttunement(entity) {
|
|
3
|
+
if (!entity || !("attunement" in entity)) return false;
|
|
4
|
+
const a = entity.attunement;
|
|
5
|
+
if (a === true) return true;
|
|
6
|
+
if (typeof a === "string") return a.length > 0;
|
|
7
|
+
if (typeof a === "object" && a !== null) return a.required === true;
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
requiresAttunement
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Condition, ConditionContext, ConditionOutcome } from "./item.conditions.types.js";
|
|
2
|
+
export declare function evaluateCondition(cond: Condition, ctx: ConditionContext): ConditionOutcome;
|
|
3
|
+
/**
|
|
4
|
+
* AND-combine a list of conditions.
|
|
5
|
+
* - Empty list -> "true" (always-applies; matches flat-number semantics).
|
|
6
|
+
* - Any "false" -> "false" (engine certainty short-circuits informational).
|
|
7
|
+
* - Else any "informational" -> "informational".
|
|
8
|
+
* - Else "true".
|
|
9
|
+
*/
|
|
10
|
+
export declare function evaluateConditions(conds: Condition[], ctx: ConditionContext): ConditionOutcome;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EquippedSlots, ClassEntry } from "../pc/pc.types.js";
|
|
2
|
+
import type { BonusFieldPath, Condition } from "../types/item-conditions.types.js";
|
|
3
|
+
export type { Tier1Condition, Tier2Condition, Tier3Condition, Tier4Condition, FreeTextCondition, AnyOfCondition, Condition, ConditionalBonus, BonusFieldPath, } from "../types/item-conditions.types.js";
|
|
4
|
+
export interface InformationalBonus {
|
|
5
|
+
field: BonusFieldPath;
|
|
6
|
+
source: string;
|
|
7
|
+
value: number;
|
|
8
|
+
conditions: Condition[];
|
|
9
|
+
}
|
|
10
|
+
export type ConditionOutcome = "true" | "false" | "informational";
|
|
11
|
+
export interface ConditionContext {
|
|
12
|
+
derived: {
|
|
13
|
+
equippedSlots: EquippedSlots;
|
|
14
|
+
};
|
|
15
|
+
classList: ClassEntry[];
|
|
16
|
+
race: string | null;
|
|
17
|
+
subclasses: string[];
|
|
18
|
+
}
|
|
19
|
+
export type BonusReadResult = {
|
|
20
|
+
kind: "applied";
|
|
21
|
+
value: number;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "skipped";
|
|
24
|
+
} | {
|
|
25
|
+
kind: "informational";
|
|
26
|
+
value: number;
|
|
27
|
+
conditions: Condition[];
|
|
28
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Condition } from "@archivist-gg/dnd5e/types/item-conditions.types";
|
|
3
|
+
export declare const conditionSchema: z.ZodType<Condition>;
|
|
4
|
+
export declare const itemEntitySchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
7
|
+
type: z.ZodOptional<z.ZodString>;
|
|
8
|
+
rarity: z.ZodOptional<z.ZodString>;
|
|
9
|
+
base_item: z.ZodOptional<z.ZodString>;
|
|
10
|
+
bonuses: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
ac: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
12
|
+
value: z.ZodNumber;
|
|
13
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
14
|
+
}, z.core.$strip>]>>;
|
|
15
|
+
weapon_attack: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
16
|
+
value: z.ZodNumber;
|
|
17
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
18
|
+
}, z.core.$strip>]>>;
|
|
19
|
+
weapon_damage: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
20
|
+
value: z.ZodNumber;
|
|
21
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
22
|
+
}, z.core.$strip>]>>;
|
|
23
|
+
spell_attack: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
24
|
+
value: z.ZodNumber;
|
|
25
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
26
|
+
}, z.core.$strip>]>>;
|
|
27
|
+
spell_save_dc: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
28
|
+
value: z.ZodNumber;
|
|
29
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
30
|
+
}, z.core.$strip>]>>;
|
|
31
|
+
saving_throws: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
32
|
+
value: z.ZodNumber;
|
|
33
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
34
|
+
}, z.core.$strip>]>>;
|
|
35
|
+
ability_scores: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
static: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
str: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
dex: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
con: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
int: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
wis: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
cha: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
bonus: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
str: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
46
|
+
value: z.ZodNumber;
|
|
47
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
48
|
+
}, z.core.$strip>]>>;
|
|
49
|
+
dex: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
50
|
+
value: z.ZodNumber;
|
|
51
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
52
|
+
}, z.core.$strip>]>>;
|
|
53
|
+
con: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
54
|
+
value: z.ZodNumber;
|
|
55
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
56
|
+
}, z.core.$strip>]>>;
|
|
57
|
+
int: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
58
|
+
value: z.ZodNumber;
|
|
59
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
60
|
+
}, z.core.$strip>]>>;
|
|
61
|
+
wis: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
62
|
+
value: z.ZodNumber;
|
|
63
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
64
|
+
}, z.core.$strip>]>>;
|
|
65
|
+
cha: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
66
|
+
value: z.ZodNumber;
|
|
67
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
68
|
+
}, z.core.$strip>]>>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
speed: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
walk: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
73
|
+
value: z.ZodNumber;
|
|
74
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
75
|
+
}, z.core.$strip>]>>;
|
|
76
|
+
fly: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
77
|
+
value: z.ZodNumber;
|
|
78
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
79
|
+
}, z.core.$strip>]>, z.ZodLiteral<"walk">]>>;
|
|
80
|
+
swim: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
81
|
+
value: z.ZodNumber;
|
|
82
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
83
|
+
}, z.core.$strip>]>>;
|
|
84
|
+
climb: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
85
|
+
value: z.ZodNumber;
|
|
86
|
+
when: z.ZodArray<z.ZodType<Condition, unknown, z.core.$ZodTypeInternals<Condition, unknown>>>;
|
|
87
|
+
}, z.core.$strip>]>>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
resist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
immune: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
vulnerable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
+
condition_immune: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
94
|
+
charges: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
max: z.ZodNumber;
|
|
96
|
+
recharge: z.ZodOptional<z.ZodString>;
|
|
97
|
+
recharge_amount: z.ZodOptional<z.ZodString>;
|
|
98
|
+
destroy_on_empty: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
roll: z.ZodString;
|
|
100
|
+
threshold: z.ZodNumber;
|
|
101
|
+
effect: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
}, z.core.$strip>, z.ZodNumber]>>;
|
|
104
|
+
attached_spells: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
charges: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
106
|
+
daily: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
107
|
+
will: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
108
|
+
rest: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
109
|
+
limited: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
attunement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
112
|
+
required: z.ZodBoolean;
|
|
113
|
+
restriction: z.ZodOptional<z.ZodString>;
|
|
114
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
115
|
+
class: z.ZodString;
|
|
116
|
+
subclass: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
118
|
+
alignment: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
race: z.ZodString;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
creature_type: z.ZodString;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
spellcasting: z.ZodBoolean;
|
|
125
|
+
}, z.core.$strip>]>>>;
|
|
126
|
+
}, z.core.$strip>, z.ZodBoolean, z.ZodString]>>;
|
|
127
|
+
grants: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
proficiency: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
languages: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
130
|
+
senses: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
darkvision: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
tremorsense: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
truesight: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
blindsight: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
container: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
capacity_weight: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
weightless: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
pack_contents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
bright_radius: z.ZodNumber;
|
|
144
|
+
dim_radius: z.ZodNumber;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
cursed: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
sentient: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
focus: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
149
|
+
tier: z.ZodOptional<z.ZodEnum<{
|
|
150
|
+
major: "major";
|
|
151
|
+
minor: "minor";
|
|
152
|
+
}>>;
|
|
153
|
+
damage: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
154
|
+
dice: z.ZodString;
|
|
155
|
+
type: z.ZodString;
|
|
156
|
+
versatile_dice: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>, z.ZodString]>>;
|
|
158
|
+
weapon_category: z.ZodOptional<z.ZodString>;
|
|
159
|
+
armor_category: z.ZodOptional<z.ZodString>;
|
|
160
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
161
|
+
cost: z.ZodOptional<z.ZodString>;
|
|
162
|
+
source: z.ZodOptional<z.ZodString>;
|
|
163
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
edition: z.ZodOptional<z.ZodString>;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
entries: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
167
|
+
effects: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
168
|
+
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
169
|
+
damage_dice: z.ZodOptional<z.ZodString>;
|
|
170
|
+
damage_type: z.ZodOptional<z.ZodString>;
|
|
171
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
|
+
recharge: z.ZodOptional<z.ZodString>;
|
|
173
|
+
curse: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Ability, ArmorCategory } from "@archivist-gg/dnd5e/armor/armor.types";
|
|
2
|
+
import type { WeaponCategory, WeaponEntity } from "@archivist-gg/dnd5e/weapon/weapon.types";
|
|
3
|
+
import type { ConditionalBonus } from "@archivist-gg/dnd5e/types/item-conditions.types";
|
|
4
|
+
export type ItemRarity = "common" | "uncommon" | "rare" | "very rare" | "legendary" | "artifact" | string;
|
|
5
|
+
export type AttunementTag = {
|
|
6
|
+
class: string;
|
|
7
|
+
subclass?: string;
|
|
8
|
+
} | {
|
|
9
|
+
alignment: string;
|
|
10
|
+
} | {
|
|
11
|
+
race: string;
|
|
12
|
+
} | {
|
|
13
|
+
creature_type: string;
|
|
14
|
+
};
|
|
15
|
+
export interface ItemEntity {
|
|
16
|
+
name: string;
|
|
17
|
+
slug?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
rarity?: ItemRarity;
|
|
20
|
+
base_item?: string;
|
|
21
|
+
bonuses?: {
|
|
22
|
+
ac?: number | ConditionalBonus;
|
|
23
|
+
weapon_attack?: number | ConditionalBonus;
|
|
24
|
+
weapon_damage?: number | ConditionalBonus;
|
|
25
|
+
spell_attack?: number | ConditionalBonus;
|
|
26
|
+
spell_save_dc?: number | ConditionalBonus;
|
|
27
|
+
saving_throws?: number | ConditionalBonus;
|
|
28
|
+
ability_scores?: {
|
|
29
|
+
static?: Partial<Record<Ability, number>>;
|
|
30
|
+
bonus?: Partial<Record<Ability, number | ConditionalBonus>>;
|
|
31
|
+
};
|
|
32
|
+
speed?: {
|
|
33
|
+
walk?: number | ConditionalBonus;
|
|
34
|
+
fly?: number | ConditionalBonus | "walk";
|
|
35
|
+
swim?: number | ConditionalBonus;
|
|
36
|
+
climb?: number | ConditionalBonus;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
resist?: string[];
|
|
40
|
+
immune?: string[];
|
|
41
|
+
vulnerable?: string[];
|
|
42
|
+
condition_immune?: string[];
|
|
43
|
+
charges?: {
|
|
44
|
+
max: number;
|
|
45
|
+
recharge?: string;
|
|
46
|
+
recharge_amount?: string;
|
|
47
|
+
destroy_on_empty?: {
|
|
48
|
+
roll: string;
|
|
49
|
+
threshold: number;
|
|
50
|
+
effect?: string;
|
|
51
|
+
};
|
|
52
|
+
} | number;
|
|
53
|
+
attached_spells?: {
|
|
54
|
+
charges?: Record<string, string[]>;
|
|
55
|
+
daily?: Record<string, string[]>;
|
|
56
|
+
will?: string[];
|
|
57
|
+
rest?: Record<string, string[]>;
|
|
58
|
+
/** Total uses with no recharge — item often consumed when empty. */
|
|
59
|
+
limited?: Record<string, string[]>;
|
|
60
|
+
};
|
|
61
|
+
attunement?: {
|
|
62
|
+
required: boolean;
|
|
63
|
+
restriction?: string;
|
|
64
|
+
tags?: AttunementTag[];
|
|
65
|
+
} | boolean | string;
|
|
66
|
+
grants?: {
|
|
67
|
+
proficiency?: boolean;
|
|
68
|
+
languages?: boolean | string[];
|
|
69
|
+
senses?: {
|
|
70
|
+
darkvision?: number;
|
|
71
|
+
tremorsense?: number;
|
|
72
|
+
truesight?: number;
|
|
73
|
+
blindsight?: number;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
container?: {
|
|
77
|
+
capacity_weight?: number;
|
|
78
|
+
weightless?: boolean;
|
|
79
|
+
pack_contents?: string[];
|
|
80
|
+
};
|
|
81
|
+
light?: {
|
|
82
|
+
bright_radius: number;
|
|
83
|
+
dim_radius: number;
|
|
84
|
+
};
|
|
85
|
+
cursed?: boolean;
|
|
86
|
+
sentient?: boolean;
|
|
87
|
+
focus?: boolean | "arcane" | "druid" | "holy";
|
|
88
|
+
tier?: "major" | "minor";
|
|
89
|
+
damage?: WeaponEntity["damage"] | string;
|
|
90
|
+
weapon_category?: WeaponCategory;
|
|
91
|
+
armor_category?: ArmorCategory;
|
|
92
|
+
weight?: number | string;
|
|
93
|
+
cost?: string;
|
|
94
|
+
source?: string;
|
|
95
|
+
page?: number;
|
|
96
|
+
edition?: "2014" | "2024" | string;
|
|
97
|
+
description?: string;
|
|
98
|
+
entries?: unknown[];
|
|
99
|
+
effects?: unknown[];
|
|
100
|
+
raw?: Record<string, unknown>;
|
|
101
|
+
damage_dice?: string;
|
|
102
|
+
damage_type?: string;
|
|
103
|
+
properties?: string[];
|
|
104
|
+
recharge?: string;
|
|
105
|
+
curse?: boolean;
|
|
106
|
+
value?: number;
|
|
107
|
+
}
|
|
108
|
+
export type Item = ItemEntity;
|
|
File without changes
|