fix(game): pass real effects to hasSpecial in tick() — Executioner/Berserker now work
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Circular Dependencies
|
||||
Generated: 2026-05-19T09:19:14.412Z
|
||||
Generated: 2026-05-19T09:44:29.294Z
|
||||
Found: 3 circular chain(s) — these MUST be fixed before modifying involved files.
|
||||
|
||||
1. Processed 121 files (1.2s) (28 warnings)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"_meta": {
|
||||
"generated": "2026-05-19T09:19:12.922Z",
|
||||
"generated": "2026-05-19T09:44:27.808Z",
|
||||
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
||||
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
||||
},
|
||||
|
||||
@@ -6,6 +6,10 @@ import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import { TICK_MS, HOURS_PER_TICK, MAX_DAY, SPELLS_DEF, GUARDIANS, getStudySpeedMultiplier } from '../constants';
|
||||
import { hasSpecial, SPECIAL_EFFECTS } from '../effects/special-effects';
|
||||
import { computeEquipmentEffects } from '../effects';
|
||||
import type { ComputedEffects } from '../effects/upgrade-effects.types';
|
||||
|
||||
import { computeDisciplineEffects } from '../effects/discipline-effects';
|
||||
import {
|
||||
computeMaxMana,
|
||||
computeRegen,
|
||||
@@ -23,6 +27,8 @@ import { usePrestigeStore } from './prestigeStore';
|
||||
import { useManaStore } from './manaStore';
|
||||
import { useCombatStore, makeInitialSpells } from './combatStore';
|
||||
import { useAttunementStore } from './attunementStore';
|
||||
import { useCraftingStore } from './craftingStore';
|
||||
import { useDisciplineStore } from './discipline-slice';
|
||||
import { ATTUNEMENTS_DEF, getAttunementConversionRate } from '../data/attunements';
|
||||
import { createResetGame, createGatherMana } from './gameActions';
|
||||
import { createStartNewLoop } from './gameLoopActions';
|
||||
@@ -72,13 +78,29 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
const prestigeState = usePrestigeStore.getState();
|
||||
const manaState = useManaStore.getState();
|
||||
const combatState = useCombatStore.getState();
|
||||
const craftingState = useCraftingStore.getState();
|
||||
const disciplineStoreState = useDisciplineStore.getState();
|
||||
|
||||
// Compute equipment specials from enchanted gear
|
||||
const equipmentEffects = computeEquipmentEffects(
|
||||
craftingState.equipmentInstances || {},
|
||||
craftingState.equippedInstances || {}
|
||||
);
|
||||
// Compute discipline specials from active discipline perks
|
||||
const disciplineEffects = computeDisciplineEffects(disciplineStoreState as any);
|
||||
// Merge all specials into a single set for hasSpecial checks
|
||||
const allSpecials = new Set<string>([
|
||||
...equipmentEffects.specials,
|
||||
...disciplineEffects.specials,
|
||||
]);
|
||||
const effects = { specials: allSpecials } as ComputedEffects;
|
||||
|
||||
const maxMana = computeMaxMana(
|
||||
{ skills: {}, prestigeUpgrades: prestigeState.prestigeUpgrades, skillUpgrades: {}, skillTiers: {} },
|
||||
undefined
|
||||
);
|
||||
const baseRegen = computeRegen(
|
||||
{ skills: {}, prestigeUpgrades: prestigeState.prestigeUpgrades, skillUpgrades: {}, skillTiers: {}, attunement: {} },
|
||||
{ skills: {}, prestigeUpgrades: prestigeState.prestigeUpgrades, skillUpgrades: {}, skillTiers: {}, attunements: {} },
|
||||
undefined
|
||||
);
|
||||
|
||||
@@ -222,12 +244,12 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
let dmg = damage;
|
||||
|
||||
// Executioner: +100% damage to enemies below 25% HP
|
||||
if (hasSpecial({}, SPECIAL_EFFECTS.EXECUTIONER) && combatState.floorHP / combatState.floorMaxHP < 0.25) {
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.EXECUTIONER) && combatState.floorHP / combatState.floorMaxHP < 0.25) {
|
||||
dmg *= 2;
|
||||
}
|
||||
|
||||
// Berserker: +50% damage when below 50% mana
|
||||
if (hasSpecial({}, SPECIAL_EFFECTS.BERSERKER) && rawMana < maxMana * 0.5) {
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.BERSERKER) && rawMana < maxMana * 0.5) {
|
||||
dmg *= 1.5;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user