import { assignTraits, StatBlock, type TraitDef } from '@datamoc/mw_games/actors';
const stats = new StatBlock({ base: { strength: 10, speed: 10 } });
const pool: TraitDef[] = [
{ name: 'strong', modifiers: [{ stat: 'strength', op: 'add', value: 3 }] },
{ name: 'fast', modifiers: [{ stat: 'speed', op: 'add', value: 3 }] },
];
const assigned = assignTraits(stats, pool, 1); // one random trait, applied permanently
console.log(assigned[0].trait.name);
Draws
countdistinct traits at random frompooland applies their modifiers tostatspermanently - no clock, no trigger, nothing removes them automatically. Each trait gets its ownsourcesymbol so a game that genuinely needs to strip one later still can, viaStatBlock.removeModifiersFrom, even though nothing here ever calls that itself.