rpg-combat-pi-01/specs/character-creation.allium
Willem van den Ende e267c35e55 refactor(story1): clean story boundaries, introduce CharacterState record type, tighten ESLint
- 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)
2026-06-12 20:32:44 +01:00

56 lines
1.1 KiB
Plaintext

-- allium: 3
-- allium: character-creation
------------------------------------------------------------
-- Value Types
------------------------------------------------------------
type Health {
value: Integer
requires: value >= 0
}
type Level {
value: Integer
requires: value >= 1 and value <= 10
}
type Status {
alive | dead
}
------------------------------------------------------------
-- Entities
------------------------------------------------------------
entity Character {
name: String
health: Health
status: Status
level: Level
factions: Set<Faction>
}
------------------------------------------------------------
-- Rules
------------------------------------------------------------
rule CharacterCreation {
when: Character.create(name, level)
ensures: character.health.value = 1000
ensures: character.status = alive
ensures: character.level = level
ensures: character.factions = empty
}
rule MaxLevel {
for c in Characters:
c.level.value <= 10
}
rule MinLevel {
for c in Characters:
c.level.value >= 1
}