Phase 3: Split types.ts into domain-specific files

This commit is contained in:
Unknown
2026-04-24 12:23:11 +02:00
parent 3d05f03570
commit eb81ccb5aa
8 changed files with 601 additions and 515 deletions
+13 -515
View File
@@ -1,516 +1,14 @@
// ─── Game Types ───────────────────────────────────────────────────────────────
export type ElementCategory = 'base' | 'utility' | 'composite' | 'exotic';
// Attunement body slots
export type AttunementSlot = 'rightHand' | 'leftHand' | 'head' | 'back' | 'chest' | 'leftLeg' | 'rightLeg';
// Attunement definition
export interface AttunementDef {
id: string;
name: string;
desc: string;
slot: AttunementSlot;
icon: string;
color: string;
primaryManaType?: string; // Primary mana type this attunement generates (null for Invoker)
rawManaRegen: number; // Raw mana regeneration per hour granted by this attunement
conversionRate: number; // Raw mana converted to primary type per hour
unlocked: boolean; // Whether this is unlocked by default
unlockCondition?: string; // Description of how to unlock (for future challenges)
capabilities: string[]; // What this attunement enables (e.g., 'enchanting', 'pacts', 'golemCrafting')
skillCategories: string[]; // Skill categories this attunement provides access to
}
// Attunement instance state (tracks player's attunements)
export interface AttunementState {
id: string;
active: boolean; // Whether this attunement is currently active
level: number; // Attunement level (for future progression)
experience: number; // Progress toward next level
}
export interface ElementDef {
name: string;
sym: string;
color: string;
glow: string;
cat: ElementCategory;
recipe?: string[];
}
export interface ElementState {
current: number;
max: number;
unlocked: boolean;
}
// Boon types that guardians can grant
export interface GuardianBoon {
type: 'maxMana' | 'manaRegen' | 'castingSpeed' | 'elementalDamage' | 'rawDamage' |
'critChance' | 'critDamage' | 'spellEfficiency' | 'manaGain' | 'insightGain' |
'studySpeed' | 'prestigeInsight';
value: number;
desc: string;
}
export interface GuardianDef {
name: string;
element: string;
hp: number;
pact: number; // Pact multiplier when signed
color: string;
boons: GuardianBoon[]; // Bonuses granted when pact is signed
pactCost: number; // Mana cost to perform pact ritual
pactTime: number; // Hours required for pact ritual
uniquePerk: string; // Description of unique perk
armor?: number; // Damage reduction (0-1, e.g., 0.2 = 20% reduction)
}
// Spell cost can be raw mana or elemental mana
export interface SpellCost {
type: 'raw' | 'element'; // 'raw' for raw mana, 'element' for specific elemental mana
element?: string; // Required if type is 'element'
amount: number; // Amount of mana required
}
export interface SpellDef {
name: string;
elem: string; // Element type for damage calculations
dmg: number;
cost: SpellCost; // Changed from number to SpellCost object
tier: number;
unlock: number; // Mana cost to start studying
studyTime?: number; // Hours needed to study (optional, defaults based on tier)
castSpeed?: number; // Casts per hour (default 1, higher = faster)
desc?: string; // Optional spell description
effects?: SpellEffect[]; // Optional special effects
isAoe?: boolean; // AOE spell that hits multiple enemies
aoeTargets?: number; // Number of enemies hit by AOE
isWeaponEnchant?: boolean; // Can be used as weapon enchantment (magic swords)
}
export interface SpellEffect {
type: 'burn' | 'freeze' | 'stun' | 'pierce' | 'multicast' | 'shield' | 'buff' | 'chain' | 'aoe' | 'armor_pierce';
value: number; // Effect potency
duration?: number; // Duration in hours for timed effects
targets?: number; // For AOE: number of targets
chance?: number; // For chance-based effects (e.g., stun chance)
}
export interface SpellState {
learned: boolean;
level: number;
studyProgress?: number; // Hours studied so far (for in-progress spells)
}
// ─── Room and Enemy Types ─────────────────────────────────────────────────────
export type RoomType = 'combat' | 'puzzle' | 'swarm' | 'speed' | 'guardian';
export interface EnemyState {
id: string;
hp: number;
maxHP: number;
armor: number; // Damage reduction (0-1)
dodgeChance: number; // For speed rooms (0-1)
element: string;
}
export interface FloorState {
roomType: RoomType;
enemies: EnemyState[]; // For swarm rooms, multiple enemies
puzzleProgress?: number; // For puzzle rooms (0-1)
puzzleRequired?: number; // Total progress needed
puzzleId?: string; // Which puzzle type
puzzleAttunements?: string[]; // Which attunements speed up this puzzle
}
export interface SkillDef {
name: string;
desc: string;
cat: string;
attunement?: string; // Which attunement this skill belongs to (null = core)
max: number;
base: number; // Mana cost to start studying
req?: Record<string, number>; // Skill prerequisites
attunementReq?: Record<string, number>; // Attunement level requirements (attunement id -> min level)
studyTime: number; // Hours needed to study
level?: number; // Current level (optional, for UI display)
tier?: number; // Skill tier (1-5)
tierUp?: string; // Skill ID this evolves into at max level
baseSkill?: string; // Original skill ID this evolved from
tierMultiplier?: number; // Multiplier for each tier (default 2)
}
// Skill upgrade choices at milestones (level 5 and level 10)
export interface SkillUpgradeDef {
id: string;
name: string;
desc: string;
skillId: string; // Which skill this upgrade belongs to
milestone: 5 | 10; // Level at which this upgrade is available
effect: SkillUpgradeEffect;
}
export interface SkillUpgradeEffect {
type: 'multiplier' | 'bonus' | 'special';
stat?: string; // Stat to modify
value?: number; // Multiplier or bonus value
specialId?: string; // Special effect identifier
specialDesc?: string; // Description of special effect
}
// Skill evolution system - 5-Tier Continuous Talent Tree
// Each skill with max level 10 follows this structure:
// - 5 Tiers (T1-T5)
// - Each tier has L5 and L10 milestone perk choices
// - 3 paths per tier (A, B, C columns) representing different playstyles
// - T3 L10 and T5 L10 have Elite Perks (game-changing mechanics)
export interface SkillEvolutionPath {
baseSkillId: string; // Starting skill ID
tiers: SkillTierDef[]; // 5 tiers of evolution
}
export interface SkillTierDef {
tier: number; // Tier number (1-5)
skillId: string; // Skill ID for this tier
name: string;
multiplier: number; // Base effect multiplier for this tier
// Perk choices organized by milestone and path (A, B, C)
l5Perks: SkillPerkChoice[]; // 3 choices (one per path) at level 5
l10Perks: SkillPerkChoice[]; // 3 choices (one per path) at level 10
}
// Perk choice at a milestone - belongs to a specific path (A, B, or C)
export interface SkillPerkChoice {
id: string;
name: string;
desc: string;
path: 'A' | 'B' | 'C'; // Which path this perk belongs to
isElite?: boolean; // True for T3 L10 and T5 L10 perks
effect: SkillUpgradeEffect;
// For path compounding - if player stays on same path, bonuses compound
pathCompoundBonus?: number; // Exponential bonus for staying on same path
}
export interface SkillUpgradeChoice {
id: string;
name: string;
desc: string;
milestone: 5 | 10; // Level at which this upgrade is available
effect: SkillUpgradeEffect;
}
export interface PrestigeDef {
name: string;
desc: string;
max: number;
cost: number;
}
// Legacy EquipmentDef for backward compatibility
export interface EquipmentDef {
id: string;
name: string;
slot: 'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'accessory';
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic';
stats: Record<string, number>;
durability: number;
maxDurability: number;
element?: string;
}
// Equipment Instance (actual equipped item with enchantments)
export interface EquipmentInstance {
instanceId: string; // Unique ID for this specific item
typeId: string; // Reference to EquipmentType (e.g., 'basicStaff')
name: string; // Display name (defaults to type name)
enchantments: AppliedEnchantment[];
usedCapacity: number; // Currently used capacity
totalCapacity: number; // Base capacity + bonuses
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic';
quality: number; // 0-100, affects capacity efficiency
weaponMana?: number; // Current mana stored in weapon (for weapon enchantments)
weaponManaMax?: number; // Max mana the weapon can store
weaponManaRegen?: number; // Mana regen per hour for weapon
weaponManaType?: string; // Type of mana the weapon stores
activeWeaponEnchant?: string; // Active weapon enchantment (for magic swords)
}
export interface AppliedEnchantment {
effectId: string; // Reference to EnchantmentEffectDef
stacks: number; // Number of times this effect is applied
actualCost: number; // Actual capacity cost (after efficiency)
}
// Enchantment Design (saved design for later application)
export interface EnchantmentDesign {
id: string;
name: string;
equipmentType: string; // Which equipment type this is designed for
effects: DesignEffect[];
totalCapacityUsed: number;
designTime: number; // Hours required to design
created: number; // Timestamp
}
export interface DesignEffect {
effectId: string;
stacks: number;
capacityCost: number;
}
// Crafting Progress States
export interface DesignProgress {
designId: string;
progress: number; // Hours spent designing
required: number; // Total hours needed
// Design data stored during progress
name: string;
equipmentType: string;
effects: DesignEffect[];
}
export interface PreparationProgress {
equipmentInstanceId: string;
progress: number; // Hours spent preparing
required: number; // Total hours needed
manaCostPaid: number; // Mana cost already paid
}
export interface ApplicationProgress {
equipmentInstanceId: string;
designId: string;
progress: number; // Hours spent applying
required: number; // Total hours needed
manaPerHour: number; // Mana cost per hour
paused: boolean;
manaSpent: number; // Total mana spent so far
}
// Equipment crafting progress (from blueprints)
export interface EquipmentCraftingProgress {
blueprintId: string;
equipmentTypeId: string;
progress: number; // Hours spent crafting
required: number; // Total hours needed
manaSpent: number; // Total mana spent so far
}
// Equipment spell state (for multi-spell casting)
export interface EquipmentSpellState {
spellId: string;
sourceEquipment: string; // Equipment instance ID
castProgress: number; // 0-1 progress toward next cast
}
export interface BlueprintDef {
id: string;
name: string;
tier: number;
slot: string;
stats: Record<string, number>;
studyTime: number;
craftTime: number;
craftCost: number;
discovered: boolean;
learned: boolean;
}
// Loot inventory for materials and blueprints
export interface LootInventory {
materials: Record<string, number>; // materialId -> count
blueprints: string[]; // blueprint IDs discovered
}
// Achievement definitions
export interface AchievementDef {
id: string;
name: string;
desc: string;
category: string;
requirement: {
type: string;
value: number;
subType?: string;
};
reward: {
insight?: number;
manaBonus?: number;
damageBonus?: number;
regenBonus?: number;
title?: string;
unlockEffect?: string;
};
hidden?: boolean;
}
// Achievement state tracks unlocked achievements and progress
export interface AchievementState {
unlocked: string[]; // IDs of unlocked achievements
progress: Record<string, number>; // Progress toward achievement requirements
}
export type GameAction = 'meditate' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant';
export interface ScheduleBlock {
id: string;
action: GameAction;
startHour: number;
endHour: number;
enabled: boolean;
target?: string; // spell id, blueprint id, skill id, element id
}
export interface StudyTarget {
type: 'skill' | 'spell' | 'blueprint';
id: string;
progress: number; // Hours studied
required: number; // Total hours needed
}
// ─── Golemancy Types ───────────────────────────────────────────────────────────
export interface SummonedGolem {
golemId: string; // Reference to GOLEMS_DEF
summonedFloor: number; // Floor when golem was summoned
attackProgress: number; // Progress toward next attack (0-1)
}
export interface GolemancyState {
enabledGolems: string[]; // Golem IDs the player wants active
summonedGolems: SummonedGolem[]; // Currently summoned golems on this floor
lastSummonFloor: number; // Floor golems were last summoned on
}
export interface GameState {
// Time
day: number;
hour: number;
loopCount: number;
gameOver: boolean;
victory: boolean;
paused: boolean;
// Raw Mana
rawMana: number;
meditateTicks: number;
totalManaGathered: number;
// Attunements (class-like system)
attunements: Record<string, AttunementState>; // attunement id -> state
// Elements
elements: Record<string, ElementState>;
// Spire
currentFloor: number;
floorHP: number;
floorMaxHP: number;
maxFloorReached: number;
signedPacts: number[];
activeSpell: string;
currentAction: GameAction;
castProgress: number; // Progress towards next spell cast (0-1)
// Room system for special floors
currentRoom: FloorState; // Current room state (swarm, puzzle, speed, etc.)
// Spells
spells: Record<string, SpellState>;
// Skills
skills: Record<string, number>;
skillProgress: Record<string, number>; // Saved study progress for skills
skillUpgrades: Record<string, string[]>; // Selected upgrade IDs per skill
skillTiers: Record<string, number>; // Current tier for each base skill
// Equipment System (new instance-based system)
equippedInstances: Record<string, string | null>; // slot -> instanceId
equipmentInstances: Record<string, EquipmentInstance>; // instanceId -> instance
enchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs
// Crafting Progress
designProgress: DesignProgress | null;
preparationProgress: PreparationProgress | null;
applicationProgress: ApplicationProgress | null;
equipmentCraftingProgress: EquipmentCraftingProgress | null;
// Unlocked enchantment effects for designing
unlockedEffects: string[]; // Effect IDs that have been researched
// Equipment spell states for multi-casting
equipmentSpellStates: EquipmentSpellState[];
// Legacy Equipment (for backward compatibility)
equipment: Record<string, EquipmentDef | null>;
inventory: EquipmentDef[];
// Blueprints
blueprints: Record<string, BlueprintDef>;
// Loot Inventory
lootInventory: LootInventory;
// Schedule
schedule: ScheduleBlock[];
autoSchedule: boolean;
studyQueue: string[];
craftQueue: string[];
// Current Study Target
currentStudyTarget: StudyTarget | null;
// Parallel Study Target (for Parallel Mind milestone upgrade)
parallelStudyTarget: StudyTarget | null;
// Golemancy (summoned golems)
golemancy: GolemancyState;
// Achievements
achievements: AchievementState;
// Stats tracking
totalSpellsCast: number;
totalDamageDealt: number;
totalCraftsCompleted: number;
// Prestige
insight: number;
totalInsight: number;
prestigeUpgrades: Record<string, number>;
memorySlots: number;
memories: string[];
// Incursion
incursionStrength: number;
containmentWards: number;
// Log
log: string[];
// Loop insight (earned at end of current loop)
loopInsight: number;
}
// Action types for the store
export type GameActionType =
| { type: 'TICK' }
| { type: 'GATHER_MANA' }
| { type: 'SET_ACTION'; action: GameAction }
| { type: 'SET_SPELL'; spellId: string }
| { type: 'LEARN_SPELL'; spellId: string }
| { type: 'START_STUDYING_SKILL'; skillId: string }
| { type: 'START_STUDYING_SPELL'; spellId: string }
| { type: 'CANCEL_STUDY' }
| { type: 'CONVERT_MANA'; element: string; amount: number }
| { type: 'UNLOCK_ELEMENT'; element: string }
| { type: 'CRAFT_COMPOSITE'; target: string }
| { type: 'DO_PRESTIGE'; id: string }
| { type: 'START_NEW_LOOP' }
| { type: 'TOGGLE_PAUSE' }
| { type: 'RESET_GAME' }
| { type: 'SELECT_SKILL_UPGRADE'; skillId: string; upgradeId: string }
| { type: 'TIER_UP_SKILL'; skillId: string };
// This file now re-exports types from domain-specific files in the types/ directory.
// All type definitions have been moved to:
// - types/elements.ts - element-related types
// - types/attunements.ts - attunement-related types
// - types/spells.ts - spell-related types
// - types/skills.ts - skill-related types
// - types/equipment.ts - equipment-related types
// - types/game.ts - core game state types
//
// Import from this file (types.ts) to maintain backward compatibility,
// or import directly from the domain-specific files.
export * from './types/index';
+51
View File
@@ -0,0 +1,51 @@
// ─── Attunement Types ───────────────────────────────────────────────────────
// Attunement body slots
export type AttunementSlot = 'rightHand' | 'leftHand' | 'head' | 'back' | 'chest' | 'leftLeg' | 'rightLeg';
// Attunement definition
export interface AttunementDef {
id: string;
name: string;
desc: string;
slot: AttunementSlot;
icon: string;
color: string;
primaryManaType?: string; // Primary mana type this attunement generates (null for Invoker)
rawManaRegen: number; // Raw mana regeneration per hour granted by this attunement
conversionRate: number; // Raw mana converted to primary type per hour
unlocked: boolean; // Whether this is unlocked by default
unlockCondition?: string; // Description of how to unlock (for future challenges)
capabilities: string[]; // What this attunement enables (e.g., 'enchanting', 'pacts', 'golemCrafting')
skillCategories: string[]; // Skill categories this attunement provides access to
}
// Attunement instance state (tracks player's attunements)
export interface AttunementState {
id: string;
active: boolean; // Whether this attunement is currently active
level: number; // Attunement level (for future progression)
experience: number; // Progress toward next level
}
// Boon types that guardians can grant
export interface GuardianBoon {
type: 'maxMana' | 'manaRegen' | 'castingSpeed' | 'elementalDamage' | 'rawDamage' |
'critChance' | 'critDamage' | 'spellEfficiency' | 'manaGain' | 'insightGain' |
'studySpeed' | 'prestigeInsight';
value: number;
desc: string;
}
export interface GuardianDef {
name: string;
element: string;
hp: number;
pact: number; // Pact multiplier when signed
color: string;
boons: GuardianBoon[]; // Bonuses granted when pact is signed
pactCost: number; // Mana cost to perform pact ritual
pactTime: number; // Hours required for pact ritual
uniquePerk: string; // Description of unique perk
armor?: number; // Damage reduction (0-1, e.g., 0.2 = 20% reduction)
}
+18
View File
@@ -0,0 +1,18 @@
// ─── Element Types ───────────────────────────────────────────────────────────
export type ElementCategory = 'base' | 'utility' | 'composite' | 'exotic';
export interface ElementDef {
name: string;
sym: string;
color: string;
glow: string;
cat: ElementCategory;
recipe?: string[];
}
export interface ElementState {
current: number;
max: number;
unlocked: boolean;
}
+116
View File
@@ -0,0 +1,116 @@
// ─── Equipment Types ───────────────────────────────────────────────────────
// Legacy EquipmentDef for backward compatibility
export interface EquipmentDef {
id: string;
name: string;
slot: 'mainHand' | 'offHand' | 'head' | 'body' | 'hands' | 'accessory';
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic';
stats: Record<string, number>;
durability: number;
maxDurability: number;
element?: string;
}
// Equipment Instance (actual equipped item with enchantments)
export interface EquipmentInstance {
instanceId: string; // Unique ID for this specific item
typeId: string; // Reference to EquipmentType (e.g., 'basicStaff')
name: string; // Display name (defaults to type name)
enchantments: AppliedEnchantment[];
usedCapacity: number; // Currently used capacity
totalCapacity: number; // Base capacity + bonuses
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic';
quality: number; // 0-100, affects capacity efficiency
weaponMana?: number; // Current mana stored in weapon (for weapon enchantments)
weaponManaMax?: number; // Max mana the weapon can store
weaponManaRegen?: number; // Mana regen per hour for weapon
weaponManaType?: string; // Type of mana the weapon stores
activeWeaponEnchant?: string; // Active weapon enchantment (for magic swords)
}
export interface AppliedEnchantment {
effectId: string; // Reference to EnchantmentEffectDef
stacks: number; // Number of times this effect is applied
actualCost: number; // Actual capacity cost (after efficiency)
}
// Enchantment Design (saved design for later application)
export interface EnchantmentDesign {
id: string;
name: string;
equipmentType: string; // Which equipment type this is designed for
effects: DesignEffect[];
totalCapacityUsed: number;
designTime: number; // Hours required to design
created: number; // Timestamp
}
export interface DesignEffect {
effectId: string;
stacks: number;
capacityCost: number;
}
// Crafting Progress States
export interface DesignProgress {
designId: string;
progress: number; // Hours spent designing
required: number; // Total hours needed
// Design data stored during progress
name: string;
equipmentType: string;
effects: DesignEffect[];
}
export interface PreparationProgress {
equipmentInstanceId: string;
progress: number; // Hours spent preparing
required: number; // Total hours needed
manaCostPaid: number; // Mana cost already paid
}
export interface ApplicationProgress {
equipmentInstanceId: string;
designId: string;
progress: number; // Hours spent applying
required: number; // Total hours needed
manaPerHour: number; // Mana cost per hour
paused: boolean;
manaSpent: number; // Total mana spent so far
}
// Equipment crafting progress (from blueprints)
export interface EquipmentCraftingProgress {
blueprintId: string;
equipmentTypeId: string;
progress: number; // Hours spent crafting
required: number; // Total hours needed
manaSpent: number; // Total mana spent so far
}
// Equipment spell state (for multi-spell casting)
export interface EquipmentSpellState {
spellId: string;
sourceEquipment: string; // Equipment instance ID
castProgress: number; // 0-1 progress toward next cast
}
export interface BlueprintDef {
id: string;
name: string;
tier: number;
slot: string;
stats: Record<string, number>;
studyTime: number;
craftTime: number;
craftCost: number;
discovered: boolean;
learned: boolean;
}
// Loot inventory for materials and blueprints
export interface LootInventory {
materials: Record<string, number>; // materialId -> count
blueprints: string[]; // blueprint IDs discovered
}
+224
View File
@@ -0,0 +1,224 @@
// ─── Core Game State Types ───────────────────────────────────────────────
import type { AttunementState } from './attunements';
import type { ElementState } from './elements';
import type { SpellState } from './spells';
import type { EquipmentInstance, EnchantmentDesign, DesignProgress, PreparationProgress, ApplicationProgress, EquipmentCraftingProgress, EquipmentDef, BlueprintDef, LootInventory, EquipmentSpellState } from './equipment';
// ─── Room and Enemy Types ─────────────────────────────────────────────────────
export type RoomType = 'combat' | 'puzzle' | 'swarm' | 'speed' | 'guardian';
export interface EnemyState {
id: string;
hp: number;
maxHP: number;
armor: number; // Damage reduction (0-1)
dodgeChance: number; // For speed rooms (0-1)
element: string;
}
export interface FloorState {
roomType: RoomType;
enemies: EnemyState[]; // For swarm rooms, multiple enemies
puzzleProgress?: number; // For puzzle rooms (0-1)
puzzleRequired?: number; // Total progress needed
puzzleId?: string; // Which puzzle type
puzzleAttunements?: string[]; // Which attunements speed up this puzzle
}
// ─── Achievement Types ─────────────────────────────────────────────────────
export interface AchievementDef {
id: string;
name: string;
desc: string;
category: string;
requirement: {
type: string;
value: number;
subType?: string;
};
reward: {
insight?: number;
manaBonus?: number;
damageBonus?: number;
regenBonus?: number;
title?: string;
unlockEffect?: string;
};
hidden?: boolean;
}
// Achievement state tracks unlocked achievements and progress
export interface AchievementState {
unlocked: string[]; // IDs of unlocked achievements
progress: Record<string, number>; // Progress toward achievement requirements
}
// ─── Game Actions and Scheduling ─────────────────────────────────────────
export type GameAction = 'meditate' | 'climb' | 'study' | 'craft' | 'repair' | 'convert' | 'design' | 'prepare' | 'enchant';
export interface ScheduleBlock {
id: string;
action: GameAction;
startHour: number;
endHour: number;
enabled: boolean;
target?: string; // spell id, blueprint id, skill id, element id
}
export interface StudyTarget {
type: 'skill' | 'spell' | 'blueprint';
id: string;
progress: number; // Hours studied
required: number; // Total hours needed
}
// ─── Golemancy Types ─────────────────────────────────────────────────────────
export interface SummonedGolem {
golemId: string; // Reference to GOLEMS_DEF
summonedFloor: number; // Floor when golem was summoned
attackProgress: number; // Progress toward next attack (0-1)
}
export interface GolemancyState {
enabledGolems: string[]; // Golem IDs the player wants active
summonedGolems: SummonedGolem[]; // Currently summoned golems on this floor
lastSummonFloor: number; // Floor golems were last summoned on
}
// ─── Main Game State ─────────────────────────────────────────────────────
export interface GameState {
// Time
day: number;
hour: number;
loopCount: number;
gameOver: boolean;
victory: boolean;
paused: boolean;
// Raw Mana
rawMana: number;
meditateTicks: number;
totalManaGathered: number;
// Attunements (class-like system)
attunements: Record<string, AttunementState>; // attunement id -> state
// Elements
elements: Record<string, ElementState>;
// Spire
currentFloor: number;
floorHP: number;
floorMaxHP: number;
maxFloorReached: number;
signedPacts: number[];
activeSpell: string;
currentAction: GameAction;
castProgress: number; // Progress towards next spell cast (0-1)
// Room system for special floors
currentRoom: FloorState; // Current room state (swarm, puzzle, speed, etc.)
// Spells
spells: Record<string, SpellState>;
// Skills
skills: Record<string, number>;
skillProgress: Record<string, number>; // Saved study progress for skills
skillUpgrades: Record<string, string[]>; // Selected upgrade IDs per skill
skillTiers: Record<string, number>; // Current tier for each base skill
// Equipment System (new instance-based system)
equippedInstances: Record<string, string | null>; // slot -> instanceId
equipmentInstances: Record<string, EquipmentInstance>; // instanceId -> instance
enchantmentDesigns: EnchantmentDesign[]; // Saved enchantment designs
// Crafting Progress
designProgress: DesignProgress | null;
preparationProgress: PreparationProgress | null;
applicationProgress: ApplicationProgress | null;
equipmentCraftingProgress: EquipmentCraftingProgress | null;
// Unlocked enchantment effects for designing
unlockedEffects: string[]; // Effect IDs that have been researched
// Equipment spell states for multi-casting
equipmentSpellStates: EquipmentSpellState[];
// Legacy Equipment (for backward compatibility)
equipment: Record<string, EquipmentDef | null>;
inventory: EquipmentDef[];
// Blueprints
blueprints: Record<string, BlueprintDef>;
// Loot Inventory
lootInventory: LootInventory;
// Schedule
schedule: ScheduleBlock[];
autoSchedule: boolean;
studyQueue: string[];
craftQueue: string[];
// Current Study Target
currentStudyTarget: StudyTarget | null;
// Parallel Study Target (for Parallel Mind milestone upgrade)
parallelStudyTarget: StudyTarget | null;
// Golemancy (summoned golems)
golemancy: GolemancyState;
// Achievements
achievements: AchievementState;
// Stats tracking
totalSpellsCast: number;
totalDamageDealt: number;
totalCraftsCompleted: number;
// Prestige
insight: number;
totalInsight: number;
prestigeUpgrades: Record<string, number>;
memorySlots: number;
memories: string[];
// Incursion
incursionStrength: number;
containmentWards: number;
// Log
log: string[];
// Loop insight (earned at end of current loop)
loopInsight: number;
}
// ─── Action Types for Store ─────────────────────────────────────────────
export type GameActionType =
| { type: 'TICK' }
| { type: 'GATHER_MANA' }
| { type: 'SET_ACTION'; action: GameAction }
| { type: 'SET_SPELL'; spellId: string }
| { type: 'LEARN_SPELL'; spellId: string }
| { type: 'START_STUDYING_SKILL'; skillId: string }
| { type: 'START_STUDYING_SPELL'; spellId: string }
| { type: 'CANCEL_STUDY' }
| { type: 'CONVERT_MANA'; element: string; amount: number }
| { type: 'UNLOCK_ELEMENT'; element: string }
| { type: 'CRAFT_COMPOSITE'; target: string }
| { type: 'DO_PRESTIGE'; id: string }
| { type: 'START_NEW_LOOP' }
| { type: 'TOGGLE_PAUSE' }
| { type: 'RESET_GAME' }
| { type: 'SELECT_SKILL_UPGRADE'; skillId: string; upgradeId: string }
| { type: 'TIER_UP_SKILL'; skillId: string };
+56
View File
@@ -0,0 +1,56 @@
// ─── Game Types Index ──────────────────────────────────────────────────────
// Re-export all types from domain-specific files
// Element types
export type { ElementCategory, ElementDef, ElementState } from './elements';
// Attunement types
export type { AttunementSlot, AttunementDef, AttunementState, GuardianBoon, GuardianDef } from './attunements';
// Spell types
export type { SpellCost, SpellDef, SpellEffect, SpellState } from './spells';
// Skill types
export type {
SkillDef,
SkillUpgradeDef,
SkillUpgradeEffect,
SkillEvolutionPath,
SkillTierDef,
SkillPerkChoice,
SkillUpgradeChoice,
PrestigeDef
} from './skills';
// Equipment types
export type {
EquipmentDef,
EquipmentInstance,
AppliedEnchantment,
EnchantmentDesign,
DesignEffect,
DesignProgress,
PreparationProgress,
ApplicationProgress,
EquipmentCraftingProgress,
EquipmentSpellState,
BlueprintDef,
LootInventory
} from './equipment';
// Game state types
export type {
RoomType,
EnemyState,
FloorState,
AchievementDef,
AchievementState,
GameAction,
ScheduleBlock,
StudyTarget,
SummonedGolem,
GolemancyState,
GameState,
GameActionType
} from './game';
+85
View File
@@ -0,0 +1,85 @@
// ─── Skill Types ───────────────────────────────────────────────────────────
export interface SkillDef {
name: string;
desc: string;
cat: string;
attunement?: string; // Which attunement this skill belongs to (null = core)
max: number;
base: number; // Mana cost to start studying
req?: Record<string, number>; // Skill prerequisites
attunementReq?: Record<string, number>; // Attunement level requirements (attunement id -> min level)
studyTime: number; // Hours needed to study
level?: number; // Current level (optional, for UI display)
tier?: number; // Skill tier (1-5)
tierUp?: string; // Skill ID this evolves into at max level
baseSkill?: string; // Original skill ID this evolved from
tierMultiplier?: number; // Multiplier for each tier (default 2)
}
// Skill upgrade choices at milestones (level 5 and level 10)
export interface SkillUpgradeDef {
id: string;
name: string;
desc: string;
skillId: string; // Which skill this upgrade belongs to
milestone: 5 | 10; // Level at which this upgrade is available
effect: SkillUpgradeEffect;
}
export interface SkillUpgradeEffect {
type: 'multiplier' | 'bonus' | 'special';
stat?: string; // Stat to modify
value?: number; // Multiplier or bonus value
specialId?: string; // Special effect identifier
specialDesc?: string; // Description of special effect
}
// Skill evolution system - 5-Tier Continuous Talent Tree
// Each skill with max level 10 follows this structure:
// - 5 Tiers (T1-T5)
// - Each tier has L5 and L10 milestone perk choices
// - 3 paths per tier (A, B, C columns) representing different playstyles
// - T3 L10 and T5 L10 have Elite Perks (game-changing mechanics)
export interface SkillEvolutionPath {
baseSkillId: string; // Starting skill ID
tiers: SkillTierDef[]; // 5 tiers of evolution
}
export interface SkillTierDef {
tier: number; // Tier number (1-5)
skillId: string; // Skill ID for this tier
name: string;
multiplier: number; // Base effect multiplier for this tier
// Perk choices organized by milestone and path (A, B, C)
l5Perks: SkillPerkChoice[]; // 3 choices (one per path) at level 5
l10Perks: SkillPerkChoice[]; // 3 choices (one per path) at level 10
}
// Perk choice at a milestone - belongs to a specific path (A, B, or C)
export interface SkillPerkChoice {
id: string;
name: string;
desc: string;
path: 'A' | 'B' | 'C'; // Which path this perk belongs to
isElite?: boolean; // True for T3 L10 and T5 L10 perks
effect: SkillUpgradeEffect;
// For path compounding - if player stays on same path, bonuses compound
pathCompoundBonus?: number; // Exponential bonus for staying on same path
}
export interface SkillUpgradeChoice {
id: string;
name: string;
desc: string;
milestone: 5 | 10; // Level at which this upgrade is available
effect: SkillUpgradeEffect;
}
export interface PrestigeDef {
name: string;
desc: string;
max: number;
cost: number;
}
+38
View File
@@ -0,0 +1,38 @@
// ─── Spell Types ────────────────────────────────────────────────────────────
// Spell cost can be raw mana or elemental mana
export interface SpellCost {
type: 'raw' | 'element'; // 'raw' for raw mana, 'element' for specific elemental mana
element?: string; // Required if type is 'element'
amount: number; // Amount of mana required
}
export interface SpellDef {
name: string;
elem: string; // Element type for damage calculations
dmg: number;
cost: SpellCost; // Changed from number to SpellCost object
tier: number;
unlock: number; // Mana cost to start studying
studyTime?: number; // Hours needed to study (optional, defaults based on tier)
castSpeed?: number; // Casts per hour (default 1, higher = faster)
desc?: string; // Optional spell description
effects?: SpellEffect[]; // Optional special effects
isAoe?: boolean; // AOE spell that hits multiple enemies
aoeTargets?: number; // Number of enemies hit by AOE
isWeaponEnchant?: boolean; // Can be used as weapon enchantment (magic swords)
}
export interface SpellEffect {
type: 'burn' | 'freeze' | 'stun' | 'pierce' | 'multicast' | 'shield' | 'buff' | 'chain' | 'aoe' | 'armor_pierce';
value: number; // Effect potency
duration?: number; // Duration in hours for timed effects
targets?: number; // For AOE: number of targets
chance?: number; // For chance-based effects (e.g., stun chance)
}
export interface SpellState {
learned: boolean;
level: number;
studyProgress?: number; // Hours studied so far (for in-progress spells)
}