refactor: resolve structural inconsistencies and dead code
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 55s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 55s
- Fix broken barrel exports in components/game/index.ts - Remove skill system from stores (gameStore, gameActions, gameLoopActions, gameHooks, craftingStore, combat) - Remove skill system from components (page.tsx, LeftPanel, StatsTab, SpellsTab, EnchantmentDesigner, EnchantmentPreparer, GameContext/Provider) - Delete dead code: stats/ directory, attunements/ directory, layout/ Header+TabBar, shared/ StudyProgress+UpgradeDialog duplicates, effects.ts.fix, study-slice.ts, navigation-slice.ts - Delete legacy store/ and store-modules/ directories, redirect remaining callers - Merge root formatting.ts into utils/formatting.ts - Move effects files (dynamic-compute, upgrade-effects, special-effects, upgrade-effects.types) into effects/ directory - Move debug-context.tsx into components/game/debug/ - Create tabs/index.ts barrel for tab components - Fix page.tsx lazy imports to use tabs barrel - Fix all broken import paths across codebase - Remove SKILLS_DEF and skill-evolution references - Trim store.ts to under 400 lines by removing dead skill actions
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
// ─── Dynamic Computations ──────────────────────────────────────────────────
|
||||
// Dynamic computation functions that depend on special effects
|
||||
|
||||
import type { ComputedEffects } from './upgrade-effects.types';
|
||||
import { SPECIAL_EFFECTS, hasSpecial } from './special-effects';
|
||||
|
||||
/**
|
||||
* Compute regen with special effects that depend on dynamic values
|
||||
*/
|
||||
export function computeDynamicRegen(
|
||||
effects: ComputedEffects,
|
||||
baseRegen: number,
|
||||
maxMana: number,
|
||||
currentMana: number,
|
||||
incursionStrength: number
|
||||
): number {
|
||||
let regen = baseRegen;
|
||||
|
||||
// Mana Cascade: +0.1 regen per 100 max mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_CASCADE)) {
|
||||
regen += Math.floor(maxMana / 100) * 0.1;
|
||||
}
|
||||
|
||||
// Mana Waterfall: +0.25 regen per 100 max mana (upgraded cascade)
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_WATERFALL)) {
|
||||
regen += Math.floor(maxMana / 100) * 0.25;
|
||||
}
|
||||
|
||||
// Mana Torrent: +50% regen when above 75% mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_TORRENT) && currentMana > maxMana * 0.75) {
|
||||
regen *= 1.5;
|
||||
}
|
||||
|
||||
// Desperate Wells / Despair Wells: +50% regen when below 25% mana
|
||||
if ((hasSpecial(effects, SPECIAL_EFFECTS.DESPERATE_WELLS) || hasSpecial(effects, SPECIAL_EFFECTS.DESPAIR_WELLS)) && currentMana < maxMana * 0.25) {
|
||||
regen *= 1.5;
|
||||
}
|
||||
|
||||
// Panic Reserve: +100% regen when below 10% mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.PANIC_RESERVE) && currentMana < maxMana * 0.1) {
|
||||
regen *= 2.0;
|
||||
}
|
||||
|
||||
// Deep Reserve: +0.5 regen per 100 max mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.DEEP_RESERVE)) {
|
||||
regen += Math.floor(maxMana / 100) * 0.5;
|
||||
}
|
||||
|
||||
// Mana Core: 0.5% of max mana added as regen
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_CORE)) {
|
||||
regen += maxMana * 0.005;
|
||||
}
|
||||
|
||||
// Mana Tide: Regen pulses ±50% (sinusoidal based on time)
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_TIDE)) {
|
||||
const pulseFactor = 0.5 + 0.5 * Math.sin(Date.now() / 10000);
|
||||
regen *= (0.5 + pulseFactor * 0.5);
|
||||
}
|
||||
|
||||
// Eternal Flow: Regen immune to ALL penalties
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.ETERNAL_FLOW)) {
|
||||
return regen * effects.regenMultiplier;
|
||||
}
|
||||
|
||||
// Steady Stream: Regen immune to incursion
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.STEADY_STREAM)) {
|
||||
return regen * effects.regenMultiplier;
|
||||
}
|
||||
|
||||
// Apply incursion penalty
|
||||
regen *= (1 - incursionStrength);
|
||||
|
||||
return regen * effects.regenMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute click mana with special effects
|
||||
*/
|
||||
export function computeDynamicClickMana(
|
||||
effects: ComputedEffects,
|
||||
baseClickMana: number
|
||||
): number {
|
||||
let clickMana = baseClickMana;
|
||||
|
||||
// Mana Echo: 10% chance to gain double mana from clicks
|
||||
// Note: The chance is handled in the click handler, this just returns the base
|
||||
// The click handler should check hasSpecial and apply the 10% chance
|
||||
|
||||
// Mana Genesis: Generate 1% of max mana per hour passively
|
||||
// This is handled in the game loop (store.ts), not here
|
||||
|
||||
// Mana Heart: +10% max mana per loop (permanent)
|
||||
// This is applied during loop reset in store.ts
|
||||
|
||||
return Math.floor((clickMana + effects.clickManaBonus) * effects.clickManaMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute damage with special effects
|
||||
*/
|
||||
export function computeDynamicDamage(
|
||||
effects: ComputedEffects,
|
||||
baseDamage: number,
|
||||
floorHPPct: number,
|
||||
currentMana: number,
|
||||
maxMana: number
|
||||
): number {
|
||||
let damage = baseDamage * effects.baseDamageMultiplier;
|
||||
|
||||
// Overpower: +50% damage when mana above 80%
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.OVERPOWER) && currentMana >= maxMana * 0.8) {
|
||||
damage *= 1.5;
|
||||
}
|
||||
|
||||
// Berserker: +50% damage when below 50% mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.BERSERKER) && currentMana < maxMana * 0.5) {
|
||||
damage *= 1.5;
|
||||
}
|
||||
|
||||
// Combo Master: Every 5th attack deals 3x damage
|
||||
// Note: The hit counter is tracked in game state, this just returns the multiplier
|
||||
// The combat handler should check hasSpecial and the hit count
|
||||
|
||||
return damage + effects.baseDamageBonus;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// ─── Special Effect IDs ────────────────────────────────────────────────────────
|
||||
// These are the IDs used in the 'specialId' field of special effects
|
||||
|
||||
import type { ComputedEffects } from './upgrade-effects.types';
|
||||
|
||||
export const SPECIAL_EFFECTS = {
|
||||
// Mana Flow special effects
|
||||
MANA_CASCADE: 'manaCascade',
|
||||
STEADY_STREAM: 'steadyStream',
|
||||
MANA_TORRENT: 'manaTorrent',
|
||||
FLOW_SURGE: 'flowSurge',
|
||||
MANA_OVERFLOW: 'manaOverflow',
|
||||
MANA_WATERFALL: 'manaWaterfall',
|
||||
ETERNAL_FLOW: 'eternalFlow',
|
||||
|
||||
// Mana Well special effects
|
||||
DESPAIR_WELLS: 'despairWells',
|
||||
DESPERATE_WELLS: 'desperateWells',
|
||||
MANA_ECHO: 'manaEcho',
|
||||
EMERGENCY_RESERVE: 'emergencyReserve',
|
||||
MANA_THRESHOLD: 'manaThreshold',
|
||||
MANA_CONVERSION: 'manaConversion',
|
||||
PANIC_RESERVE: 'panicReserve',
|
||||
MANA_CONDENSE: 'manaCondense',
|
||||
DEEP_RESERVE: 'deepReserve',
|
||||
MANA_TIDE: 'manaTide',
|
||||
VOID_STORAGE: 'voidStorage',
|
||||
MANA_CORE: 'manaCore',
|
||||
MANA_HEART: 'manaHeart',
|
||||
MANA_GENESIS: 'manaGenesis',
|
||||
|
||||
// Mana Overflow special effects
|
||||
CLICK_SURGE: 'clickSurge',
|
||||
MANA_FLOOD: 'manaFlood',
|
||||
|
||||
// Combat special effects
|
||||
FIRST_STRIKE: 'firstStrike',
|
||||
OVERPOWER: 'overpower',
|
||||
BERSERKER: 'berserker',
|
||||
EXECUTIONER: 'executioner',
|
||||
COMBO_MASTER: 'comboMaster',
|
||||
ADRENALINE_RUSH: 'adrenalineRush',
|
||||
|
||||
// Study special effects
|
||||
QUICK_GRASP: 'quickGrasp',
|
||||
DEEP_CONCENTRATION: 'deepConcentration',
|
||||
QUICK_MASTERY: 'quickMastery',
|
||||
PARALLEL_STUDY: 'parallelStudy',
|
||||
STUDY_MOMENTUM: 'studyMomentum',
|
||||
KNOWLEDGE_ECHO: 'knowledgeEcho',
|
||||
KNOWLEDGE_TRANSFER: 'knowledgeTransfer',
|
||||
MENTAL_CLARITY: 'mentalClarity',
|
||||
STUDY_REFUND: 'studyRefund',
|
||||
DEEP_UNDERSTANDING: 'deepUnderstanding',
|
||||
STUDY_RUSH: 'studyRush',
|
||||
CHAIN_STUDY: 'chainStudy',
|
||||
|
||||
// Element special effects
|
||||
ELEMENTAL_AFFINITY: 'elementalAffinity',
|
||||
EXOTIC_MASTERY: 'exoticMastery',
|
||||
ELEMENTAL_RESONANCE: 'elementalResonance',
|
||||
MANA_CONDUIT: 'manaConduit',
|
||||
|
||||
// Enchanting special effects
|
||||
ENCHANT_MASTERY: 'enchantMastery',
|
||||
ENCHANT_PRESERVATION: 'enchantPreservation',
|
||||
THRIFTY_ENCHANTER: 'thriftyEnchanter',
|
||||
OPTIMIZED_ENCHANTING: 'optimizedEnchanting',
|
||||
HASTY_ENCHANTER: 'hastyEnchanter',
|
||||
INSTANT_DESIGNS: 'instantDesigns',
|
||||
PURE_ESSENCE: 'pureEssence',
|
||||
|
||||
// Crafting special effects
|
||||
BATCH_CRAFTING: 'batchCrafting',
|
||||
MASS_PRODUCTION: 'massProduction',
|
||||
SCAVENGE: 'scavenge',
|
||||
RECLAIM: 'reclaim',
|
||||
|
||||
// Golemancy special effects
|
||||
GOLEM_FURY: 'golemFury',
|
||||
GOLEM_RESONANCE: 'golemResonance',
|
||||
RAPID_STRIKES: 'rapidStrikes',
|
||||
BLITZ_ATTACK: 'blitzAttack',
|
||||
|
||||
// Ascension special effects
|
||||
INSIGHT_BOUNTY: 'insightBounty',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Check if a special effect is active
|
||||
*/
|
||||
export function hasSpecial(effects: ComputedEffects, specialId: string): boolean {
|
||||
return effects?.specials?.has(specialId) ?? false;
|
||||
}
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
// ─── Upgrade Effect System ────────────────────────────────────────────────────────
|
||||
// This module handles applying skill upgrade effects to game stats
|
||||
// Note: Skill evolution paths have been removed. Upgrade effects now return
|
||||
// base/default values with no skill-dependent modifications.
|
||||
|
||||
import type { ActiveUpgradeEffect, ComputedEffects } from './upgrade-effects.types';
|
||||
|
||||
// ─── Upgrade Definition Cache ───────────────────────────
|
||||
|
||||
// No-op: skill evolution paths have been removed
|
||||
function buildUpgradeCache(): void {
|
||||
// No-op: no upgrade definitions to cache
|
||||
}
|
||||
|
||||
// ─── Helper Functions ──────────────────────────────
|
||||
|
||||
/**
|
||||
* Get all selected upgrades with their full effect definitions.
|
||||
* Since skills are removed, always returns empty array.
|
||||
*/
|
||||
export function getActiveUpgrades(
|
||||
_skillUpgrades: Record<string, string[]>,
|
||||
_skillTiers: Record<string, number>
|
||||
): ActiveUpgradeEffect[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute all active effects from selected upgrades.
|
||||
* Since skills are removed, returns base values with no upgrades applied.
|
||||
*/
|
||||
export function computeEffects(
|
||||
_skillUpgrades: Record<string, string[]>,
|
||||
_skillTiers: Record<string, number>
|
||||
): ComputedEffects {
|
||||
return {
|
||||
maxManaMultiplier: 1,
|
||||
maxManaBonus: 0,
|
||||
regenMultiplier: 1,
|
||||
regenBonus: 0,
|
||||
clickManaMultiplier: 1,
|
||||
clickManaBonus: 0,
|
||||
meditationEfficiency: 1,
|
||||
spellCostMultiplier: 1,
|
||||
conversionEfficiency: 1,
|
||||
baseDamageMultiplier: 1,
|
||||
baseDamageBonus: 0,
|
||||
attackSpeedMultiplier: 1,
|
||||
critChanceBonus: 0,
|
||||
critDamageMultiplier: 1.5,
|
||||
elementalDamageMultiplier: 1,
|
||||
studySpeedMultiplier: 1,
|
||||
studyCostMultiplier: 1,
|
||||
progressRetention: 0,
|
||||
instantStudyChance: 0,
|
||||
freeStudyChance: 0,
|
||||
elementCapMultiplier: 1,
|
||||
elementCapBonus: 0,
|
||||
perElementCapBonus: {},
|
||||
conversionCostMultiplier: 1,
|
||||
doubleCraftChance: 0,
|
||||
permanentRegenBonus: 0,
|
||||
specials: new Set<string>(),
|
||||
activeUpgrades: [],
|
||||
skillLevelMultiplier: 1,
|
||||
enchantmentPowerMultiplier: 1,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// ─── Upgrade Effect Types ────────────────────────────────────────────────────
|
||||
// Type interfaces for upgrade effects
|
||||
|
||||
import type { SkillUpgradeChoice, SkillUpgradeEffect } from './types';
|
||||
|
||||
export interface ActiveUpgradeEffect {
|
||||
upgradeId: string;
|
||||
skillId: string;
|
||||
milestone: 5 | 10;
|
||||
effect: SkillUpgradeEffect;
|
||||
name: string;
|
||||
desc: string;
|
||||
}
|
||||
|
||||
export interface ComputedEffects {
|
||||
// Mana effects
|
||||
maxManaMultiplier: number;
|
||||
maxManaBonus: number;
|
||||
regenMultiplier: number;
|
||||
regenBonus: number;
|
||||
clickManaMultiplier: number;
|
||||
clickManaBonus: number;
|
||||
meditationEfficiency: number;
|
||||
spellCostMultiplier: number;
|
||||
conversionEfficiency: number;
|
||||
|
||||
// Combat effects
|
||||
baseDamageMultiplier: number;
|
||||
baseDamageBonus: number;
|
||||
attackSpeedMultiplier: number;
|
||||
critChanceBonus: number;
|
||||
critDamageMultiplier: number;
|
||||
elementalDamageMultiplier: number;
|
||||
|
||||
// Study effects
|
||||
studySpeedMultiplier: number;
|
||||
studyCostMultiplier: number;
|
||||
progressRetention: number;
|
||||
instantStudyChance: number;
|
||||
freeStudyChance: number;
|
||||
|
||||
// Element effects
|
||||
elementCapMultiplier: number;
|
||||
elementCapBonus: number;
|
||||
perElementCapBonus: Record<string, number>;
|
||||
conversionCostMultiplier: number;
|
||||
doubleCraftChance: number;
|
||||
|
||||
// Special values
|
||||
permanentRegenBonus: number;
|
||||
|
||||
// Special effect flags
|
||||
specials: Set<string>;
|
||||
|
||||
// All active upgrades for display
|
||||
activeUpgrades: ActiveUpgradeEffect[];
|
||||
|
||||
// DEEP_UNDERSTANDING: +10% bonus from all skill levels
|
||||
skillLevelMultiplier: number;
|
||||
|
||||
// Enchantment Power
|
||||
enchantmentPowerMultiplier: number;
|
||||
}
|
||||
Reference in New Issue
Block a user