V1.7.0: area attacks on several targets

- More than one combatant can be marked as a target; the Target button now
  adds to the targets instead of moving the mark.
- Several targets make an area attack, which is harder to land: every
  target's AC counts as 2 higher for each target beyond the first. The
  attack bar shows the AC to beat, and each target's card names the penalty.
- The DM unticks any target the roll missed, then applies one total: split
  evenly between those hit (remainder to the first marked), or the full
  amount to each. Each share is shown before it is applied.
- The single target column from V1.6.0 becomes a list, carried over by the
  migration.
- All packages at version 1.7.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 13:01:42 +02:00
co-authored by Claude Opus 5.5
parent e4456b0df2
commit f8cee43ca2
13 changed files with 250 additions and 114 deletions
+16 -16
View File
@@ -1923,34 +1923,34 @@ describe('targets', () => {
const hero = await add({ characterId: heroId, initiativeRoll: 20 });
const first = await add({ monsterId: goblin.id, initiativeRoll: 10 });
const second = await add({ monsterId: goblin.id, initiativeRoll: 1 });
const target = (auth, participantId) => request(app).put(`${e}/target`).set(auth).send({ participantId });
const seen = async (auth) => (await request(app).get(e).set(auth)).body.encounter.targetParticipantId;
const target = (auth, ...participantIds) => request(app).put(`${e}/targets`).set(auth).send({ participantIds });
const seen = async (auth) => (await request(app).get(e).set(auth)).body.encounter.targetParticipantIds;
// Before the battle only the DM can mark anyone.
expect((await target(playerAuth, first.id)).status).toBe(403);
expect((await target(dmAuth, first.id)).body.encounter.targetParticipantId).toBe(first.id);
expect(await seen(playerAuth)).toBe(first.id);
expect((await target(dmAuth, 'nobody')).status).toBe(400);
expect((await target(dmAuth, first.id)).body.encounter.targetParticipantIds).toEqual([first.id]);
expect(await seen(playerAuth)).toEqual([first.id]);
expect((await target(dmAuth, first.id, 'nobody')).status).toBe(400);
// Beginning the battle clears it and puts the hero on turn: now the player can.
// Beginning the battle clears them and puts the hero on turn: now the
// player can, and several at once is an area attack, kept in the order picked.
await request(app).patch(e).set(dmAuth).send({ status: 'ACTIVE' });
expect(await seen(dmAuth)).toBeNull();
expect((await target(playerAuth, second.id)).status).toBe(200);
expect(await seen(dmAuth)).toBe(second.id);
expect(await seen(dmAuth)).toEqual([]);
expect((await target(playerAuth, second.id, first.id, second.id)).status).toBe(200);
expect(await seen(dmAuth)).toEqual([second.id, first.id]);
// Removing the target clears it.
// Removing a target unmarks it and leaves the rest.
await request(app).delete(`${e}/participants/${second.id}`).set(dmAuth);
expect(await seen(dmAuth)).toBeNull();
expect(await seen(dmAuth)).toEqual([first.id]);
// The turn passing clears it, and the player is no longer on turn.
await target(playerAuth, first.id);
// The turn passing clears them, and the player is no longer on turn.
await request(app).post(`${e}/next-turn`).set(dmAuth);
expect(await seen(dmAuth)).toBeNull();
expect(await seen(dmAuth)).toEqual([]);
expect((await target(playerAuth, first.id)).status).toBe(403);
// The goblin's turn: the DM marks the hero, and can clear it again.
expect((await target(dmAuth, hero.id)).body.encounter.targetParticipantId).toBe(hero.id);
expect((await target(dmAuth, null)).body.encounter.targetParticipantId).toBeNull();
expect((await target(dmAuth, hero.id)).body.encounter.targetParticipantIds).toEqual([hero.id]);
expect((await target(dmAuth)).body.encounter.targetParticipantIds).toEqual([]);
});
});