4b7aa82953
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
- Add new golem component types (Core, Frame, MindCircuit, Enchantment) - Create 4 Core tiers, 7 Frames, 4 Mind Circuits, 8 Enchantments - Rewrite golem utils for component-based stat computation - Update GolemancyState with new fields (golemDesigns, golemLoadout, activeGolems) - Update combat store, actions, and pipelines for new golem system - Rewrite GolemancyTab with component selection UI - Update fabricator discipline perks for new system - Add comprehensive tests for component registries and utilities - All files under 400 lines, all 743 tests passing
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import type { SerializedGolemDesign } from '../types/game';
|
|
|
|
export function addGolemDesign(set: (fn: (s: any) => any) => void, design: SerializedGolemDesign) {
|
|
set((s: any) => {
|
|
const golemDesigns = { ...s.golemancy.golemDesigns, [design.id]: design };
|
|
const entry = { designId: design.id, design, enabled: true };
|
|
const golemLoadout = [...s.golemancy.golemLoadout, entry];
|
|
return { golemancy: { ...s.golemancy, golemDesigns, golemLoadout } };
|
|
});
|
|
}
|
|
|
|
export function removeGolemDesign(set: (fn: (s: any) => any) => void, designId: string) {
|
|
set((s: any) => {
|
|
const golemDesigns = { ...s.golemancy.golemDesigns };
|
|
delete golemDesigns[designId];
|
|
const golemLoadout = s.golemancy.golemLoadout.filter((e: any) => e.designId !== designId);
|
|
return { golemancy: { ...s.golemancy, golemDesigns, golemLoadout } };
|
|
});
|
|
}
|
|
|
|
export function toggleGolemLoadoutEntry(set: (fn: (s: any) => any) => void, designId: string) {
|
|
set((s: any) => {
|
|
const golemLoadout = s.golemancy.golemLoadout.map((e: any) =>
|
|
e.designId === designId ? { ...e, enabled: !e.enabled } : e,
|
|
);
|
|
return { golemancy: { ...s.golemancy, golemLoadout } };
|
|
});
|
|
}
|