fix: address multiple bugs (1,2,3,5,6,9,10,11,12,13) - partial fix for 4, remaining 7,8
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m9s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m9s
This commit is contained in:
@@ -24,6 +24,8 @@ import { usePrestigeStore } from './prestigeStore';
|
||||
import { useManaStore } from './manaStore';
|
||||
import { useSkillStore } from './skillStore';
|
||||
import { useCombatStore, makeInitialSpells } from './combatStore';
|
||||
import { useAttunementStore } from './attunementStore';
|
||||
import { ATTUNEMENTS_DEF, getAttunementConversionRate } from '../data/attunements';
|
||||
import { createResetGame, createGatherMana } from './gameActions';
|
||||
import { createStartNewLoop } from './gameLoopActions';
|
||||
|
||||
@@ -146,9 +148,34 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
|
||||
// Mana regeneration
|
||||
let rawMana = Math.min(manaState.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana);
|
||||
let totalManaGathered = manaState.totalManaGathered;
|
||||
let elements = { ...manaState.elements };
|
||||
|
||||
// Apply attunement conversion (raw mana to primary mana types)
|
||||
const attunementState = useAttunementStore.getState();
|
||||
Object.entries(attunementState.attunements).forEach(([id, state]) => {
|
||||
if (!state.active) return;
|
||||
const def = ATTUNEMENTS_DEF[id];
|
||||
if (!def || def.conversionRate <= 0 || !def.primaryManaType) return;
|
||||
|
||||
const scaledRate = getAttunementConversionRate(id, state.level || 1);
|
||||
const conversionThisTick = scaledRate * HOURS_PER_TICK; // per tick
|
||||
|
||||
// Cap conversion to available raw mana
|
||||
const actualConversion = Math.min(conversionThisTick, rawMana);
|
||||
|
||||
// Subtract from raw mana
|
||||
rawMana = Math.max(0, rawMana - actualConversion);
|
||||
|
||||
// Add to primary mana type
|
||||
if (elements[def.primaryManaType]) {
|
||||
elements[def.primaryManaType].current = Math.min(
|
||||
elements[def.primaryManaType].max,
|
||||
elements[def.primaryManaType].current + actualConversion
|
||||
);
|
||||
}
|
||||
});
|
||||
let totalManaGathered = manaState.totalManaGathered;
|
||||
|
||||
// Study progress - handled by skillStore
|
||||
if (combatState.currentAction === 'study' && skillState.currentStudyTarget) {
|
||||
const studySpeedMult = getStudySpeedMultiplier(skillState.skills);
|
||||
|
||||
Reference in New Issue
Block a user