-
Notifications
You must be signed in to change notification settings - Fork 309
/
data.ts
74 lines (63 loc) · 2.37 KB
/
data.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { PhysicalItemSource } from "@item/base/data/index.ts";
import {
BasePhysicalItemSource,
PhysicalItemTraits,
PhysicalSystemData,
PhysicalSystemSource,
} from "@item/physical/data.ts";
import { HeldUsage } from "@item/physical/usage.ts";
import { WeaponRuneData, WeaponRuneSource } from "@item/weapon/data.ts";
import { ZeroToSix } from "@module/data.ts";
import { DamageType } from "@system/damage/types.ts";
import { BaseShieldType, ShieldTrait } from "./types.ts";
type ShieldSource = BasePhysicalItemSource<"shield", ShieldSystemSource>;
interface ShieldSystemSource extends PhysicalSystemSource {
traits: ShieldTraitsSource;
baseItem: BaseShieldType | null;
acBonus: number;
speedPenalty: number;
/** Data stored at the time of marking a shield as specific */
specific: SpecificShieldData | null;
/** Currently supports reinforcing runes */
runes: ShieldRuneData;
/** Usage for shields isn't stored. */
readonly usage?: never;
/** Doubly-embedded adjustments, attachments, talismans etc. */
subitems: PhysicalItemSource[];
}
interface IntegratedWeaponSource {
runes: WeaponRuneSource;
versatile: { selection: DamageType } | null;
}
interface ShieldTraitsSource extends PhysicalItemTraits<ShieldTrait> {
integrated: IntegratedWeaponSource | null;
}
type ShieldRuneData = { reinforcing: ZeroToSix };
/** A weapon can either be unspecific or specific along with baseline material and runes */
interface SpecificShieldData extends Pick<ShieldSystemSource, "material" | "runes"> {
integrated: { runes: Omit<WeaponRuneData, "effects"> } | null;
}
interface ShieldSystemData
extends Omit<ShieldSystemSource, SourceOmission>,
Omit<PhysicalSystemData, "baseItem" | "traits"> {
traits: ShieldTraits;
/** Shields are always held. */
usage: HeldUsage;
stackGroup: null;
}
type SourceOmission = "bulk" | "hp" | "identification" | "items" | "material" | "price" | "temporary" | "usage";
interface IntegratedWeaponData extends IntegratedWeaponSource {
damageType: DamageType;
versatile: { options: DamageType[]; selection: DamageType } | null;
}
interface ShieldTraits extends ShieldTraitsSource {
integrated: IntegratedWeaponData | null;
}
export type {
IntegratedWeaponData,
IntegratedWeaponSource,
ShieldSource,
ShieldSystemData,
ShieldSystemSource,
SpecificShieldData,
};