Split custom world generation into staged lightweight batches
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {useCallback, useEffect, useState} from 'react';
|
||||
|
||||
import { getCharacterMaxMana } from '../data/characterPresets';
|
||||
import { getCharacterMaxHp, getCharacterMaxMana } from '../data/characterPresets';
|
||||
import { normalizeRoster } from '../data/companionRoster';
|
||||
import { getInitialPlayerCurrency } from '../data/economy';
|
||||
import {
|
||||
@@ -16,7 +16,6 @@ import {clearSavedSnapshot, readSavedSnapshot, writeSavedSnapshot} from '../pers
|
||||
import { GameState, StoryMoment } from '../types';
|
||||
import { BottomTab } from './useGameFlow';
|
||||
|
||||
const PLAYER_BASE_MAX_HP = 180;
|
||||
const AUTO_SAVE_DELAY_MS = 400;
|
||||
|
||||
function normalizeSavedStory(story: StoryMoment | null) {
|
||||
@@ -94,10 +93,16 @@ function normalizeSavedGameState(gameState: GameState) {
|
||||
? normalizedEncounterState.playerEquipment
|
||||
: buildInitialEquipmentLoadout(normalizedEncounterState.playerCharacter);
|
||||
|
||||
const playerMaxHp = getCharacterMaxHp(
|
||||
normalizedEncounterState.playerCharacter,
|
||||
normalizedEncounterState.worldType,
|
||||
normalizedEncounterState.customWorldProfile,
|
||||
);
|
||||
|
||||
return applyEquipmentLoadoutToState({
|
||||
...normalizedCommonState,
|
||||
playerMaxHp: PLAYER_BASE_MAX_HP,
|
||||
playerHp: Math.min(normalizedEncounterState.playerHp, PLAYER_BASE_MAX_HP),
|
||||
playerMaxHp,
|
||||
playerHp: Math.min(normalizedEncounterState.playerHp, playerMaxHp),
|
||||
playerMaxMana: getCharacterMaxMana(normalizedEncounterState.playerCharacter),
|
||||
playerMana: getCharacterMaxMana(normalizedEncounterState.playerCharacter),
|
||||
playerEquipment: createEmptyEquipmentLoadout(),
|
||||
|
||||
Reference in New Issue
Block a user