AC (Armor Class) optional field across all participant entry points: - shared: ac field on makeParticipant + buildMonsterParticipant + buildCharacterParticipant, defaults null - CharacterManager: defaultAc state + add form field + inline edit field + display in character list - Monster add form: AC field - EditParticipantModal: AC field next to Initiative - ParticipantManager (DM list): AC badge on name row (sky-blue, stylized, large value, small label) for at-a-glance reading - Player display: no AC (DM only) Layout polish: - Add participants form: 12-col grid, 5 fields single row (Init Mod, Initiative, AC, Max HP, HP Formula), shrunk from oversized fields - Character add form: 12-col grid, name grows (col-span-6), Init Mod/AC/HP small right-aligned, order matches add participants - Character inline edit: labels added (Name/HP/Init Mod/AC), name flex-grows - HP Formula: label trimmed (example moved to placeholder 'e.g. 2d6+9'), Reroll button in edit modal - ParticipantManager init input shrunk (w-8, centered) Tests: 6 new AC builder tests (turn.ac.test.js). Existing test labels updated for renamed fields.
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
// AC field on participant + builders.
|
|
const shared = require('@ttrpg/shared');
|
|
const { makeParticipant, buildMonsterParticipant, buildCharacterParticipant, rollHpFormula } = shared;
|
|
|
|
describe('AC field', () => {
|
|
test('makeParticipant accepts ac', () => {
|
|
const p = makeParticipant({ name: 'Orc', type: 'monster', initiative: 10, maxHp: 15, currentHp: 15, ac: 13 });
|
|
expect(p.ac).toBe(13);
|
|
});
|
|
|
|
test('makeParticipant ac defaults null', () => {
|
|
const p = makeParticipant({ name: 'Orc', type: 'monster', initiative: 10, maxHp: 15, currentHp: 15 });
|
|
expect(p.ac).toBeNull();
|
|
});
|
|
|
|
test('buildMonsterParticipant accepts ac', () => {
|
|
const { participant } = buildMonsterParticipant({ name: 'Goblin', maxHp: 7, initMod: 2, ac: 15 });
|
|
expect(participant.ac).toBe(15);
|
|
});
|
|
|
|
test('buildMonsterParticipant ac defaults null', () => {
|
|
const { participant } = buildMonsterParticipant({ name: 'Goblin', maxHp: 7 });
|
|
expect(participant.ac).toBeNull();
|
|
});
|
|
|
|
test('buildCharacterParticipant accepts character ac', () => {
|
|
const { participant } = buildCharacterParticipant({ id: 'c1', name: 'Fighter', defaultMaxHp: 30, defaultInitMod: 2, defaultAc: 18 });
|
|
expect(participant.ac).toBe(18);
|
|
});
|
|
|
|
test('buildCharacterParticipant ac defaults null when unset', () => {
|
|
const { participant } = buildCharacterParticipant({ id: 'c1', name: 'Fighter', defaultMaxHp: 30 });
|
|
expect(participant.ac).toBeNull();
|
|
});
|
|
});
|