From 229cb16c5da3ad13a29a74b0d285f625d5eed582 Mon Sep 17 00:00:00 2001
From: Refactoring Agent <[email protected]>
Date: Sun, 26 Apr 2026 10:56:39 +0200
Subject: [PATCH] Task 2: Research Locking - prevent switching topics while
study in progress
---
src/components/game/SkillsTab.tsx | 34 ++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/src/components/game/SkillsTab.tsx b/src/components/game/SkillsTab.tsx
index 7b8e065..6c49c19 100755
--- a/src/components/game/SkillsTab.tsx
+++ b/src/components/game/SkillsTab.tsx
@@ -267,7 +267,10 @@ export function SkillsTab() {
const baseCost = def.base * (level + 1) * currentTier;
const cost = Math.floor(baseCost * studyCostMult);
- const canStudy = !maxed && prereqMet && store.rawMana >= cost && !isStudying;
+ // Check if any study is in progress (prevent switching topics)
+ const isAnyStudyInProgress = store.currentAction === 'study' && store.currentStudyTarget;
+ // Can only study if: not maxed, prereqs met, has mana, and either no study in progress or already studying this skill
+ const canStudy = !maxed && prereqMet && store.rawMana >= cost && (!isAnyStudyInProgress || isStudying);
const milestoneInfo = hasMilestoneUpgrade(tieredSkillId, level);
const nextTierSkill = getNextTierSkill(tieredSkillId);
@@ -369,15 +372,26 @@ export function SkillsTab() {
Cannot switch topics while studying {SKILLS_DEF[store.currentStudyTarget?.id || '']?.name || 'another skill'}
+