import { buildEntity, toEntitySaveState, fromEntitySaveState, type EntityTemplateCatalog } from '@datamoc/mw_games/actors';
const catalog: EntityTemplateCatalog = {
growthCurves: { steep: { maxLevel: 20, experienceFor: (level) => level * level * 10 } },
};
const row = { id: 'fireling', growth: 'steep', attack: 10 };
const fireling = buildEntity(row, catalog);
fireling.stats.setBase('attack', 12);
fireling.progression?.addExperience(500);
const saved = toEntitySaveState(fireling); // JSON.stringify this into a save slot
const restored = fromEntitySaveState(row, catalog, saved);
restored.stats.get('attack'); // 12, not the row's original 10
A
BuiltEntity's mutable state, in the same "definitions supplied fresh on load" shapeStatBlock.toJSON/Progression.toJSONalready draw: base stat values, level and experience, and the carried item, never the row or catalog that produced them.