68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
// ─── Combat Reset Helper ───────────────────────────────────────────────────────
|
|
// Generates the full default combat store state for resetCombat().
|
|
// Keeps combatStore.ts under the 400-line limit.
|
|
|
|
import type { RuntimeActiveGolem } from '../types';
|
|
import { getFloorMaxHP } from '../utils';
|
|
import { generateSpireFloorState, getRoomsForFloor } from '../utils/spire-utils';
|
|
import { makeInitialSpells } from './combat-actions';
|
|
import type { CombatState } from './combat-state.types';
|
|
|
|
export function createDefaultCombatState(
|
|
startFloor: number,
|
|
spellsToKeep: string[] = [],
|
|
): Partial<CombatState> {
|
|
const startSpells = makeInitialSpells(spellsToKeep);
|
|
const seed = startFloor * 12345;
|
|
const rooms = getRoomsForFloor(startFloor, seed);
|
|
const startRoom = generateSpireFloorState(startFloor, 0, rooms, 0);
|
|
|
|
return {
|
|
currentFloor: startFloor,
|
|
floorHP: getFloorMaxHP(startFloor),
|
|
floorMaxHP: getFloorMaxHP(startFloor),
|
|
maxFloorReached: startFloor,
|
|
activeSpell: 'manaBolt',
|
|
currentAction: 'meditate',
|
|
castProgress: 0,
|
|
spireMode: false,
|
|
currentRoom: startRoom,
|
|
clearedFloors: {},
|
|
climbDirection: null,
|
|
isDescending: false,
|
|
startFloor,
|
|
exitFloor: startFloor,
|
|
currentRoomIndex: 0,
|
|
roomsPerFloor: rooms,
|
|
runId: 0,
|
|
descentPeak: null,
|
|
roomResetState: {},
|
|
clearedRooms: {},
|
|
isDescentComplete: false,
|
|
golemancy: {
|
|
golemDesigns: {},
|
|
golemLoadout: [],
|
|
activeGolems: [] as RuntimeActiveGolem[],
|
|
lastSummonFloor: 0,
|
|
},
|
|
equipmentSpellStates: [],
|
|
weaponCastProgress: {},
|
|
comboHitCount: 0,
|
|
floorHitCount: 0,
|
|
meleeSwordProgress: {},
|
|
guardianShield: 0,
|
|
guardianShieldMax: 0,
|
|
guardianBarrier: 0,
|
|
guardianBarrierMax: 0,
|
|
spells: startSpells,
|
|
activityLog: [],
|
|
achievements: {
|
|
unlocked: [],
|
|
progress: {},
|
|
},
|
|
totalSpellsCast: 0,
|
|
totalDamageDealt: 0,
|
|
totalCraftsCompleted: 0,
|
|
};
|
|
}
|