diff --git a/src/lib/game/store.ts b/src/lib/game/store.ts index ce8872e..3e717b4 100755 --- a/src/lib/game/store.ts +++ b/src/lib/game/store.ts @@ -724,6 +724,9 @@ function makeInitial(overrides: Partial = {}): GameState { craftQueue: [], currentStudyTarget: null, + + // Study momentum tracking (for STUDY_MOMENTUM effect) + consecutiveStudyHours: 0, insight: overrides.insight || 0, totalInsight: overrides.totalInsight || 0, @@ -945,15 +948,57 @@ export const useGameStore = create()( let spells = state.spells; let log = state.log; let unlockedEffects = state.unlockedEffects; + let consecutiveStudyHours = state.consecutiveStudyHours; if (state.currentAction === 'study' && currentStudyTarget) { - const studySpeedMult = getStudySpeedMultiplier(skills); - const progressGain = HOURS_PER_TICK * studySpeedMult; + // Calculate base study speed + let studySpeedMult = getStudySpeedMultiplier(skills); + + // DEEP_CONCENTRATION: +20% study speed when mana > 90% + if (hasSpecial(effects, SPECIAL_EFFECTS.DEEP_CONCENTRATION) && state.rawMana > maxMana * 0.9) { + studySpeedMult *= 1.20; + } + + // STUDY_MOMENTUM: +5% study speed per consecutive hour + if (hasSpecial(effects, SPECIAL_EFFECTS.STUDY_MOMENTUM)) { + studySpeedMult *= (1 + consecutiveStudyHours * 0.05); + } + + // QUICK_MASTERY: -20% study time for final 3 levels + if (hasSpecial(effects, SPECIAL_EFFECTS.QUICK_MASTERY) && currentStudyTarget.type === 'skill') { + const currentLevel = skills[currentStudyTarget.id] || 0; + const maxLevel = SKILLS_DEF[currentStudyTarget.id]?.max || 1; + if (currentLevel >= maxLevel - 3) { + // Reduce required time by 20% (multiply speed by 1.25) + studySpeedMult *= 1.25; + } + } + + // Calculate progress gain + let progressGain = HOURS_PER_TICK * studySpeedMult; + + // QUICK_GRASP: 5% chance double study progress per hour + if (hasSpecial(effects, SPECIAL_EFFECTS.QUICK_GRASP) && Math.random() < 0.05) { + progressGain *= 2; + log = [`⚡ Quick Grasp activated! Double progress!`, ...log.slice(0, 49)]; + } + currentStudyTarget = { ...currentStudyTarget, progress: currentStudyTarget.progress + progressGain, }; + // KNOWLEDGE_ECHO: 10% chance instant study + if (hasSpecial(effects, SPECIAL_EFFECTS.KNOWLEDGE_ECHO) && Math.random() < 0.10) { + currentStudyTarget = { + ...currentStudyTarget, + progress: currentStudyTarget.required, + }; + log = [`✨ Knowledge Echo! Study instantaneously completed!`, ...log.slice(0, 49)]; + } + + // Increment consecutive study hours for STUDY_MOMENTUM + consecutiveStudyHours++; // Check if study is complete if (currentStudyTarget.progress >= currentStudyTarget.required) { if (currentStudyTarget.type === 'skill') { @@ -990,6 +1035,27 @@ export const useGameStore = create()( log = [`📖 ${SPELLS_DEF[spellId]?.name} learned!`, ...log.slice(0, 49)]; } currentStudyTarget = null; + } + } + // Parallel Study processing (PARALLEL_STUDY special effect) + let parallelStudyTarget = state.parallelStudyTarget; + if (parallelStudyTarget && state.currentAction === 'study') { + // Parallel study progresses at 50% speed + const parallelProgressGain = HOURS_PER_TICK * 0.5; + parallelStudyTarget = { + ...parallelStudyTarget, + progress: parallelStudyTarget.progress + parallelProgressGain, + }; + + // Check if parallel study is complete + if (parallelStudyTarget.progress >= parallelStudyTarget.required) { + const skillId = parallelStudyTarget.id; + const currentLevel = skills[skillId] || 0; + const newLevel = currentLevel + 1; + skills = { ...skills, [skillId]: newLevel }; + skillProgress = { ...skillProgress, [skillId]: 0 }; + log = [`✅ ${SKILLS_DEF[skillId]?.name} Lv.${newLevel} mastered (parallel study)!`, ...log.slice(0, 49)]; + parallelStudyTarget = null; } } @@ -1469,6 +1535,7 @@ export const useGameStore = create()( currentRoom, incursionStrength, currentStudyTarget, + parallelStudyTarget, skills, skillProgress, spells, @@ -1480,6 +1547,7 @@ export const useGameStore = create()( flowSurgeEndTime, comboHitCount, floorHitCount, + consecutiveStudyHours, ...craftingUpdates, }); }, diff --git a/src/lib/game/types/game.ts b/src/lib/game/types/game.ts index 0fcda1a..337dfbf 100644 --- a/src/lib/game/types/game.ts +++ b/src/lib/game/types/game.ts @@ -173,6 +173,9 @@ export interface GameState { // Parallel Study Target (for Parallel Mind milestone upgrade) parallelStudyTarget: StudyTarget | null; + + // Study Momentum tracking (for STUDY_MOMENTUM special effect) + consecutiveStudyHours: number; // Tracks consecutive hours of studying // Golemancy (summoned golems) golemancy: GolemancyState;