phase 2: move Character, HealingObject, MagicalObject, MagicalWeapon into directories
This commit is contained in:
parent
fc260dc97c
commit
bc64293ba4
@ -1,6 +1,6 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
|
||||
describe('CharacterCreation', () => {
|
||||
|
||||
@ -4,14 +4,14 @@
|
||||
* "I can't believe it's not Haskell": invariants at boundaries.
|
||||
* State is encapsulated in a CharacterState record type.
|
||||
*/
|
||||
import { Health } from './value-objects/Health.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
import type { Status } from './value-objects/Status.ts';
|
||||
import { StatusAlive, StatusDead } from './value-objects/Status.ts';
|
||||
import type { CharacterState } from './characters/CharacterState.ts';
|
||||
import type { Faction } from './factions/Faction.ts';
|
||||
import type { DamageDealer } from './magical-objects/magical-object-types.ts';
|
||||
import type { Healer } from './magical-objects/magical-object-types.ts';
|
||||
import { Health } from '../value-objects/Health.ts';
|
||||
import { Level } from '../value-objects/Level.ts';
|
||||
import type { Status } from '../value-objects/Status.ts';
|
||||
import { StatusAlive, StatusDead } from '../value-objects/Status.ts';
|
||||
import type { CharacterState } from './CharacterState.ts';
|
||||
import type { Faction } from '../factions/Faction.ts';
|
||||
import type { DamageDealer } from '../magical-objects/magical-object-types.ts';
|
||||
import type { Healer } from '../magical-objects/magical-object-types.ts';
|
||||
|
||||
export interface CharacterCtor {
|
||||
name: string;
|
||||
@ -1,6 +1,6 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
|
||||
describe('DamageAndHealth', () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Faction } from './factions/Faction.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
|
||||
describe('Healing', () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
|
||||
describe('Levels', () => {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, it } from 'vitest';
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from './characters/Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
import { MagicalWeapon } from './MagicalWeapon.ts';
|
||||
import { HealingObject } from './HealingObject.ts';
|
||||
import { MagicalWeapon } from './magical-objects/MagicalWeapon.ts';
|
||||
import { HealingObject } from './magical-objects/HealingObject.ts';
|
||||
|
||||
describe('Magical Objects', () => {
|
||||
describe('WeaponDealsDamage', () => {
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
* - CurrentHealth never exceeds maxHealth
|
||||
*/
|
||||
|
||||
import { Character } from './Character.ts';
|
||||
import { Level } from './value-objects/Level.ts';
|
||||
import { Character } from '../characters/Character.ts';
|
||||
import { Level } from '../value-objects/Level.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 {
|
||||
private constructor(
|
||||
@ -5,9 +5,9 @@
|
||||
* Invariants enforced at construction:
|
||||
* - Damage is non-negative
|
||||
*/
|
||||
import { Character } from './Character.ts';
|
||||
import { Character } from '../characters/Character.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 {
|
||||
readonly #damage: number;
|
||||
@ -5,8 +5,8 @@
|
||||
* These interfaces describe magical objects from Character's point of view,
|
||||
* so Character can depend on abstractions rather than concrete classes.
|
||||
*/
|
||||
import type { Character } from '../Character.ts';
|
||||
import type { MagicalObjectStatus } from '../MagicalObject.ts';
|
||||
import type { Character } from '../characters/Character.ts';
|
||||
import type { MagicalObjectStatus } from './MagicalObject.ts';
|
||||
|
||||
/** A magical object that deals damage — from Character's point of view */
|
||||
export interface DamageDealer {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user