- Introduce CharacterState value object to group character properties → Character constructor reduced from 5 to 1 parameter - Introduce Faction value type (previously bare string) - Remove cross-story methods: isAllyOf, isAlive, isDead, add, isMax, next, diff - Remove misleading level parameter from Health.create - Remove trivial invariant tests (dead-code paths on fresh characters) - Move cross-cutting invariants out of character-creation.allium - ESLint: forbid unused params (remove argsIgnorePattern), max-params=5 - null parameters enforced by TypeScript strictNullChecks (tsconfig)
21 lines
616 B
TypeScript
21 lines
616 B
TypeScript
/**
|
|
* CharacterState — immutable record of all character state at a point in time.
|
|
*
|
|
* Groups the five character properties into a single value object,
|
|
* keeping the Character constructor at one parameter (max-params: 4).
|
|
*/
|
|
import type { Health } from './Health.ts';
|
|
import type { Level } from './Level.ts';
|
|
import type { Status } from './Status.ts';
|
|
import type { Faction } from './Faction.ts';
|
|
|
|
export class CharacterState {
|
|
constructor(
|
|
readonly name: string,
|
|
readonly health: Health,
|
|
readonly status: Status,
|
|
readonly level: Level,
|
|
readonly factions: ReadonlySet<Faction>,
|
|
) {}
|
|
}
|