From 8fb7c5b68c6e4b9f00bb92285cd1cb9a7778ff2f Mon Sep 17 00:00:00 2001 From: Greegko Date: Sat, 10 Jun 2023 20:15:14 +0400 Subject: [PATCH] equipment factories --- .../lib => models/item}/equipment-factory.ts | 4 ++-- packages/core/src/models/item/index.ts | 1 + .../blacksmith/blacksmith-command-handler.ts | 14 ++++++++++++-- .../core/src/modules/village/lib/hero-factory.ts | 3 +-- 4 files changed, 16 insertions(+), 6 deletions(-) rename packages/core/src/{modules/village/lib => models/item}/equipment-factory.ts (92%) diff --git a/packages/core/src/modules/village/lib/equipment-factory.ts b/packages/core/src/models/item/equipment-factory.ts similarity index 92% rename from packages/core/src/modules/village/lib/equipment-factory.ts rename to packages/core/src/models/item/equipment-factory.ts index 03e0f25..8a770c5 100644 --- a/packages/core/src/modules/village/lib/equipment-factory.ts +++ b/packages/core/src/models/item/equipment-factory.ts @@ -1,7 +1,7 @@ import { generate } from "shortid"; -import { AttackEffectType, DefenseEffectType, EffectType } from "@models"; -import { Armor, ItemType, Shield, Weapon } from "@models"; +import { AttackEffectType, DefenseEffectType, EffectType } from "../effect"; +import { Armor, ItemType, Shield, Weapon } from "./item-types"; export function weaponFactory(): Weapon { return { diff --git a/packages/core/src/models/item/index.ts b/packages/core/src/models/item/index.ts index 0357448..c023d11 100644 --- a/packages/core/src/models/item/index.ts +++ b/packages/core/src/models/item/index.ts @@ -2,3 +2,4 @@ export * from "./item"; export * from "./equipment"; export * from "./base-item"; export * from "./item-types"; +export * from "./equipment-factory"; diff --git a/packages/core/src/modules/village/buildings/blacksmith/blacksmith-command-handler.ts b/packages/core/src/modules/village/buildings/blacksmith/blacksmith-command-handler.ts index 6971a70..70df3a8 100644 --- a/packages/core/src/modules/village/buildings/blacksmith/blacksmith-command-handler.ts +++ b/packages/core/src/modules/village/buildings/blacksmith/blacksmith-command-handler.ts @@ -4,9 +4,19 @@ import { append, evolve } from "rambda"; import { commandHandler } from "@core"; import { UnitID, UnitService } from "@features/unit"; -import { AttackEffectType, Effect, EffectType, EquipmentItem, Item, ItemID, ItemType } from "@models"; +import { + AttackEffectType, + Effect, + EffectType, + EquipmentItem, + Item, + ItemID, + ItemType, + armorFactory, + shieldFactory, + weaponFactory, +} from "@models"; import { StashLocation, VillageStashService } from "@modules/village"; -import { armorFactory, shieldFactory, weaponFactory } from "@modules/village/lib/equipment-factory"; import { BlacksmithCommand, diff --git a/packages/core/src/modules/village/lib/hero-factory.ts b/packages/core/src/modules/village/lib/hero-factory.ts index 5558f30..bb9d037 100644 --- a/packages/core/src/modules/village/lib/hero-factory.ts +++ b/packages/core/src/modules/village/lib/hero-factory.ts @@ -1,8 +1,7 @@ import { sample } from "@lib/sample"; import { Unit, UnitType } from "@features/unit"; - -import { armorFactory, shieldFactory, weaponFactory } from "./equipment-factory"; +import { armorFactory, shieldFactory, weaponFactory } from "@models"; const lastname = [ "Emperor",