Phase 4: Mana Well effects (remaining 7)
This commit is contained in:
+25
-4
@@ -563,6 +563,7 @@ function makeInitial(overrides: Partial<GameState> = {}): GameState {
|
||||
const pu = overrides.prestigeUpgrades || {};
|
||||
const startFloor = 1 + (pu.spireKey || 0) * 2;
|
||||
const elemMax = computeElementMax({ skills: overrides.skills || {}, prestigeUpgrades: pu });
|
||||
const manaHeartBonus = overrides.manaHeartBonus || 0;
|
||||
|
||||
const elements: Record<string, { current: number; max: number; unlocked: boolean }> = {};
|
||||
Object.keys(ELEMENTS).forEach((k) => {
|
||||
@@ -732,6 +733,9 @@ function makeInitial(overrides: Partial<GameState> = {}): GameState {
|
||||
log: ['✨ The loop begins. You start with a Basic Staff (Mana Bolt) and civilian clothes. Gather your strength, mage.'],
|
||||
loopInsight: 0,
|
||||
flowSurgeEndTime: 0, // Hour timestamp for FLOW_SURGE effect (0 = inactive)
|
||||
|
||||
// Mana Well Effects (Phase 4)
|
||||
manaHeartBonus: manaHeartBonus, // Cumulative +10% max mana per loop from MANA_HEART
|
||||
};
|
||||
}
|
||||
|
||||
@@ -883,10 +887,19 @@ export const useGameStore = create<GameStore>()(
|
||||
}
|
||||
}
|
||||
|
||||
// Mana regeneration with MANA_OVERFLOW support
|
||||
// Mana regeneration with MANA_OVERFLOW and VOID_STORAGE support
|
||||
const overflowMultiplier = hasSpecial(effects, SPECIAL_EFFECTS.MANA_OVERFLOW) ? 1.2 : 1.0;
|
||||
const maxManaWithOverflow = maxMana * overflowMultiplier;
|
||||
let rawMana = Math.min(state.rawMana + effectiveRegen * HOURS_PER_TICK, maxManaWithOverflow);
|
||||
const hasVoidStorage = hasSpecial(effects, SPECIAL_EFFECTS.VOID_STORAGE);
|
||||
const voidStorageMultiplier = hasVoidStorage ? 1.5 : 1.0; // VOID_STORAGE: Store 150% max
|
||||
const maxManaStorage = maxMana * overflowMultiplier * voidStorageMultiplier;
|
||||
|
||||
// MANA_GENESIS: Generate 1% of max mana per hour passively
|
||||
let manaGenesisBonus = 0;
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.MANA_GENESIS)) {
|
||||
manaGenesisBonus = maxMana * 0.01 * HOURS_PER_TICK;
|
||||
}
|
||||
|
||||
let rawMana = Math.min(state.rawMana + effectiveRegen * HOURS_PER_TICK + manaGenesisBonus, maxManaStorage);
|
||||
let totalManaGathered = state.totalManaGathered;
|
||||
|
||||
// Attunement mana conversion - convert raw mana to attunement's primary mana type
|
||||
@@ -1706,11 +1719,18 @@ export const useGameStore = create<GameStore>()(
|
||||
spellsToKeep = learnedSpells.slice(0, state.skills.temporalMemory);
|
||||
}
|
||||
|
||||
// EMERGENCY_RESERVE: Keep 10% mana on new loop
|
||||
// Compute effects for special checks
|
||||
const effects = computeEffects(state.skillUpgrades || {}, state.skillTiers || {});
|
||||
|
||||
// EMERGENCY_RESERVE: Keep 10% mana on new loop
|
||||
const hasEmergencyReserve = hasSpecial(effects, SPECIAL_EFFECTS.EMERGENCY_RESERVE);
|
||||
const maxMana = computeMaxMana(state, effects);
|
||||
const keepMana = hasEmergencyReserve ? Math.floor(maxMana * 0.10) : 0;
|
||||
|
||||
// MANA_HEART: +10% max mana per loop (permanent bonus, compounds)
|
||||
const hasManaHeart = hasSpecial(effects, SPECIAL_EFFECTS.MANA_HEART);
|
||||
const currentHeartBonus = state.manaHeartBonus || 0;
|
||||
const newHeartBonus = hasManaHeart ? currentHeartBonus + 0.10 : currentHeartBonus;
|
||||
|
||||
const newState = makeInitial({
|
||||
loopCount: state.loopCount + 1,
|
||||
@@ -1719,6 +1739,7 @@ export const useGameStore = create<GameStore>()(
|
||||
prestigeUpgrades: state.prestigeUpgrades,
|
||||
memories: state.memories,
|
||||
skills: state.skills, // Keep skills through temporal memory for now
|
||||
manaHeartBonus: newHeartBonus,
|
||||
});
|
||||
|
||||
// Set the kept mana from EMERGENCY_RESERVE
|
||||
|
||||
Reference in New Issue
Block a user