phase 1: refactor directory structure (value-objects, factions, characters)

This commit is contained in:
Willem van den Ende 2026-06-14 11:36:37 +01:00
parent 3965aaf33b
commit fc260dc97c
13 changed files with 18 additions and 18 deletions

View File

@ -4,12 +4,12 @@
* "I can't believe it's not Haskell": invariants at boundaries. * "I can't believe it's not Haskell": invariants at boundaries.
* State is encapsulated in a CharacterState record type. * State is encapsulated in a CharacterState record type.
*/ */
import { Health } from './Health.ts'; import { Health } from './value-objects/Health.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
import type { Status } from './Status.ts'; import type { Status } from './value-objects/Status.ts';
import { StatusAlive, StatusDead } from './Status.ts'; import { StatusAlive, StatusDead } from './value-objects/Status.ts';
import type { CharacterState } from './CharacterState.ts'; import type { CharacterState } from './characters/CharacterState.ts';
import type { Faction } from './Faction.ts'; import type { Faction } from './factions/Faction.ts';
import type { DamageDealer } from './magical-objects/magical-object-types.ts'; import type { DamageDealer } from './magical-objects/magical-object-types.ts';
import type { Healer } from './magical-objects/magical-object-types.ts'; import type { Healer } from './magical-objects/magical-object-types.ts';

View File

@ -7,7 +7,7 @@
*/ */
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
import { MagicalObject } from './MagicalObject.ts'; import { MagicalObject } from './MagicalObject.ts';
import type { Healer } from './magical-objects/magical-object-types.ts'; import type { Healer } from './magical-objects/magical-object-types.ts';

View File

@ -1,7 +1,7 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
describe('CharacterCreation', () => { describe('CharacterCreation', () => {
describe('initial health', () => { describe('initial health', () => {

View File

@ -4,10 +4,10 @@
* Groups the five character properties into a single value type, * Groups the five character properties into a single value type,
* keeping the Character constructor at one parameter. * keeping the Character constructor at one parameter.
*/ */
import type { Health } from './Health.ts'; import type { Health } from '../value-objects/Health.ts';
import type { Level } from './Level.ts'; import type { Level } from '../value-objects/Level.ts';
import type { Status } from './Status.ts'; import type { Status } from '../value-objects/Status.ts';
import type { Faction } from './Faction.ts'; import type { Faction } from '../factions/Faction.ts';
export type CharacterState = { export type CharacterState = {
readonly name: string; readonly name: string;

View File

@ -1,7 +1,7 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
describe('DamageAndHealth', () => { describe('DamageAndHealth', () => {
describe('DamageReducesHealth', () => { describe('DamageReducesHealth', () => {

View File

@ -1,8 +1,8 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Faction } from './Faction.ts'; import { Faction } from './factions/Faction.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
describe('Factions', () => { describe('Factions', () => {
const hero = () => Character.create({ name: 'hero', level: Level.create(1) }); const hero = () => Character.create({ name: 'hero', level: Level.create(1) });

View File

@ -1,7 +1,7 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
describe('Healing', () => { describe('Healing', () => {
describe('SelfHealIncreasesHealth', () => { describe('SelfHealIncreasesHealth', () => {

View File

@ -1,7 +1,7 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
describe('Levels', () => { describe('Levels', () => {
describe('CloseLevelNoModifier', () => { describe('CloseLevelNoModifier', () => {

View File

@ -1,7 +1,7 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, it } from 'vitest'; import { describe, it } from 'vitest';
import { Character } from './Character.ts'; import { Character } from './Character.ts';
import { Level } from './Level.ts'; import { Level } from './value-objects/Level.ts';
import { MagicalWeapon } from './MagicalWeapon.ts'; import { MagicalWeapon } from './MagicalWeapon.ts';
import { HealingObject } from './HealingObject.ts'; import { HealingObject } from './HealingObject.ts';