Phase 4: Study effects (remaining 6)

This commit is contained in:
Refactoring Agent
2026-04-24 18:32:15 +02:00
parent c8cabf3e4b
commit 0f0b800e60
4 changed files with 82 additions and 17 deletions
+32 -9
View File
@@ -302,9 +302,10 @@ export function computeMaxMana(
effects?: ComputedEffects | UnifiedEffects
): number {
const pu = state.prestigeUpgrades;
const skillMult = (effects as any)?.skillLevelMultiplier || 1;
const base =
100 +
(state.skills.manaWell || 0) * 100 +
(state.skills.manaWell || 0) * 100 * skillMult +
(pu.manaWell || 0) * 500;
// If effects not provided, compute unified effects (includes equipment)
@@ -350,10 +351,11 @@ export function computeRegen(
): number {
const pu = state.prestigeUpgrades;
const temporalBonus = 1 + (pu.temporalEcho || 0) * 0.1;
const skillMult = (effects as any)?.skillLevelMultiplier || 1;
const base =
2 +
(state.skills.manaFlow || 0) * 1 +
(state.skills.manaSpring || 0) * 2 +
(state.skills.manaFlow || 0) * 1 * skillMult +
(state.skills.manaSpring || 0) * 2 * skillMult +
(pu.manaFlow || 0) * 0.5;
let regen = base * temporalBonus;
@@ -399,10 +401,11 @@ export function computeClickMana(
state: Pick<GameState, 'skills' | 'skillUpgrades' | 'skillTiers' | 'equipmentInstances' | 'equippedInstances'>,
effects?: ComputedEffects | UnifiedEffects
): number {
const skillMult = (effects as any)?.skillLevelMultiplier || 1;
const base =
1 +
(state.skills.manaTap || 0) * 1 +
(state.skills.manaSurge || 0) * 3;
(state.skills.manaTap || 0) * 1 * skillMult +
(state.skills.manaSurge || 0) * 3 * skillMult;
// If effects not provided, compute unified effects (includes equipment)
if (!effects && state.equipmentInstances && state.equippedInstances) {
@@ -437,16 +440,18 @@ function getElementalBonus(spellElem: string, floorElem: string): number {
export function calcDamage(
state: Pick<GameState, 'skills' | 'signedPacts'>,
spellId: string,
floorElem?: string
floorElem?: string,
effects?: ComputedEffects | UnifiedEffects
): number {
const sp = SPELLS_DEF[spellId];
if (!sp) return 5;
const skills = state.skills;
const baseDmg = sp.dmg + (skills.combatTrain || 0) * 5;
const pct = 1 + (skills.arcaneFury || 0) * 0.1;
const skillMult = (effects as any)?.skillLevelMultiplier || 1;
const baseDmg = sp.dmg + (skills.combatTrain || 0) * 5 * skillMult;
const pct = 1 + (skills.arcaneFury || 0) * 0.1 * skillMult;
// Elemental mastery bonus
const elemMasteryBonus = 1 + (skills.elementalMastery || 0) * 0.15;
const elemMasteryBonus = 1 + (skills.elementalMastery || 0) * 0.15 * skillMult;
// Guardian bane bonus
const guardianBonus = floorElem && GUARDIANS[Object.values(GUARDIANS).find(g => g.element === floorElem)?.hp ? 0 : 0]
@@ -954,6 +959,17 @@ export const useGameStore = create<GameStore>()(
// Calculate base study speed
let studySpeedMult = getStudySpeedMultiplier(skills);
// STUDY_RUSH: First hour of study is 2x speed
if (hasSpecial(effects, SPECIAL_EFFECTS.STUDY_RUSH) && consecutiveStudyHours === 0) {
studySpeedMult *= 2;
log = [`⚡ Study Rush activated! Double speed for the first hour!`, ...log.slice(0, 49)];
}
// MENTAL_CLARITY: +10% study speed when mana > 75%
if (hasSpecial(effects, SPECIAL_EFFECTS.MENTAL_CLARITY) && state.rawMana > maxMana * 0.75) {
studySpeedMult *= 1.10;
}
// DEEP_CONCENTRATION: +20% study speed when mana > 90%
if (hasSpecial(effects, SPECIAL_EFFECTS.DEEP_CONCENTRATION) && state.rawMana > maxMana * 0.9) {
studySpeedMult *= 1.20;
@@ -1009,6 +1025,13 @@ export const useGameStore = create<GameStore>()(
skillProgress = { ...skillProgress, [skillId]: 0 };
log = [`${SKILLS_DEF[skillId]?.name} Lv.${newLevel} mastered!`, ...log.slice(0, 49)];
// STUDY_REFUND: 25% mana back on study complete
if (hasSpecial(effects, SPECIAL_EFFECTS.STUDY_REFUND)) {
const refundAmount = Math.floor(currentStudyTarget.totalCost * 0.25);
rawMana += refundAmount;
log = [`💰 Study Refund: ${refundAmount} mana returned!`, ...log.slice(0, 49)];
}
// Check if this skill unlocks effects (research skills)
const effectsToUnlock = EFFECT_RESEARCH_MAPPING[skillId];
if (effectsToUnlock && newLevel >= (SKILLS_DEF[skillId]?.max || 1)) {