Split custom world generation into staged lightweight batches
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-05 22:20:30 +08:00
parent 89cecda7da
commit fcd8d727b0
57 changed files with 7646 additions and 1425 deletions

View File

@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
import {
buildCustomWorldPlayableCharacters,
createCharacterSkillCooldowns,
getCharacterMaxHp,
getCharacterMaxMana,
setRuntimeCharacterOverrides,
} from '../data/characterPresets';
@@ -16,7 +17,7 @@ import { getScenePreset,getWorldCampScenePreset } from '../data/scenePresets';
import { AnimationState, Character, CustomWorldProfile, Encounter, GameState, SceneNpc, WorldType } from '../types';
import type { BottomTab } from '../types/navigation';
const PLAYER_MAX_HP = 180;
const PLAYER_BASE_MAX_HP = 180;
export type {BottomTab} from '../types/navigation';
@@ -71,8 +72,8 @@ function createInitialGameState(): GameState {
playerActionMode: 'idle',
scrollWorld: false,
inBattle: false,
playerHp: PLAYER_MAX_HP,
playerMaxHp: PLAYER_MAX_HP,
playerHp: PLAYER_BASE_MAX_HP,
playerMaxHp: PLAYER_BASE_MAX_HP,
playerMana: 0,
playerMaxMana: 0,
playerSkillCooldowns: {},
@@ -165,6 +166,11 @@ export function useGameFlow() {
? buildInitialNpcState(initialEncounter, gameState.worldType, gameState)
: null;
const initialEquipment = buildInitialEquipmentLoadout(character);
const playerMaxHp = getCharacterMaxHp(
character,
gameState.worldType,
gameState.customWorldProfile,
);
setGameState(prev =>
ensureSceneEncounterPreview(
@@ -188,8 +194,8 @@ export function useGameFlow() {
playerActionMode: 'idle',
scrollWorld: false,
inBattle: false,
playerHp: PLAYER_MAX_HP,
playerMaxHp: PLAYER_MAX_HP,
playerHp: playerMaxHp,
playerMaxHp: playerMaxHp,
playerMana: getCharacterMaxMana(character),
playerMaxMana: getCharacterMaxMana(character),
playerSkillCooldowns: createCharacterSkillCooldowns(character),