phase 2: move Character, HealingObject, MagicalObject, MagicalWeapon into directories

This commit is contained in:
Willem van den Ende 2026-06-14 11:44:42 +01:00
parent fc260dc97c
commit bc64293ba4
11 changed files with 23 additions and 23 deletions

View File

@ -1,6 +1,6 @@
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 './characters/Character.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';
describe('CharacterCreation', () => { describe('CharacterCreation', () => {

View File

@ -4,14 +4,14 @@
* "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 './value-objects/Health.ts'; import { Health } from '../value-objects/Health.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from '../value-objects/Level.ts';
import type { Status } from './value-objects/Status.ts'; import type { Status } from '../value-objects/Status.ts';
import { StatusAlive, StatusDead } from './value-objects/Status.ts'; import { StatusAlive, StatusDead } from '../value-objects/Status.ts';
import type { CharacterState } from './characters/CharacterState.ts'; import type { CharacterState } from './CharacterState.ts';
import type { Faction } from './factions/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';
export interface CharacterCtor { export interface CharacterCtor {
name: string; name: string;

View File

@ -1,6 +1,6 @@
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 './characters/Character.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';
describe('DamageAndHealth', () => { describe('DamageAndHealth', () => {

View File

@ -1,6 +1,6 @@
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 './characters/Character.ts';
import { Faction } from './factions/Faction.ts'; import { Faction } from './factions/Faction.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';

View File

@ -1,6 +1,6 @@
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 './characters/Character.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';
describe('Healing', () => { describe('Healing', () => {

View File

@ -1,6 +1,6 @@
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 './characters/Character.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';
describe('Levels', () => { describe('Levels', () => {

View File

@ -1,9 +1,9 @@
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 './characters/Character.ts';
import { Level } from './value-objects/Level.ts'; import { Level } from './value-objects/Level.ts';
import { MagicalWeapon } from './MagicalWeapon.ts'; import { MagicalWeapon } from './magical-objects/MagicalWeapon.ts';
import { HealingObject } from './HealingObject.ts'; import { HealingObject } from './magical-objects/HealingObject.ts';
describe('Magical Objects', () => { describe('Magical Objects', () => {
describe('WeaponDealsDamage', () => { describe('WeaponDealsDamage', () => {

View File

@ -6,10 +6,10 @@
* - CurrentHealth never exceeds maxHealth * - CurrentHealth never exceeds maxHealth
*/ */
import { Character } from './Character.ts'; import { Character } from '../characters/Character.ts';
import { Level } from './value-objects/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-object-types.ts';
export class HealingObject extends MagicalObject implements Healer { export class HealingObject extends MagicalObject implements Healer {
private constructor( private constructor(

View File

@ -5,9 +5,9 @@
* Invariants enforced at construction: * Invariants enforced at construction:
* - Damage is non-negative * - Damage is non-negative
*/ */
import { Character } from './Character.ts'; import { Character } from '../characters/Character.ts';
import { MagicalObject } from './MagicalObject.ts'; import { MagicalObject } from './MagicalObject.ts';
import type { DamageDealer } from './magical-objects/magical-object-types.ts'; import type { DamageDealer } from './magical-object-types.ts';
export class MagicalWeapon extends MagicalObject implements DamageDealer { export class MagicalWeapon extends MagicalObject implements DamageDealer {
readonly #damage: number; readonly #damage: number;

View File

@ -5,8 +5,8 @@
* These interfaces describe magical objects from Character's point of view, * These interfaces describe magical objects from Character's point of view,
* so Character can depend on abstractions rather than concrete classes. * so Character can depend on abstractions rather than concrete classes.
*/ */
import type { Character } from '../Character.ts'; import type { Character } from '../characters/Character.ts';
import type { MagicalObjectStatus } from '../MagicalObject.ts'; import type { MagicalObjectStatus } from './MagicalObject.ts';
/** A magical object that deals damage — from Character's point of view */ /** A magical object that deals damage — from Character's point of view */
export interface DamageDealer { export interface DamageDealer {