Rework backend #1
@@ -256,6 +256,22 @@ test('full 100-round combat scenario', async () => {
|
|||||||
for (let r = 1; r <= ROUNDS; r++) {
|
for (let r = 1; r <= ROUNDS; r++) {
|
||||||
await recordAsync(`round ${r} nextTurn`, () => nextTurn());
|
await recordAsync(`round ${r} nextTurn`, () => nextTurn());
|
||||||
|
|
||||||
|
// rotation integrity: turnOrderIds no dup, currentTurn valid
|
||||||
|
if (r % 10 === 0) {
|
||||||
|
record(`round ${r} rotation-check`, () => {
|
||||||
|
const enc = currentEncDoc();
|
||||||
|
if (!enc) throw new Error('no encounter doc');
|
||||||
|
const order = enc.turnOrderIds || [];
|
||||||
|
const uniq = new Set(order);
|
||||||
|
if (uniq.size !== order.length) {
|
||||||
|
throw new Error(`turnOrderIds dup: ${JSON.stringify(order)}`);
|
||||||
|
}
|
||||||
|
if (enc.currentTurnParticipantId && !order.includes(enc.currentTurnParticipantId)) {
|
||||||
|
throw new Error(`currentTurn ${enc.currentTurnParticipantId} not in turnOrderIds`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// damage front monster every other round
|
// damage front monster every other round
|
||||||
if (r % 2 === 0) record(`round ${r} damage OrcBoss`, () => applyDamage('OrcBoss', 3));
|
if (r % 2 === 0) record(`round ${r} damage OrcBoss`, () => applyDamage('OrcBoss', 3));
|
||||||
if (r % 3 === 0) record(`round ${r} heal Cleric`, () => applyHeal('Cleric', 2));
|
if (r % 3 === 0) record(`round ${r} heal Cleric`, () => applyHeal('Cleric', 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user