import { battleOrder, type BattleAction } from '@datamoc/mw_games/battle';
const actions: BattleAction<string>[] = [
{ actor: 'hero', speed: 12 },
{ actor: 'wolf', speed: 18 },
{ actor: 'hero-item', speed: 12, priority: 1 }, // items go first regardless of speed
];
const order = battleOrder(actions).map((a) => a.actor); // ['hero-item', 'wolf', 'hero']
Turn order by speed, with move priority overriding it - one round's worth of ordering, not a persistent queue.
mwg/roguelike'sScheduleralready covers continuous energy-cost time for a dungeon; a battle round picks everyone's action first and then needs only this, a single stable sort.