12 Commits

Author SHA1 Message Date
bc64293ba4 phase 2: move Character, HealingObject, MagicalObject, MagicalWeapon into directories 2026-06-14 11:44:42 +01:00
fc260dc97c phase 1: refactor directory structure (value-objects, factions, characters) 2026-06-14 11:36:37 +01:00
0805623b68 refactor: break circular dependency with DamageDealer and Healer interfaces
- Create src/magical-objects/magical-object-types.ts with DamageDealer
  and Healer interfaces
- MagicalWeapon implements DamageDealer
- HealingObject implements Healer
- Character depends on interfaces instead of concrete classes
2026-06-14 10:49:53 +01:00
350e8073e9 story 3 was not completely done 2026-06-14 09:54:07 +01:00
f6605bbbfd feat: implement story 3 (Factions) with Allium spec and fast-check properties
- Add .pi/specs/story-3-factions.allium with formal spec for faction rules
- Add src/factions.spec.ts with 26 fast-check properties covering:
  - joinFaction / leaveFaction (add, remove, idempotent, dead no-op)
  - isAllyOf (shared factions, symmetry, self-not-ally)
  - dealDamage blocks ally damage
  - healAlly (allies only, capped, dead no-op)
- Implement Character methods: joinFaction, leaveFaction, isAllyOf, healAlly
- Modify dealDamage to check ally status before applying damage
2026-06-13 22:36:43 +01:00
11919c742a feat: Magical Objects story — weapons and healing items
- MagicalWeapon: fixed damage, owner-only, self-destructs at 0 HP
- HealingObject: heals characters up to both caps, self-destructs at 0 HP
- 18 fast-check properties covering rules and invariants
- Allium spec with entities, rules, and invariants
- Character.createWithHealthAndStatus factory method for status-aware creation
2026-06-13 22:13:06 +01:00
38ea78f91e feat(story2): level-based damage modifiers — diff method, 50% scaling for level gaps, transcripts 2026-06-13 16:08:50 +01:00
39983a30c9 forgot to mention the story 2026-06-13 15:57:23 +01:00
4cdb048dfc refactor(story2): immutable dealDamage, reference guard, negative damage validation, spec precision
- dealDamage returns new Character instead of mutating in-place
- SelfDamageForbidden uses reference equality (this === target)
- Negative damage throws at the boundary
- Removed duplicate Health.maxHealthForLevel (Level.ts is source of truth)
- Allium spec uses max(0, ...) for health floor precision
- New property: NegativeDamageForbidden (11 total properties)
2026-06-13 15:44:46 +01:00
fc2cf73b34 feat: story 2 — Characters can Deal Damage to Characters
- Allium spec: damage-and-health.allium
- 5 fast-check properties: damage reduces health, health non-negative,
  death at zero, self-damage forbidden, dead cannot take damage
- Character.createWithHealth factory for testing with arbitrary health
- Character.dealDamage(target, damage) method
2026-06-13 15:28:34 +01:00
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
d3cc48c0f7 feat: Character Creation user story — ADTs, properties, and Allium spec
- Level value object (1..10, level-capped health)
- Health value object (non-negative, pure sub/add)
- Status discriminated union (alive | dead)
- Character entity with private constructor and static factory
- 9 fast-check properties covering creation invariants
- Allium spec with entities, rules, and invariants
2026-06-12 20:23:48 +01:00