From 997beb9066ae610781da79ed244c4a5e4e55df44 Mon Sep 17 00:00:00 2001 From: Ido-Barnea Date: Tue, 14 May 2024 17:21:29 +0300 Subject: [PATCH 1/5] Refactored pieces for better architecture --- core/development/Game.ts | 2 +- core/development/LogicAdapter.ts | 18 +++---- core/development/logic/PieceLogic.ts | 10 ++-- core/development/logic/Utilities.ts | 4 +- .../logic/actions/AttackPieceAction.test.ts | 2 +- .../logic/actions/AttackPieceAction.ts | 11 ++-- .../logic/actions/CastleAction.test.ts | 2 +- .../development/logic/actions/CastleAction.ts | 6 +-- .../logic/actions/KillPieceAction.test.ts | 4 +- .../logic/actions/KillPieceAction.ts | 10 ++-- .../actions/KillPieceByEnvironmentAction.ts | 2 +- ...illPieceByFallingOffTheBoardAction.test.ts | 6 +-- .../KillPieceByFallingOffTheBoardAction.ts | 2 +- .../actions/KillPieceByPieceAction.test.ts | 6 +-- .../logic/actions/KillPieceByPieceAction.ts | 14 +++--- .../logic/actions/MovePieceAction.test.ts | 2 +- .../logic/actions/MovePieceAction.ts | 4 +- .../PermanentlyKillPieceAction.test.ts | 2 +- .../actions/PermanentlyKillPieceAction.ts | 2 +- .../actions/RevertPieceMovementAction.test.ts | 2 +- .../actions/RevertPieceMovementAction.ts | 2 +- .../logic/actions/SpawnPieceAction.ts | 4 +- .../logic/actions/SpawnPieceInHeavenAction.ts | 2 +- .../logic/actions/SpawnPieceInHellAction.ts | 2 +- .../logic/actions/TriggerPieceOnItemAction.ts | 2 +- .../TriggerPieceOnPiggyBankAction.test.ts | 2 +- .../actions/TriggerPieceOnPiggyBankAction.ts | 2 +- .../actions/TriggerPieceOnTrapAction.test.ts | 4 +- .../logic/actions/TriggerPieceOnTrapAction.ts | 4 +- .../development/logic/items/PiggyBank.test.ts | 2 +- core/development/logic/items/PiggyBank.ts | 9 ++-- core/development/logic/items/Shield.test.ts | 6 +-- core/development/logic/items/Shield.ts | 6 +-- core/development/logic/items/Trap.test.ts | 2 +- core/development/logic/items/Trap.ts | 2 +- core/development/logic/items/abstract/Item.ts | 2 +- core/development/logic/pieces/Bishop.test.ts | 2 +- core/development/logic/pieces/Bishop.ts | 15 ++++-- .../logic/pieces/DoubleQueen.test.ts | 4 +- core/development/logic/pieces/DoubleQueen.ts | 18 ++++--- core/development/logic/pieces/Golem.test.ts | 2 +- core/development/logic/pieces/Golem.ts | 18 ++++--- core/development/logic/pieces/King.test.ts | 2 +- core/development/logic/pieces/King.ts | 22 +++++--- core/development/logic/pieces/Knight.test.ts | 2 +- core/development/logic/pieces/Knight.ts | 17 +++++-- core/development/logic/pieces/Pawn.test.ts | 4 +- core/development/logic/pieces/Pawn.ts | 17 +++++-- core/development/logic/pieces/Queen.test.ts | 2 +- core/development/logic/pieces/Queen.ts | 17 +++++-- core/development/logic/pieces/Rook.test.ts | 4 +- core/development/logic/pieces/Rook.ts | 17 +++++-- core/development/logic/pieces/Unicorn.test.ts | 2 +- core/development/logic/pieces/Unicorn.ts | 20 +++++--- .../logic/pieces/abstract/BasePiece.ts | 50 ------------------- .../logic/pieces/abstract/Piece.ts | 5 -- core/development/logic/rules/BountyRule.ts | 14 ++---- .../logic/rules/ExperienceOnKillRule.test.ts | 2 +- .../logic/rules/FriendlyFireRule.test.ts | 2 +- .../PieceMovementSimulationValidator.ts | 4 +- .../logic/validators/PlayerMoveValidator.ts | 4 +- core/development/ui/Board.ts | 8 +-- core/development/ui/BoardManager.ts | 2 +- core/development/ui/UpgradeUI.ts | 12 ++--- core/development/ui/logs/Log.ts | 24 +++------ core/model/pieces/PieceModifiers.ts | 11 ++++ core/model/pieces/PieceResource.ts | 7 +++ core/model/pieces/PieceStats.ts | 8 +++ core/model/pieces/abstract/BasePiece.ts | 30 +++++++++++ core/model/pieces/abstract/PieceBehavior.ts | 5 ++ .../logic/pieces => model}/types/Position.ts | 0 .../logic/pieces => model}/types/Square.ts | 2 +- 72 files changed, 296 insertions(+), 243 deletions(-) delete mode 100644 core/development/logic/pieces/abstract/BasePiece.ts delete mode 100644 core/development/logic/pieces/abstract/Piece.ts create mode 100644 core/model/pieces/PieceModifiers.ts create mode 100644 core/model/pieces/PieceResource.ts create mode 100644 core/model/pieces/PieceStats.ts create mode 100644 core/model/pieces/abstract/BasePiece.ts create mode 100644 core/model/pieces/abstract/PieceBehavior.ts rename core/{development/logic/pieces => model}/types/Position.ts (100%) rename core/{development/logic/pieces => model}/types/Square.ts (65%) diff --git a/core/development/Game.ts b/core/development/Game.ts index 46ffe764..98e7089f 100644 --- a/core/development/Game.ts +++ b/core/development/Game.ts @@ -19,13 +19,13 @@ import { Logger } from './ui/logs/Logger'; import { initializeInventoryUI } from './ui/InventoriesUI'; import { PlayerColor } from './logic/players/types/PlayerColor'; import { PlayerInventory } from './logic/inventory/PlayerInventory'; -import { BasePiece } from './logic/pieces/abstract/BasePiece'; import { ItemsShop } from './logic/shop/ItemsShop'; import { PlayersTurnSwitcher } from './logic/turn switcher/PlayersTurnSwitcher'; import { renderInitialShopItemsElements, updateShopButtonsState, } from './ui/ShopUI'; +import { BasePiece } from '../model/pieces/abstract/BasePiece'; export const shop = new ItemsShop(); diff --git a/core/development/LogicAdapter.ts b/core/development/LogicAdapter.ts index f513c93e..22cd2b58 100644 --- a/core/development/LogicAdapter.ts +++ b/core/development/LogicAdapter.ts @@ -35,14 +35,14 @@ import { Trap } from './logic/items/Trap'; import { HEAVEN_BOARD_ID, HELL_BOARD_ID } from './Constants'; import { showUpgradeablePiecesElements } from './ui/UpgradeUI'; import { PlayerColor } from './logic/players/types/PlayerColor'; -import { BasePiece } from './logic/pieces/abstract/BasePiece'; -import { Position } from './logic/pieces/types/Position'; -import { Square } from './logic/pieces/types/Square'; import { Unicorn } from './logic/pieces/Unicorn'; import { KillPieceByFallingOffTheBoardAction } from './logic/actions/KillPieceByFallingOffTheBoardAction'; import { KillPieceByPieceAction } from './logic/actions/KillPieceByPieceAction'; import { ShopActionResult } from './logic/shop/types/ShopActionResult'; import { updateShopButtonsState } from './ui/ShopUI'; +import { Position } from '../model/types/Position'; +import { BasePiece } from '../model/pieces/abstract/BasePiece'; +import { Square } from '../model/types/Square'; export function renderScreen() { renderGameInformation(); @@ -163,7 +163,7 @@ export function onPieceSelected(pieceElement: HTMLElement, boardId: string) { hideUnicornAttackButton(); } - showUpgradeablePiecesElements(piece, piece.upgrades); + showUpgradeablePiecesElements(piece, piece.modifiers.upgrades); highlightLegalMoves(piece, boardId); } @@ -172,8 +172,8 @@ export function upgradePiece( upgradedPiece: BasePiece, ) { const currentPlayer = game.getPlayersTurnSwitcher().getCurrentPlayer(); - if (currentPlayer.xp < upgradedPiece.price) return; - currentPlayer.xp -= upgradedPiece.price; + if (currentPlayer.xp < upgradedPiece.stats.price) return; + currentPlayer.xp -= upgradedPiece.stats.price; // Destroy piece destroyPieceOnBoard(upgradeablePiece); @@ -260,12 +260,12 @@ export function destroyItemOnBoard(item: BaseItem) { } export function destroyItemOnPiece(piece: BasePiece) { - if (!piece.position || !piece.isEquipedItem) return; + if (!piece.position || !piece.stats.isEquippedItem) return; const pieceCoordinates = piece.position.coordinates; const squareId = pieceCoordinates.join(','); - piece.isEquipedItem = false; + piece.stats.isEquippedItem = false; destroyElementOnPiece(squareId, piece.position.boardId); } @@ -353,7 +353,7 @@ export function canPlaceItemOnBoard( const targetPiece = getPieceByPosition(squarePosition); if (!targetPiece) return false; - targetPiece.isEquipedItem = true; + targetPiece.stats.isEquippedItem = true; new Shield().use(squarePosition); break; diff --git a/core/development/logic/PieceLogic.ts b/core/development/logic/PieceLogic.ts index 2c39b558..192e19b7 100644 --- a/core/development/logic/PieceLogic.ts +++ b/core/development/logic/PieceLogic.ts @@ -3,14 +3,14 @@ import { movePieceOnBoard } from '../LogicAdapter'; import { BaseItem } from './items/abstract/Item'; import { Player } from './players/Player'; import { MovementLog } from '../ui/logs/Log'; -import { BasePiece } from './pieces/abstract/BasePiece'; -import { Square } from './pieces/types/Square'; -import { Position } from './pieces/types/Position'; import { PlayerMoveValidator } from './validators/PlayerMoveValidator'; import { PieceMovementSimulationValidator } from './validators/PieceMovementSimulationValidator'; import { AttackPieceAction } from './actions/AttackPieceAction'; import { MovePieceAction } from './actions/MovePieceAction'; import { RevertPieceMovementAction } from './actions/RevertPieceMovementAction'; +import { BasePiece } from '../../model/pieces/abstract/BasePiece'; +import { Square } from '../../model/types/Square'; +import { Position } from '../../model/types/Position'; export function onPlayerAction( draggedPiece: BasePiece, @@ -23,7 +23,7 @@ export function onPlayerAction( } if (game.getMovesLeft() === 0) { - game.setMovesLeft(draggedPiece.moves); + game.setMovesLeft(draggedPiece.stats.moves); } const pieceMovementSimulationValidator = new PieceMovementSimulationValidator( @@ -62,6 +62,6 @@ export function move( boardId: draggedPiece.position.boardId, }; - draggedPiece.hasMoved = true; + draggedPiece.modifiers.hasMoved = true; if (shouldEndTurn) game.endMove(); } diff --git a/core/development/logic/Utilities.ts b/core/development/logic/Utilities.ts index a7928b75..d91a23c2 100644 --- a/core/development/logic/Utilities.ts +++ b/core/development/logic/Utilities.ts @@ -1,6 +1,6 @@ +import { BasePiece } from '../../model/pieces/abstract/BasePiece'; +import { Position } from '../../model/types/Position'; import { game } from '../Game'; -import { BasePiece } from './pieces/abstract/BasePiece'; -import { Position } from './pieces/types/Position'; export function comparePositions( firstPosition: Position | undefined, diff --git a/core/development/logic/actions/AttackPieceAction.test.ts b/core/development/logic/actions/AttackPieceAction.test.ts index 806e5f07..fc0e1450 100644 --- a/core/development/logic/actions/AttackPieceAction.test.ts +++ b/core/development/logic/actions/AttackPieceAction.test.ts @@ -1,8 +1,8 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { Queen } from '../pieces/Queen'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { AttackPieceAction } from './AttackPieceAction'; diff --git a/core/development/logic/actions/AttackPieceAction.ts b/core/development/logic/actions/AttackPieceAction.ts index 5254a1f1..8cbd6aa5 100644 --- a/core/development/logic/actions/AttackPieceAction.ts +++ b/core/development/logic/actions/AttackPieceAction.ts @@ -1,8 +1,8 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { Square } from '../../../model/types/Square'; import { game } from '../../Game'; import { move } from '../PieceLogic'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Position } from '../pieces/types/Position'; -import { Square } from '../pieces/types/Square'; import { KillPieceByPieceAction } from './KillPieceByPieceAction'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; @@ -18,7 +18,10 @@ export class AttackPieceAction implements GameAction { execute(): ActionResult { if (!this.target.position) return ActionResult.FAILURE; - const targetPosition = this.target.copyPosition() as Position; + const targetPosition: Position = { + coordinates: this.target.position.coordinates, + boardId: this.target.position.boardId, + } game.setIsFriendlyFire(this.target.player === this.piece.player); const killPieceByPieceResult = new KillPieceByPieceAction( diff --git a/core/development/logic/actions/CastleAction.test.ts b/core/development/logic/actions/CastleAction.test.ts index 0e326f8e..eb536698 100644 --- a/core/development/logic/actions/CastleAction.test.ts +++ b/core/development/logic/actions/CastleAction.test.ts @@ -1,8 +1,8 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { King } from '../pieces/King'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { CastleAction } from './CastleAction'; diff --git a/core/development/logic/actions/CastleAction.ts b/core/development/logic/actions/CastleAction.ts index 9a22e005..832a4815 100644 --- a/core/development/logic/actions/CastleAction.ts +++ b/core/development/logic/actions/CastleAction.ts @@ -1,8 +1,8 @@ +import { Position } from '../../../model/types/Position'; +import { Square } from '../../../model/types/Square'; import { Log } from '../../ui/logs/Log'; import { move } from '../PieceLogic'; import { King } from '../pieces/King'; -import { Position } from '../pieces/types/Position'; -import { Square } from '../pieces/types/Square'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; @@ -46,7 +46,7 @@ export class CastleAction implements GameAction { move(rookPiece, rookPieceTargetSquare.position, false); new Log( - `${this.piece.pieceIcon} ${this.piece.player.color} castled.`, + `${this.piece.resource.pieceIcon} ${this.piece.player.color} castled.`, ).addToQueue(); return ActionResult.SUCCESS; } diff --git a/core/development/logic/actions/KillPieceAction.test.ts b/core/development/logic/actions/KillPieceAction.test.ts index e79ef36a..edc8f417 100644 --- a/core/development/logic/actions/KillPieceAction.test.ts +++ b/core/development/logic/actions/KillPieceAction.test.ts @@ -1,3 +1,4 @@ +import { Position } from '../../../model/types/Position'; import { HEAVEN_BOARD_ID, HELL_BOARD_ID, @@ -7,7 +8,6 @@ import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { King } from '../pieces/King'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { KillPieceAction } from './KillPieceAction'; @@ -96,7 +96,7 @@ describe('KillPieceAction', () => { boardId: OVERWORLD_BOARD_ID, }; const killedPiece = new Pawn(whitePlayer, initialPosition); - killedPiece.killCount = 1; + killedPiece.modifiers.killCount = 1; const killPieceAction = new KillPieceAction( killedPiece, OVERWORLD_BOARD_ID, diff --git a/core/development/logic/actions/KillPieceAction.ts b/core/development/logic/actions/KillPieceAction.ts index 586d2749..d431e48f 100644 --- a/core/development/logic/actions/KillPieceAction.ts +++ b/core/development/logic/actions/KillPieceAction.ts @@ -1,12 +1,8 @@ -import { - HEAVEN_BOARD_ID, - HELL_BOARD_ID, - OVERWORLD_BOARD_ID, -} from '../../Constants'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { destroyPieceOnBoard } from '../../LogicAdapter'; import { King } from '../pieces/King'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { PermanentlyKillPieceAction } from './PermanentlyKillPieceAction'; import { SpawnPieceInHeavenAction } from './SpawnPieceInHeavenAction'; import { SpawnPieceInHellAction } from './SpawnPieceInHellAction'; @@ -26,7 +22,7 @@ export class KillPieceAction implements GameAction { if (this.killedPiece.position?.boardId === OVERWORLD_BOARD_ID) { game.increaseDeathCounter(); - const hasPieceKilledOtherPieces = this.killedPiece.killCount > 0; + const hasPieceKilledOtherPieces = this.killedPiece.modifiers.killCount > 0; const isKilledPieceKing = this.killedPiece instanceof King; const pieceOriginBoardId = this.killedPiece.position.boardId; diff --git a/core/development/logic/actions/KillPieceByEnvironmentAction.ts b/core/development/logic/actions/KillPieceByEnvironmentAction.ts index f4e192a1..c53987d8 100644 --- a/core/development/logic/actions/KillPieceByEnvironmentAction.ts +++ b/core/development/logic/actions/KillPieceByEnvironmentAction.ts @@ -1,8 +1,8 @@ -import { BasePiece } from '../pieces/abstract/BasePiece'; import { ActionResult } from './types/ActionResult'; import { KillPieceAction } from './KillPieceAction'; import { KillLog } from '../../ui/logs/Log'; import { game } from '../../Game'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; export class KillPieceByEnvironmentAction extends KillPieceAction { private killingSource: string; diff --git a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts b/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts index 2c353b9a..a3c3a99c 100644 --- a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts +++ b/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts @@ -1,9 +1,9 @@ -import { OVERWORLD_BOARD_ID, VOID_BOARD_ID } from '../../Constants'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { Pawn } from '../pieces/Pawn'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { KillPieceByEnvironmentAction } from './KillPieceByEnvironmentAction'; diff --git a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts b/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts index 0fb65651..72e28140 100644 --- a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts +++ b/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts @@ -1,5 +1,5 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { VOID_BOARD_ID } from '../../Constants'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { KillPieceByEnvironmentAction } from './KillPieceByEnvironmentAction'; import { ActionResult } from './types/ActionResult'; export class KillPieceByFallingOffTheBoardAction extends KillPieceByEnvironmentAction { diff --git a/core/development/logic/actions/KillPieceByPieceAction.test.ts b/core/development/logic/actions/KillPieceByPieceAction.test.ts index fc989be0..bdd8de3f 100644 --- a/core/development/logic/actions/KillPieceByPieceAction.test.ts +++ b/core/development/logic/actions/KillPieceByPieceAction.test.ts @@ -1,8 +1,8 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { KillPieceByPieceAction } from './KillPieceByPieceAction'; @@ -50,7 +50,7 @@ describe('KillPieceByPieceAction', () => { }; const killedPiece = new Pawn(whitePlayer, initialPosition); const initialPieceHealth = 6; - killedPiece.health = initialPieceHealth; + killedPiece.stats.health = initialPieceHealth; const killPieceByPieceAction = new KillPieceByPieceAction( killedPiece, killedPiece, @@ -61,7 +61,7 @@ describe('KillPieceByPieceAction', () => { // Assert expect(actionResult).toEqual(ActionResult.FAILURE); - expect(killedPiece.health).toEqual(initialPieceHealth - 1); + expect(killedPiece.stats.health).toEqual(initialPieceHealth - 1); }); test('should return SUCCESS if killedPiece.health == 1', () => { diff --git a/core/development/logic/actions/KillPieceByPieceAction.ts b/core/development/logic/actions/KillPieceByPieceAction.ts index 3ec47b0a..1a1a802e 100644 --- a/core/development/logic/actions/KillPieceByPieceAction.ts +++ b/core/development/logic/actions/KillPieceByPieceAction.ts @@ -1,11 +1,11 @@ -import { BasePiece } from '../pieces/abstract/BasePiece'; import { ActionResult } from './types/ActionResult'; import { KillLog } from '../../ui/logs/Log'; import { game } from '../../Game'; import { MIN_KILLINGS_FOR_BOUNTY } from '../../Constants'; import { destroyItemOnPiece, movePieceOnBoard } from '../../LogicAdapter'; -import { Position } from '../pieces/types/Position'; import { KillPieceAction } from './KillPieceAction'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; export class KillPieceByPieceAction extends KillPieceAction { private killerPiece: BasePiece; @@ -15,15 +15,15 @@ export class KillPieceByPieceAction extends KillPieceAction { } execute(): ActionResult { - this.killedPiece.health--; - if (this.killedPiece.health > 0) { + this.killedPiece.stats.health--; + if (this.killedPiece.stats.health > 0) { this.failToKillPiece(); return ActionResult.FAILURE; } - this.killerPiece.killCount++; - if (this.killedPiece.killCount >= MIN_KILLINGS_FOR_BOUNTY) { - this.killerPiece.player.gold += this.killedPiece.killCount; + this.killerPiece.modifiers.killCount++; + if (this.killedPiece.modifiers.killCount >= MIN_KILLINGS_FOR_BOUNTY) { + this.killerPiece.player.gold += this.killedPiece.modifiers.killCount; } game.setKillerPiece(this.killerPiece); diff --git a/core/development/logic/actions/MovePieceAction.test.ts b/core/development/logic/actions/MovePieceAction.test.ts index 7e86b23e..d2034fe7 100644 --- a/core/development/logic/actions/MovePieceAction.test.ts +++ b/core/development/logic/actions/MovePieceAction.test.ts @@ -1,9 +1,9 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { King } from '../pieces/King'; import { Rook } from '../pieces/Rook'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { MovePieceAction } from './MovePieceAction'; diff --git a/core/development/logic/actions/MovePieceAction.ts b/core/development/logic/actions/MovePieceAction.ts index 8fe51036..93ccdff3 100644 --- a/core/development/logic/actions/MovePieceAction.ts +++ b/core/development/logic/actions/MovePieceAction.ts @@ -1,10 +1,10 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; import { game } from '../../Game'; import { move } from '../PieceLogic'; import { comparePositions } from '../Utilities'; import { King } from '../pieces/King'; import { Pawn } from '../pieces/Pawn'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Position } from '../pieces/types/Position'; import { CastleAction } from './CastleAction'; import { KillPieceByPieceAction } from './KillPieceByPieceAction'; import { GameAction } from './abstract/GameAction'; diff --git a/core/development/logic/actions/PermanentlyKillPieceAction.test.ts b/core/development/logic/actions/PermanentlyKillPieceAction.test.ts index 6a70d6e3..e891475a 100644 --- a/core/development/logic/actions/PermanentlyKillPieceAction.test.ts +++ b/core/development/logic/actions/PermanentlyKillPieceAction.test.ts @@ -1,9 +1,9 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { King } from '../pieces/King'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { PermanentlyKillPieceAction } from './PermanentlyKillPieceAction'; diff --git a/core/development/logic/actions/PermanentlyKillPieceAction.ts b/core/development/logic/actions/PermanentlyKillPieceAction.ts index 8d83e58a..385df55e 100644 --- a/core/development/logic/actions/PermanentlyKillPieceAction.ts +++ b/core/development/logic/actions/PermanentlyKillPieceAction.ts @@ -1,7 +1,7 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { game } from '../../Game'; import { destroyPieceOnBoard } from '../../LogicAdapter'; import { King } from '../pieces/King'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; diff --git a/core/development/logic/actions/RevertPieceMovementAction.test.ts b/core/development/logic/actions/RevertPieceMovementAction.test.ts index f1ee1d39..c27f6faf 100644 --- a/core/development/logic/actions/RevertPieceMovementAction.test.ts +++ b/core/development/logic/actions/RevertPieceMovementAction.test.ts @@ -1,8 +1,8 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { RevertPieceMovementAction } from './RevertPieceMovementAction'; diff --git a/core/development/logic/actions/RevertPieceMovementAction.ts b/core/development/logic/actions/RevertPieceMovementAction.ts index 2ccb7d06..1f1bd7b8 100644 --- a/core/development/logic/actions/RevertPieceMovementAction.ts +++ b/core/development/logic/actions/RevertPieceMovementAction.ts @@ -1,5 +1,5 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { movePieceOnBoard } from '../../LogicAdapter'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; diff --git a/core/development/logic/actions/SpawnPieceAction.ts b/core/development/logic/actions/SpawnPieceAction.ts index 202611d2..7530e306 100644 --- a/core/development/logic/actions/SpawnPieceAction.ts +++ b/core/development/logic/actions/SpawnPieceAction.ts @@ -1,7 +1,7 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { game } from '../../Game'; import { spawnPieceOnBoard } from '../../LogicAdapter'; import { comparePositions } from '../Utilities'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { PermanentlyKillPieceAction } from './PermanentlyKillPieceAction'; import { TriggerPieceOnItemAction } from './TriggerPieceOnItemAction'; import { GameAction } from './abstract/GameAction'; @@ -18,7 +18,7 @@ export class SpawnPieceAction implements GameAction { execute(): ActionResult { if (!this.piece || !this.piece.position) return ActionResult.FAILURE; - this.piece.killCount = 0; + this.piece.modifiers.killCount = 0; this.piece.position.boardId = this.boardId; game.getPieces().forEach((piece) => { diff --git a/core/development/logic/actions/SpawnPieceInHeavenAction.ts b/core/development/logic/actions/SpawnPieceInHeavenAction.ts index aaffdf22..dfd6fbf6 100644 --- a/core/development/logic/actions/SpawnPieceInHeavenAction.ts +++ b/core/development/logic/actions/SpawnPieceInHeavenAction.ts @@ -1,5 +1,5 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { HEAVEN_BOARD_ID } from '../../Constants'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { SpawnPieceAction } from './SpawnPieceAction'; export class SpawnPieceInHeavenAction extends SpawnPieceAction { diff --git a/core/development/logic/actions/SpawnPieceInHellAction.ts b/core/development/logic/actions/SpawnPieceInHellAction.ts index fcb0373e..3033aa61 100644 --- a/core/development/logic/actions/SpawnPieceInHellAction.ts +++ b/core/development/logic/actions/SpawnPieceInHellAction.ts @@ -1,5 +1,5 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { HELL_BOARD_ID } from '../../Constants'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { SpawnPieceAction } from './SpawnPieceAction'; export class SpawnPieceInHellAction extends SpawnPieceAction { diff --git a/core/development/logic/actions/TriggerPieceOnItemAction.ts b/core/development/logic/actions/TriggerPieceOnItemAction.ts index b4471178..9476b1ea 100644 --- a/core/development/logic/actions/TriggerPieceOnItemAction.ts +++ b/core/development/logic/actions/TriggerPieceOnItemAction.ts @@ -1,5 +1,5 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { BaseItem } from '../items/abstract/Item'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { TriggerPieceOnPiggyBankAction } from './TriggerPieceOnPiggyBankAction'; import { TriggerPieceOnTrapAction } from './TriggerPieceOnTrapAction'; import { GameAction } from './abstract/GameAction'; diff --git a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts b/core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts index dba0821e..94eceb7d 100644 --- a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts +++ b/core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts @@ -1,9 +1,9 @@ +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { PiggyBank } from '../items/PiggyBank'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { TriggerPieceOnPiggyBankAction } from './TriggerPieceOnPiggyBankAction'; diff --git a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts b/core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts index 05d455a7..b7eb9259 100644 --- a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts +++ b/core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts @@ -1,7 +1,7 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { game } from '../../Game'; import { destroyItemOnBoard } from '../../LogicAdapter'; import { BaseItem } from '../items/abstract/Item'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; diff --git a/core/development/logic/actions/TriggerPieceOnTrapAction.test.ts b/core/development/logic/actions/TriggerPieceOnTrapAction.test.ts index a737e1ca..eb7543dd 100644 --- a/core/development/logic/actions/TriggerPieceOnTrapAction.test.ts +++ b/core/development/logic/actions/TriggerPieceOnTrapAction.test.ts @@ -1,10 +1,10 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { game } from '../../Game'; import { PlayerInventory } from '../inventory/PlayerInventory'; import { Trap } from '../items/Trap'; import { Pawn } from '../pieces/Pawn'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Position } from '../pieces/types/Position'; import { Player } from '../players/Player'; import { PlayerColor } from '../players/types/PlayerColor'; import { KillPieceByEnvironmentAction } from './KillPieceByEnvironmentAction'; diff --git a/core/development/logic/actions/TriggerPieceOnTrapAction.ts b/core/development/logic/actions/TriggerPieceOnTrapAction.ts index ce5e2b05..8c523705 100644 --- a/core/development/logic/actions/TriggerPieceOnTrapAction.ts +++ b/core/development/logic/actions/TriggerPieceOnTrapAction.ts @@ -1,8 +1,8 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; import { game } from '../../Game'; import { destroyItemOnBoard } from '../../LogicAdapter'; import { move } from '../PieceLogic'; import { BaseItem } from '../items/abstract/Item'; -import { BasePiece } from '../pieces/abstract/BasePiece'; import { KillPieceByEnvironmentAction as KillPieceByEnvironmentAction } from './KillPieceByEnvironmentAction'; import { GameAction } from './abstract/GameAction'; import { ActionResult } from './types/ActionResult'; @@ -20,7 +20,7 @@ export class TriggerPieceOnTrapAction implements GameAction { if (!this.item.position) return ActionResult.FAILURE; move(this.piece, this.item.position, false); - this.piece.health = 1; + this.piece.stats.health = 1; new KillPieceByEnvironmentAction(this.piece, this.item.name).execute(); game.setItems(game.getItems().filter((item) => item !== this.item)); diff --git a/core/development/logic/items/PiggyBank.test.ts b/core/development/logic/items/PiggyBank.test.ts index d0fbffc7..f08bb7cc 100644 --- a/core/development/logic/items/PiggyBank.test.ts +++ b/core/development/logic/items/PiggyBank.test.ts @@ -3,10 +3,10 @@ import { Player } from '../players/Player'; import { game } from '../../Game'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from '../pieces/types/Position'; import { Pawn } from '../pieces/Pawn'; import { ItemActionResult } from './types/ItemActionResult'; import { PiggyBank } from './PiggyBank'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); diff --git a/core/development/logic/items/PiggyBank.ts b/core/development/logic/items/PiggyBank.ts index 03aa6352..eef865c5 100644 --- a/core/development/logic/items/PiggyBank.ts +++ b/core/development/logic/items/PiggyBank.ts @@ -3,7 +3,7 @@ import { piggyBankResource } from '../../ui/Resources'; import { Log } from '../../ui/logs/Log'; import { getPieceByPosition } from '../Utilities'; import { ItemActionResult } from './types/ItemActionResult'; -import { Position } from '../pieces/types/Position'; +import { Position } from '../../../model/types/Position'; export class PiggyBank extends BaseItem { constructor(position?: Position) { @@ -22,13 +22,10 @@ export class PiggyBank extends BaseItem { const gold = this.getRandomAmountOfCoins(); piece.player.gold += gold; - const { - player: { color: pieceColor }, - name: pieceName, - } = piece; + const { resource, player } = piece; new Log( - `${pieceColor} ${pieceName} claimed a ${this.name} and recieved ${gold} gold coins.`, + `${player.color} ${resource.name} claimed a ${this.name} and recieved ${gold} gold coins.`, ).addToQueue(); return ItemActionResult.SUCCESS; diff --git a/core/development/logic/items/Shield.test.ts b/core/development/logic/items/Shield.test.ts index 14593458..c34b1926 100644 --- a/core/development/logic/items/Shield.test.ts +++ b/core/development/logic/items/Shield.test.ts @@ -3,10 +3,10 @@ import { Player } from '../players/Player'; import { game } from '../../Game'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from '../pieces/types/Position'; import { Shield } from './Shield'; import { Pawn } from '../pieces/Pawn'; import { ItemActionResult } from './types/ItemActionResult'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); @@ -49,7 +49,7 @@ describe('Shield', () => { boardId: OVERWORLD_BOARD_ID, }; const piece = new Pawn(whitePlayer, initialPiecePosition); - const initialPieceHealth = piece.health; + const initialPieceHealth = piece.stats.health; game.setPieces([piece]); const shieldItem = new Shield(); @@ -59,7 +59,7 @@ describe('Shield', () => { // Assert expect(itemActionResult).toEqual(ItemActionResult.SUCCESS); - expect(piece.health).toEqual(initialPieceHealth + 1); + expect(piece.stats.health).toEqual(initialPieceHealth + 1); }); test('should return FAILURE if piece is undefined', () => { diff --git a/core/development/logic/items/Shield.ts b/core/development/logic/items/Shield.ts index 02929887..b1b61153 100644 --- a/core/development/logic/items/Shield.ts +++ b/core/development/logic/items/Shield.ts @@ -5,7 +5,7 @@ import { getPieceByPosition } from '../Utilities'; import { spawnItemOnPiece } from '../../LogicAdapter'; import { ItemActionResult } from './types/ItemActionResult'; import { Logger } from '../../ui/logs/Logger'; -import { Position } from '../pieces/types/Position'; +import { Position } from '../../../model/types/Position'; export class Shield extends BaseItem { constructor(position?: Position) { @@ -20,12 +20,12 @@ export class Shield extends BaseItem { piece.position.coordinates, ); new Log( - `${piece.player.color} ${piece.name} on ${logCoordinates} equiped a ${this.name}.`, + `${piece.player.color} ${piece.resource.name} on ${logCoordinates} equiped a ${this.name}.`, ).addToQueue(); Logger.logMessages(); this.position = position; - piece.health++; + piece.stats.health++; spawnItemOnPiece(this); return ItemActionResult.SUCCESS; diff --git a/core/development/logic/items/Trap.test.ts b/core/development/logic/items/Trap.test.ts index b8ec7a84..093daa6e 100644 --- a/core/development/logic/items/Trap.test.ts +++ b/core/development/logic/items/Trap.test.ts @@ -3,9 +3,9 @@ import { Player } from '../players/Player'; import { game } from '../../Game'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from '../pieces/types/Position'; import { ItemActionResult } from './types/ItemActionResult'; import { Trap } from './Trap'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); diff --git a/core/development/logic/items/Trap.ts b/core/development/logic/items/Trap.ts index 707b7db9..d6183fef 100644 --- a/core/development/logic/items/Trap.ts +++ b/core/development/logic/items/Trap.ts @@ -5,7 +5,7 @@ import { game } from '../../Game'; import { Log, MovementLog } from '../../ui/logs/Log'; import { Logger } from '../../ui/logs/Logger'; import { ItemActionResult } from './types/ItemActionResult'; -import { Position } from '../pieces/types/Position'; +import { Position } from '../../../model/types/Position'; export class Trap extends BaseItem { constructor(position?: Position) { diff --git a/core/development/logic/items/abstract/Item.ts b/core/development/logic/items/abstract/Item.ts index 3ff0fff0..3e056d05 100644 --- a/core/development/logic/items/abstract/Item.ts +++ b/core/development/logic/items/abstract/Item.ts @@ -1,4 +1,4 @@ -import { Position } from '../../pieces/types/Position'; +import { Position } from '../../../../model/types/Position'; import { ItemActionResult } from '../types/ItemActionResult'; export abstract class BaseItem { diff --git a/core/development/logic/pieces/Bishop.test.ts b/core/development/logic/pieces/Bishop.test.ts index 66de5fa9..0bbb240e 100644 --- a/core/development/logic/pieces/Bishop.test.ts +++ b/core/development/logic/pieces/Bishop.test.ts @@ -6,7 +6,7 @@ import { Bishop } from './Bishop'; import { Pawn } from './Pawn'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Bishop.ts b/core/development/logic/pieces/Bishop.ts index 1a97450c..1f4c5b93 100644 --- a/core/development/logic/pieces/Bishop.ts +++ b/core/development/logic/pieces/Bishop.ts @@ -2,13 +2,22 @@ import { bishopResource } from '../../ui/Resources'; import { Player } from '../players/Player'; import { getPieceByPosition } from '../Utilities'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class Bishop extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♗' : '♝'; - super(bishopResource, icon, 'Bishop', player, position); + super( + new PieceResource(bishopResource, icon, 'Bishop'), + new PieceStats(1, 1, 1), + new PieceModifiers(), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/DoubleQueen.test.ts b/core/development/logic/pieces/DoubleQueen.test.ts index 684acb6e..4ff1cdbb 100644 --- a/core/development/logic/pieces/DoubleQueen.test.ts +++ b/core/development/logic/pieces/DoubleQueen.test.ts @@ -10,7 +10,7 @@ import { Pawn } from './Pawn'; import { DoubleQueen } from './DoubleQueen'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); @@ -126,7 +126,7 @@ describe('Piece killing', () => { boardId: OVERWORLD_BOARD_ID, }; const otherVictimPiece = new Pawn(blackPlayer, otherVictimPosition); - otherVictimPiece.killCount = 1; + otherVictimPiece.modifiers.killCount = 1; game.setPieces([killerDoubleQueen, otherVictimPiece]); onPlayerAction(killerDoubleQueen, otherVictimPiece); diff --git a/core/development/logic/pieces/DoubleQueen.ts b/core/development/logic/pieces/DoubleQueen.ts index ebf6a124..f193b28e 100644 --- a/core/development/logic/pieces/DoubleQueen.ts +++ b/core/development/logic/pieces/DoubleQueen.ts @@ -2,16 +2,22 @@ import { doubleQueenResource } from '../../ui/Resources'; import { Player } from '../players/Player'; import { getPieceByPosition } from '../Utilities'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class DoubleQueen extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♕x2' : '♛x2'; - super(doubleQueenResource, icon, 'Double Queen', player, position); - - this.moves = 2; - this.price = 8; + super( + new PieceResource(doubleQueenResource, icon, 'Double Queen'), + new PieceStats(2, 1, 8), + new PieceModifiers(), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/Golem.test.ts b/core/development/logic/pieces/Golem.test.ts index e648af38..9407b525 100644 --- a/core/development/logic/pieces/Golem.test.ts +++ b/core/development/logic/pieces/Golem.test.ts @@ -6,7 +6,7 @@ import { Pawn } from './Pawn'; import { Golem } from './Golem'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Golem.ts b/core/development/logic/pieces/Golem.ts index 74fe81ea..a1600d1d 100644 --- a/core/development/logic/pieces/Golem.ts +++ b/core/development/logic/pieces/Golem.ts @@ -1,15 +1,21 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { Position } from '../../../model/types/Position'; import { golemResource } from '../../ui/Resources'; import { Player } from '../players/Player'; import { getPieceByPosition } from '../Utilities'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; export class Golem extends BasePiece { constructor(player: Player, position?: Position) { - super(golemResource, '🗿', 'Golem', player, position); - - this.health = 3; - this.price = 4; + super( + new PieceResource(golemResource, '🗿', 'Golem'), + new PieceStats(1, 3, 4), + new PieceModifiers(), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/King.test.ts b/core/development/logic/pieces/King.test.ts index f966c357..f71dae33 100644 --- a/core/development/logic/pieces/King.test.ts +++ b/core/development/logic/pieces/King.test.ts @@ -5,7 +5,7 @@ import { Player } from '../players/Player'; import { King } from './King'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/King.ts b/core/development/logic/pieces/King.ts index ebfb7120..2cba39e0 100644 --- a/core/development/logic/pieces/King.ts +++ b/core/development/logic/pieces/King.ts @@ -4,14 +4,22 @@ import { getPieceByPosition } from '../Utilities'; import { Rook } from './Rook'; import { game } from '../../Game'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class King extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♔' : '♚'; - - super(kingResource, icon, 'King', player, position); + super( + new PieceResource(kingResource, icon, 'King'), + new PieceStats(1, 1, 1), + new PieceModifiers(), + player, + position + ); } getRookForCastling(player: Player, kingside: boolean): Rook | undefined { @@ -107,12 +115,12 @@ export class King extends BasePiece { } // Check for castling - if (!this.hasMoved) { + if (!this.modifiers.hasMoved) { const kingsideRook = this.getRookForCastling(this.player, true); const queensideRook = this.getRookForCastling(this.player, false); // Kingside castling - if (kingsideRook && !kingsideRook.hasMoved) { + if (kingsideRook && !kingsideRook.modifiers.hasMoved) { const kingsideTargetPosition: Position = { coordinates: [currentCoordinates[0] + 2, currentCoordinates[1]], boardId: this.position.boardId, @@ -124,7 +132,7 @@ export class King extends BasePiece { } // Queenside castling - if (queensideRook && !queensideRook.hasMoved) { + if (queensideRook && !queensideRook.modifiers.hasMoved) { const queensideTargetPosition: Position = { coordinates: [currentCoordinates[0] - 2, currentCoordinates[1]], boardId: this.position.boardId, diff --git a/core/development/logic/pieces/Knight.test.ts b/core/development/logic/pieces/Knight.test.ts index 26111f3c..f114bf0a 100644 --- a/core/development/logic/pieces/Knight.test.ts +++ b/core/development/logic/pieces/Knight.test.ts @@ -6,7 +6,7 @@ import { Knight } from './Knight'; import { Rook } from './Rook'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Knight.ts b/core/development/logic/pieces/Knight.ts index 775d3aae..3b709254 100644 --- a/core/development/logic/pieces/Knight.ts +++ b/core/development/logic/pieces/Knight.ts @@ -2,15 +2,22 @@ import { knightResource } from '../../ui/Resources'; import { Player } from '../players/Player'; import { Unicorn } from './Unicorn'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class Knight extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♘' : '♞'; - super(knightResource, icon, 'Knight', player, position); - - this.upgrades = [Unicorn]; + super( + new PieceResource(knightResource, icon, 'Knight'), + new PieceStats(1, 1, 1), + new PieceModifiers([Unicorn]), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/Pawn.test.ts b/core/development/logic/pieces/Pawn.test.ts index 43c7eaca..dc00e9d7 100644 --- a/core/development/logic/pieces/Pawn.test.ts +++ b/core/development/logic/pieces/Pawn.test.ts @@ -5,8 +5,8 @@ import { Player } from '../players/Player'; import { Pawn } from './Pawn'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; -import { Square } from './types/Square'; +import { Position } from '../../../model/types/Position'; +import { Square } from '../../../model/types/Square'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Pawn.ts b/core/development/logic/pieces/Pawn.ts index 97db2dda..dc638a0c 100644 --- a/core/development/logic/pieces/Pawn.ts +++ b/core/development/logic/pieces/Pawn.ts @@ -3,8 +3,11 @@ import { Player } from '../players/Player'; import { game } from '../../Game'; import { comparePositions, getPieceByPosition } from '../Utilities'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class Pawn extends BasePiece { possibleEnPassantPositions: [Position, Position] | undefined; @@ -13,7 +16,13 @@ export class Pawn extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♙' : '♟'; - super(pawnResource, icon, 'Pawn', player, position); + super( + new PieceResource(pawnResource, icon, 'Pawn'), + new PieceStats(1, 1, 1), + new PieceModifiers(), + player, + position + ); this.possibleEnPassantPositions = undefined; this.isInitialDoubleStep = false; @@ -59,7 +68,7 @@ export class Pawn extends BasePiece { validMoves.push(oneSquareForward); // Check two squares forward for the initial move - if (!this.hasMoved) { + if (!this.modifiers.hasMoved) { const twoSquaresForward: Position = { coordinates: [ currentCoordinates[0], diff --git a/core/development/logic/pieces/Queen.test.ts b/core/development/logic/pieces/Queen.test.ts index 911f6cca..975dba6a 100644 --- a/core/development/logic/pieces/Queen.test.ts +++ b/core/development/logic/pieces/Queen.test.ts @@ -6,7 +6,7 @@ import { Queen } from './Queen'; import { Pawn } from './Pawn'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Queen.ts b/core/development/logic/pieces/Queen.ts index db92f17e..c3535c7e 100644 --- a/core/development/logic/pieces/Queen.ts +++ b/core/development/logic/pieces/Queen.ts @@ -3,15 +3,22 @@ import { Player } from '../players/Player'; import { getPieceByPosition } from '../Utilities'; import { DoubleQueen } from './DoubleQueen'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; export class Queen extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♕' : '♛'; - super(queenResource, icon, 'Queen', player, position); - - this.upgrades = [DoubleQueen]; + super( + new PieceResource(queenResource, icon, 'Queen'), + new PieceStats(1, 1, 1), + new PieceModifiers([DoubleQueen]), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/Rook.test.ts b/core/development/logic/pieces/Rook.test.ts index 6b06a562..dfc9c36c 100644 --- a/core/development/logic/pieces/Rook.test.ts +++ b/core/development/logic/pieces/Rook.test.ts @@ -10,7 +10,7 @@ import { Rook } from './Rook'; import { Pawn } from './Pawn'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); @@ -103,7 +103,7 @@ describe('Piece killing', () => { coordinates: initialKillerPosition.coordinates, boardId: initialKillerPosition.boardId, }); - secondVictimPiece.killCount = 1; + secondVictimPiece.modifiers.killCount = 1; game.setPieces([killerRook, secondVictimPiece]); onPlayerAction(killerRook, secondVictimPiece); diff --git a/core/development/logic/pieces/Rook.ts b/core/development/logic/pieces/Rook.ts index d986ffbc..c7b34bf8 100644 --- a/core/development/logic/pieces/Rook.ts +++ b/core/development/logic/pieces/Rook.ts @@ -3,15 +3,22 @@ import { Player } from '../players/Player'; import { getPieceByPosition } from '../Utilities'; import { Golem } from './Golem'; import { PlayerColor } from '../players/types/PlayerColor'; -import { BasePiece } from './abstract/BasePiece'; -import { Position } from './types/Position'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; export class Rook extends BasePiece { constructor(player: Player, position?: Position) { const icon = player.color === PlayerColor.WHITE ? '♖' : '♜'; - super(rookResource, icon, 'Rook', player, position); - - this.upgrades = [Golem]; + super( + new PieceResource(rookResource, icon, 'Rook'), + new PieceStats(1, 1, 1), + new PieceModifiers([Golem]), + player, + position + ); } getLegalMoves(): Array { diff --git a/core/development/logic/pieces/Unicorn.test.ts b/core/development/logic/pieces/Unicorn.test.ts index c3954a20..6c872f70 100644 --- a/core/development/logic/pieces/Unicorn.test.ts +++ b/core/development/logic/pieces/Unicorn.test.ts @@ -6,7 +6,7 @@ import { Rook } from './Rook'; import { Unicorn } from './Unicorn'; import { PlayerColor } from '../players/types/PlayerColor'; import { PlayerInventory } from '../inventory/PlayerInventory'; -import { Position } from './types/Position'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/pieces/Unicorn.ts b/core/development/logic/pieces/Unicorn.ts index f6839873..dce618c7 100644 --- a/core/development/logic/pieces/Unicorn.ts +++ b/core/development/logic/pieces/Unicorn.ts @@ -1,18 +1,24 @@ +import { PieceModifiers } from '../../../model/pieces/PieceModifiers'; +import { PieceResource } from '../../../model/pieces/PieceResource'; +import { PieceStats } from '../../../model/pieces/PieceStats'; +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; import { unicornResource } from '../../ui/Resources'; -import { BasePiece } from './abstract/BasePiece'; import { getPieceByPosition } from '../Utilities'; -import { Position } from './types/Position'; import { Player } from '../players/Player'; -import { Piece } from './abstract/Piece'; export class Unicorn extends BasePiece { constructor(player: Player, position?: Position) { - super(unicornResource, '🦄', 'Unicorn', player, position); - - this.price = 4; + super( + new PieceResource(unicornResource, '🦄', 'Unicorn'), + new PieceStats(1, 1, 4), + new PieceModifiers(), + player, + position + ); } - getAttackablePieces(): Array { + getAttackablePieces(): Array { if (!this.position) return []; const currentCoordinates = this.position.coordinates; diff --git a/core/development/logic/pieces/abstract/BasePiece.ts b/core/development/logic/pieces/abstract/BasePiece.ts deleted file mode 100644 index 1069be27..00000000 --- a/core/development/logic/pieces/abstract/BasePiece.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Player } from '../../players/Player'; -import { Position } from '../types/Position'; -import { Piece } from './Piece'; - -export abstract class BasePiece implements Piece { - resource: string; - pieceIcon: string; - name: string; - player: Player; - position: Position | undefined; - moves: number; - health: number; - price: number; - isEquipedItem: boolean; - upgrades: Array BasePiece>; - hasMoved: boolean; - killCount: number; - - constructor( - resource: string, - pieceIcon: string, - name: string, - player: Player, - position?: Position, - ) { - this.resource = resource; - this.pieceIcon = pieceIcon; - this.name = name; - this.player = player; - this.position = position; - - this.moves = 1; - this.health = 1; - this.price = 1; - this.isEquipedItem = false; - this.upgrades = []; - this.hasMoved = false; - this.killCount = 0; - } - - abstract getLegalMoves(): Position[]; - - copyPosition(): Position | undefined { - if (!this.position) return; - return { - coordinates: Array.from(this.position.coordinates) as [number, number], - boardId: this.position.boardId, - }; - } -} diff --git a/core/development/logic/pieces/abstract/Piece.ts b/core/development/logic/pieces/abstract/Piece.ts deleted file mode 100644 index 157ca89b..00000000 --- a/core/development/logic/pieces/abstract/Piece.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Position } from '../types/Position'; - -export interface Piece { - getLegalMoves(): Array; -} diff --git a/core/development/logic/rules/BountyRule.ts b/core/development/logic/rules/BountyRule.ts index d782919a..553b8789 100644 --- a/core/development/logic/rules/BountyRule.ts +++ b/core/development/logic/rules/BountyRule.ts @@ -9,7 +9,7 @@ export class BountyRule extends BaseRule { const condition = () => { let result = false; game.getPieces().forEach((piece) => { - if (piece.killCount >= MIN_KILLINGS_FOR_BOUNTY) { + if (piece.modifiers.killCount >= MIN_KILLINGS_FOR_BOUNTY) { result = true; } }); @@ -19,16 +19,10 @@ export class BountyRule extends BaseRule { const onTrigger = () => { game.getPieces().forEach((piece) => { if (!piece.position) return; - if (piece.killCount >= MIN_KILLINGS_FOR_BOUNTY) { - const { - player: { color: playerColor }, - name: pieceName, - position: { coordinates: pieceCoordinates }, - } = piece; + if (piece.modifiers.killCount >= MIN_KILLINGS_FOR_BOUNTY) { + const { player, position, resource } = piece; new RuleLog( - `There is an open bounty on a ${playerColor} ${pieceName} [${pieceCoordinates.join( - ',', - )}].`, + `There is an open bounty on a ${player.color} ${resource.name} [${position.coordinates.join(',')}].`, ).addToQueue(); } }); diff --git a/core/development/logic/rules/ExperienceOnKillRule.test.ts b/core/development/logic/rules/ExperienceOnKillRule.test.ts index e3e04a63..ace1c0f5 100644 --- a/core/development/logic/rules/ExperienceOnKillRule.test.ts +++ b/core/development/logic/rules/ExperienceOnKillRule.test.ts @@ -4,9 +4,9 @@ import { Queen } from '../pieces/Queen'; import { PlayerColor } from '../players/types/PlayerColor'; import { Player } from '../players/Player'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { AttackPieceAction } from '../actions/AttackPieceAction'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); const blackPlayer = new Player(PlayerColor.BLACK, new PlayerInventory()); diff --git a/core/development/logic/rules/FriendlyFireRule.test.ts b/core/development/logic/rules/FriendlyFireRule.test.ts index 03228542..9b16867a 100644 --- a/core/development/logic/rules/FriendlyFireRule.test.ts +++ b/core/development/logic/rules/FriendlyFireRule.test.ts @@ -4,10 +4,10 @@ import { Queen } from '../pieces/Queen'; import { PlayerColor } from '../players/types/PlayerColor'; import { Player } from '../players/Player'; import { Pawn } from '../pieces/Pawn'; -import { Position } from '../pieces/types/Position'; import { OVERWORLD_BOARD_ID } from '../../Constants'; import { AttackPieceAction } from '../actions/AttackPieceAction'; import { ActionResult } from '../actions/types/ActionResult'; +import { Position } from '../../../model/types/Position'; const whitePlayer = new Player(PlayerColor.WHITE, new PlayerInventory()); diff --git a/core/development/logic/validators/PieceMovementSimulationValidator.ts b/core/development/logic/validators/PieceMovementSimulationValidator.ts index c6c27f42..53110a1b 100644 --- a/core/development/logic/validators/PieceMovementSimulationValidator.ts +++ b/core/development/logic/validators/PieceMovementSimulationValidator.ts @@ -1,9 +1,9 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; import { game } from '../../Game'; import { comparePositions } from '../Utilities'; import { TriggerPieceOnItemAction } from '../actions/TriggerPieceOnItemAction'; import { Knight } from '../pieces/Knight'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Position } from '../pieces/types/Position'; import { Validator } from './abstract/Validator'; export class PieceMovementSimulationValidator implements Validator { diff --git a/core/development/logic/validators/PlayerMoveValidator.ts b/core/development/logic/validators/PlayerMoveValidator.ts index d5e74b50..6c3512d6 100644 --- a/core/development/logic/validators/PlayerMoveValidator.ts +++ b/core/development/logic/validators/PlayerMoveValidator.ts @@ -1,8 +1,8 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Square } from '../../../model/types/Square'; import { isPlayerAllowedToAct } from '../PieceLogic'; import { comparePositions } from '../Utilities'; import { BaseItem } from '../items/abstract/Item'; -import { BasePiece } from '../pieces/abstract/BasePiece'; -import { Square } from '../pieces/types/Square'; import { Validator } from './abstract/Validator'; export class PlayerMoveValidator implements Validator { diff --git a/core/development/ui/Board.ts b/core/development/ui/Board.ts index d3681ba2..8ee02a06 100644 --- a/core/development/ui/Board.ts +++ b/core/development/ui/Board.ts @@ -4,8 +4,8 @@ import { comparePositions } from '../logic/Utilities'; import { PiggyBank } from '../logic/items/PiggyBank'; import { BaseItem } from '../logic/items/abstract/Item'; import { initializeDraggingListeners } from './Events'; -import { BasePiece } from '../logic/pieces/abstract/BasePiece'; -import { Position } from '../logic/pieces/types/Position'; +import { Position } from '../../model/types/Position'; +import { BasePiece } from '../../model/pieces/abstract/BasePiece'; export class ChessBoard { boardId: string; @@ -129,11 +129,11 @@ export class ChessBoard { const pieceElement = document.createElement('div'); pieceElement.classList.add('piece'); pieceElement.setAttribute('draggable', 'true'); - pieceElement.setAttribute('id', piece.name); + pieceElement.setAttribute('id', piece.resource.name); pieceElement.classList.add(piece.player.color.toLowerCase()); - pieceElement.innerHTML = piece.resource; + pieceElement.innerHTML = piece.resource.resource; initializeDraggingListeners(pieceElement); diff --git a/core/development/ui/BoardManager.ts b/core/development/ui/BoardManager.ts index 1a378382..2bc6ac84 100644 --- a/core/development/ui/BoardManager.ts +++ b/core/development/ui/BoardManager.ts @@ -21,7 +21,7 @@ import { HIGHLIGHT_LEGAL_MOVE, } from '../Constants'; import { BaseItem } from '../logic/items/abstract/Item'; -import { BasePiece } from '../logic/pieces/abstract/BasePiece'; +import { BasePiece } from '../../model/pieces/abstract/BasePiece'; let overworldBoard: ChessBoard; let hellBoard: ChessBoard; diff --git a/core/development/ui/UpgradeUI.ts b/core/development/ui/UpgradeUI.ts index 79c72cc7..2e5d8fb5 100644 --- a/core/development/ui/UpgradeUI.ts +++ b/core/development/ui/UpgradeUI.ts @@ -1,6 +1,6 @@ +import { BasePiece } from '../../model/pieces/abstract/BasePiece'; import { game } from '../Game'; import { upgradePiece } from '../LogicAdapter'; -import { BasePiece } from '../logic/pieces/abstract/BasePiece'; import { Player } from '../logic/players/Player'; export function showUpgradeablePiecesElements( @@ -15,7 +15,7 @@ export function showUpgradeablePiecesElements( if (upgradeablePieces.length === 0) { const noAvailableUpgradesTextElement = document.createElement('p'); noAvailableUpgradesTextElement.classList.add('piece-upgrades-message'); - noAvailableUpgradesTextElement.innerHTML = `${piece.name} doesn't have any available upgrades.`; + noAvailableUpgradesTextElement.innerHTML = `${piece.resource.name} doesn't have any available upgrades.`; upgradesContainer.appendChild(noAvailableUpgradesTextElement); } else { @@ -25,21 +25,21 @@ export function showUpgradeablePiecesElements( ); const upgradeElement = document.createElement('div'); - upgradeElement.id = upgradeablePiece.name; + upgradeElement.id = upgradeablePiece.resource.name; upgradeElement.classList.add('upgraded-piece'); upgradeElement.classList.add(upgradeablePiece.player.color.toLowerCase()); - upgradeElement.innerHTML = upgradeablePiece.resource; + upgradeElement.innerHTML = upgradeablePiece.resource.resource; upgradeElement.addEventListener('click', () => { upgradePiece(piece, upgradeablePiece); showUpgradeablePiecesElements( upgradeablePiece, - upgradeablePiece.upgrades, + upgradeablePiece.modifiers.upgrades, ); }); const upgradePriceElement = document.createElement('p'); upgradePriceElement.classList.add('piece-upgrade-item-price'); - upgradePriceElement.innerHTML = upgradeablePiece.price.toString(); + upgradePriceElement.innerHTML = upgradeablePiece.stats.price.toString(); const upgradeSquare = document.createElement('div'); upgradeSquare.classList.add('upgrade-square'); diff --git a/core/development/ui/logs/Log.ts b/core/development/ui/logs/Log.ts index 0367fc80..6cfeaf4a 100644 --- a/core/development/ui/logs/Log.ts +++ b/core/development/ui/logs/Log.ts @@ -1,10 +1,10 @@ +import { BasePiece } from '../../../model/pieces/abstract/BasePiece'; +import { Position } from '../../../model/types/Position'; import { HELL_BOARD_ID, NOTATIONS_LETTERS, NOTATIONS_NUMBERS, } from '../../Constants'; -import { BasePiece } from '../../logic/pieces/abstract/BasePiece'; -import { Position } from '../../logic/pieces/types/Position'; import { Logger } from './Logger'; export enum LogColor { @@ -30,7 +30,7 @@ export class Log { export class MovementLog extends Log { constructor(draggedPiece: BasePiece, targetPosition: Position) { - const { position, pieceIcon, player, name } = draggedPiece; + const { resource, player, position } = draggedPiece; const fromNotation = MovementLog.convertPositionToNotation( position?.coordinates, @@ -39,7 +39,7 @@ export class MovementLog extends Log { targetPosition.coordinates, ); - const message = `${pieceIcon} ${player.color} ${name} moved from ${fromNotation} to ${toNotation}.`; + const message = `${resource.pieceIcon} ${player.color} ${resource.name} moved from ${fromNotation} to ${toNotation}.`; super(message, LogColor.MOVEMENT); } @@ -59,13 +59,9 @@ export class MovementLog extends Log { export class KillLog extends Log { constructor(killedPiece: BasePiece, cause: BasePiece | string) { - const { - pieceIcon: killedPieceIcon, - player: { color: killedPieceColor }, - name: killedPieceName, - } = killedPiece; + const { resource, player } = killedPiece; - let message = `${killedPieceIcon} ${killedPieceColor} ${killedPieceName} was `; + let message = `${resource.pieceIcon} ${player.color} ${resource.name} was `; if (!killedPiece.position) { message += 'permanently killed by '; @@ -76,13 +72,9 @@ export class KillLog extends Log { } if (cause instanceof BasePiece) { - const { - pieceIcon: killerPieceIcon, - player: { color: killerPieceColor }, - name: killerPieceName, - } = cause; + const { resource, player } = cause; - message += `${killerPieceIcon} ${killerPieceColor} ${killerPieceName}.`; + message += `${resource.pieceIcon} ${player.color} ${resource.name}.`; } else { message += ` ${cause}.`; } diff --git a/core/model/pieces/PieceModifiers.ts b/core/model/pieces/PieceModifiers.ts new file mode 100644 index 00000000..a2b4cb0d --- /dev/null +++ b/core/model/pieces/PieceModifiers.ts @@ -0,0 +1,11 @@ +import { Player } from '../../development/logic/players/Player'; +import { Position } from '../types/Position'; +import { BasePiece } from './abstract/BasePiece'; + +export class PieceModifiers { + constructor( + public upgrades: Array BasePiece> = [], + public hasMoved = false, + public killCount = 0, + ) {} +} \ No newline at end of file diff --git a/core/model/pieces/PieceResource.ts b/core/model/pieces/PieceResource.ts new file mode 100644 index 00000000..bb1d8695 --- /dev/null +++ b/core/model/pieces/PieceResource.ts @@ -0,0 +1,7 @@ +export class PieceResource { + constructor( + public resource: string, + public pieceIcon: string, + public name: string, + ) {} +} diff --git a/core/model/pieces/PieceStats.ts b/core/model/pieces/PieceStats.ts new file mode 100644 index 00000000..fd716ac6 --- /dev/null +++ b/core/model/pieces/PieceStats.ts @@ -0,0 +1,8 @@ +export class PieceStats { + constructor( + public moves: number, + public health: number, + public price: number, + public isEquippedItem = false, + ) {} +} diff --git a/core/model/pieces/abstract/BasePiece.ts b/core/model/pieces/abstract/BasePiece.ts new file mode 100644 index 00000000..e08e0cb6 --- /dev/null +++ b/core/model/pieces/abstract/BasePiece.ts @@ -0,0 +1,30 @@ +import { Player } from '../../../development/logic/players/Player'; +import { Position } from '../../types/Position'; +import { PieceModifiers } from '../PieceModifiers'; +import { PieceResource } from '../PieceResource'; +import { PieceStats } from '../PieceStats'; +import { PieceBehavior } from './PieceBehavior'; + +export abstract class BasePiece implements PieceBehavior { + public resource: PieceResource; + public stats: PieceStats; + public modifiers: PieceModifiers; + public player: Player; + public position: Position | undefined; + + constructor( + resource: PieceResource, + stats: PieceStats, + modifiers: PieceModifiers, + player: Player, + position?: Position + ) { + this.resource = resource; + this.stats = stats; + this.modifiers = modifiers; + this.player = player; + this.position = position; + } + + abstract getLegalMoves(): Position[]; +} \ No newline at end of file diff --git a/core/model/pieces/abstract/PieceBehavior.ts b/core/model/pieces/abstract/PieceBehavior.ts new file mode 100644 index 00000000..fcabb1c1 --- /dev/null +++ b/core/model/pieces/abstract/PieceBehavior.ts @@ -0,0 +1,5 @@ +import { Position } from '../../types/Position'; + +export interface PieceBehavior { + getLegalMoves(): Position[]; +} \ No newline at end of file diff --git a/core/development/logic/pieces/types/Position.ts b/core/model/types/Position.ts similarity index 100% rename from core/development/logic/pieces/types/Position.ts rename to core/model/types/Position.ts diff --git a/core/development/logic/pieces/types/Square.ts b/core/model/types/Square.ts similarity index 65% rename from core/development/logic/pieces/types/Square.ts rename to core/model/types/Square.ts index 0ad92328..857d60ce 100644 --- a/core/development/logic/pieces/types/Square.ts +++ b/core/model/types/Square.ts @@ -1,4 +1,4 @@ -import { BasePiece } from '../abstract/BasePiece'; +import { BasePiece } from '../pieces/abstract/BasePiece'; import { Position } from './Position'; export type Square = { From 52271b2705185bc58809f0480bbe5bf38ca28884 Mon Sep 17 00:00:00 2001 From: Ido-Barnea Date: Tue, 14 May 2024 17:21:54 +0300 Subject: [PATCH 2/5] Formatting --- core/development/logic/actions/AttackPieceAction.ts | 2 +- core/development/logic/actions/KillPieceAction.ts | 3 ++- core/development/logic/pieces/Bishop.ts | 2 +- core/development/logic/pieces/DoubleQueen.ts | 2 +- core/development/logic/pieces/Golem.ts | 2 +- core/development/logic/pieces/King.ts | 2 +- core/development/logic/pieces/Knight.ts | 2 +- core/development/logic/pieces/Pawn.ts | 2 +- core/development/logic/pieces/Queen.ts | 2 +- core/development/logic/pieces/Rook.ts | 2 +- core/development/logic/pieces/Unicorn.ts | 2 +- core/model/pieces/PieceModifiers.ts | 6 ++++-- core/model/pieces/abstract/BasePiece.ts | 4 ++-- core/model/pieces/abstract/PieceBehavior.ts | 2 +- 14 files changed, 19 insertions(+), 16 deletions(-) diff --git a/core/development/logic/actions/AttackPieceAction.ts b/core/development/logic/actions/AttackPieceAction.ts index 8cbd6aa5..195df9d6 100644 --- a/core/development/logic/actions/AttackPieceAction.ts +++ b/core/development/logic/actions/AttackPieceAction.ts @@ -21,7 +21,7 @@ export class AttackPieceAction implements GameAction { const targetPosition: Position = { coordinates: this.target.position.coordinates, boardId: this.target.position.boardId, - } + }; game.setIsFriendlyFire(this.target.player === this.piece.player); const killPieceByPieceResult = new KillPieceByPieceAction( diff --git a/core/development/logic/actions/KillPieceAction.ts b/core/development/logic/actions/KillPieceAction.ts index d431e48f..77f03a65 100644 --- a/core/development/logic/actions/KillPieceAction.ts +++ b/core/development/logic/actions/KillPieceAction.ts @@ -22,7 +22,8 @@ export class KillPieceAction implements GameAction { if (this.killedPiece.position?.boardId === OVERWORLD_BOARD_ID) { game.increaseDeathCounter(); - const hasPieceKilledOtherPieces = this.killedPiece.modifiers.killCount > 0; + const hasPieceKilledOtherPieces = + this.killedPiece.modifiers.killCount > 0; const isKilledPieceKing = this.killedPiece instanceof King; const pieceOriginBoardId = this.killedPiece.position.boardId; diff --git a/core/development/logic/pieces/Bishop.ts b/core/development/logic/pieces/Bishop.ts index 1f4c5b93..69efd994 100644 --- a/core/development/logic/pieces/Bishop.ts +++ b/core/development/logic/pieces/Bishop.ts @@ -16,7 +16,7 @@ export class Bishop extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers(), player, - position + position, ); } diff --git a/core/development/logic/pieces/DoubleQueen.ts b/core/development/logic/pieces/DoubleQueen.ts index f193b28e..630584f0 100644 --- a/core/development/logic/pieces/DoubleQueen.ts +++ b/core/development/logic/pieces/DoubleQueen.ts @@ -16,7 +16,7 @@ export class DoubleQueen extends BasePiece { new PieceStats(2, 1, 8), new PieceModifiers(), player, - position + position, ); } diff --git a/core/development/logic/pieces/Golem.ts b/core/development/logic/pieces/Golem.ts index a1600d1d..22904190 100644 --- a/core/development/logic/pieces/Golem.ts +++ b/core/development/logic/pieces/Golem.ts @@ -14,7 +14,7 @@ export class Golem extends BasePiece { new PieceStats(1, 3, 4), new PieceModifiers(), player, - position + position, ); } diff --git a/core/development/logic/pieces/King.ts b/core/development/logic/pieces/King.ts index 2cba39e0..e54d97ba 100644 --- a/core/development/logic/pieces/King.ts +++ b/core/development/logic/pieces/King.ts @@ -18,7 +18,7 @@ export class King extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers(), player, - position + position, ); } diff --git a/core/development/logic/pieces/Knight.ts b/core/development/logic/pieces/Knight.ts index 3b709254..374818d9 100644 --- a/core/development/logic/pieces/Knight.ts +++ b/core/development/logic/pieces/Knight.ts @@ -16,7 +16,7 @@ export class Knight extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers([Unicorn]), player, - position + position, ); } diff --git a/core/development/logic/pieces/Pawn.ts b/core/development/logic/pieces/Pawn.ts index dc638a0c..0af292ad 100644 --- a/core/development/logic/pieces/Pawn.ts +++ b/core/development/logic/pieces/Pawn.ts @@ -21,7 +21,7 @@ export class Pawn extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers(), player, - position + position, ); this.possibleEnPassantPositions = undefined; diff --git a/core/development/logic/pieces/Queen.ts b/core/development/logic/pieces/Queen.ts index c3535c7e..5a1ec582 100644 --- a/core/development/logic/pieces/Queen.ts +++ b/core/development/logic/pieces/Queen.ts @@ -17,7 +17,7 @@ export class Queen extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers([DoubleQueen]), player, - position + position, ); } diff --git a/core/development/logic/pieces/Rook.ts b/core/development/logic/pieces/Rook.ts index c7b34bf8..a8d6a0f5 100644 --- a/core/development/logic/pieces/Rook.ts +++ b/core/development/logic/pieces/Rook.ts @@ -17,7 +17,7 @@ export class Rook extends BasePiece { new PieceStats(1, 1, 1), new PieceModifiers([Golem]), player, - position + position, ); } diff --git a/core/development/logic/pieces/Unicorn.ts b/core/development/logic/pieces/Unicorn.ts index dce618c7..55f53325 100644 --- a/core/development/logic/pieces/Unicorn.ts +++ b/core/development/logic/pieces/Unicorn.ts @@ -14,7 +14,7 @@ export class Unicorn extends BasePiece { new PieceStats(1, 1, 4), new PieceModifiers(), player, - position + position, ); } diff --git a/core/model/pieces/PieceModifiers.ts b/core/model/pieces/PieceModifiers.ts index a2b4cb0d..b78affa4 100644 --- a/core/model/pieces/PieceModifiers.ts +++ b/core/model/pieces/PieceModifiers.ts @@ -4,8 +4,10 @@ import { BasePiece } from './abstract/BasePiece'; export class PieceModifiers { constructor( - public upgrades: Array BasePiece> = [], + public upgrades: Array< + new (player: Player, position?: Position) => BasePiece + > = [], public hasMoved = false, public killCount = 0, ) {} -} \ No newline at end of file +} diff --git a/core/model/pieces/abstract/BasePiece.ts b/core/model/pieces/abstract/BasePiece.ts index e08e0cb6..39bdac64 100644 --- a/core/model/pieces/abstract/BasePiece.ts +++ b/core/model/pieces/abstract/BasePiece.ts @@ -17,7 +17,7 @@ export abstract class BasePiece implements PieceBehavior { stats: PieceStats, modifiers: PieceModifiers, player: Player, - position?: Position + position?: Position, ) { this.resource = resource; this.stats = stats; @@ -27,4 +27,4 @@ export abstract class BasePiece implements PieceBehavior { } abstract getLegalMoves(): Position[]; -} \ No newline at end of file +} diff --git a/core/model/pieces/abstract/PieceBehavior.ts b/core/model/pieces/abstract/PieceBehavior.ts index fcabb1c1..b6ab071f 100644 --- a/core/model/pieces/abstract/PieceBehavior.ts +++ b/core/model/pieces/abstract/PieceBehavior.ts @@ -2,4 +2,4 @@ import { Position } from '../../types/Position'; export interface PieceBehavior { getLegalMoves(): Position[]; -} \ No newline at end of file +} From d6e66cf63d7ed3e535c1a9ed4707cbdbba514450 Mon Sep 17 00:00:00 2001 From: Ido-Barnea Date: Tue, 14 May 2024 18:47:56 +0300 Subject: [PATCH 3/5] css file restructure --- core/{views => view}/404.html | 2 +- core/{views => view}/home.html | 2 +- core/{views => view}/room.html | 2 +- core/{ => view}/styles/design/base.css | 0 core/{ => view}/styles/design/components.css | 0 core/{ => view}/styles/design/layout.css | 0 core/{ => view}/styles/design/states.css | 0 core/{ => view}/styles/design/themes.css | 0 core/{ => view}/styles/pages/404.css | 0 core/{ => view}/styles/pages/home.css | 0 core/{ => view}/styles/pages/room.css | 0 server.js | 6 +++--- webpack.config.ts | 20 ++++++++++---------- 13 files changed, 16 insertions(+), 16 deletions(-) rename core/{views => view}/404.html (82%) rename core/{views => view}/home.html (84%) rename core/{views => view}/room.html (96%) rename core/{ => view}/styles/design/base.css (100%) rename core/{ => view}/styles/design/components.css (100%) rename core/{ => view}/styles/design/layout.css (100%) rename core/{ => view}/styles/design/states.css (100%) rename core/{ => view}/styles/design/themes.css (100%) rename core/{ => view}/styles/pages/404.css (100%) rename core/{ => view}/styles/pages/home.css (100%) rename core/{ => view}/styles/pages/room.css (100%) diff --git a/core/views/404.html b/core/view/404.html similarity index 82% rename from core/views/404.html rename to core/view/404.html index d743ce45..834d6596 100644 --- a/core/views/404.html +++ b/core/view/404.html @@ -3,7 +3,7 @@ Chess But Better - +
diff --git a/core/views/home.html b/core/view/home.html similarity index 84% rename from core/views/home.html rename to core/view/home.html index ded9c791..75ae616b 100644 --- a/core/views/home.html +++ b/core/view/home.html @@ -3,7 +3,7 @@ Chess But Better - +
diff --git a/core/views/room.html b/core/view/room.html similarity index 96% rename from core/views/room.html rename to core/view/room.html index 79790c8f..249bec18 100644 --- a/core/views/room.html +++ b/core/view/room.html @@ -3,7 +3,7 @@ Chess But Better - +
diff --git a/core/styles/design/base.css b/core/view/styles/design/base.css similarity index 100% rename from core/styles/design/base.css rename to core/view/styles/design/base.css diff --git a/core/styles/design/components.css b/core/view/styles/design/components.css similarity index 100% rename from core/styles/design/components.css rename to core/view/styles/design/components.css diff --git a/core/styles/design/layout.css b/core/view/styles/design/layout.css similarity index 100% rename from core/styles/design/layout.css rename to core/view/styles/design/layout.css diff --git a/core/styles/design/states.css b/core/view/styles/design/states.css similarity index 100% rename from core/styles/design/states.css rename to core/view/styles/design/states.css diff --git a/core/styles/design/themes.css b/core/view/styles/design/themes.css similarity index 100% rename from core/styles/design/themes.css rename to core/view/styles/design/themes.css diff --git a/core/styles/pages/404.css b/core/view/styles/pages/404.css similarity index 100% rename from core/styles/pages/404.css rename to core/view/styles/pages/404.css diff --git a/core/styles/pages/home.css b/core/view/styles/pages/home.css similarity index 100% rename from core/styles/pages/home.css rename to core/view/styles/pages/home.css diff --git a/core/styles/pages/room.css b/core/view/styles/pages/room.css similarity index 100% rename from core/styles/pages/room.css rename to core/view/styles/pages/room.css diff --git a/server.js b/server.js index 4a8c38ac..85cc8db8 100644 --- a/server.js +++ b/server.js @@ -7,15 +7,15 @@ const PORT = process.env.PORT || 5000; app.use(express.static(path.join(__dirname, 'dist'))); app.get('/', (req, res) => { - res.sendFile(path.join(__dirname, 'dist', 'views', 'home.html')); + res.sendFile(path.join(__dirname, 'dist', 'view', 'home.html')); }); app.get('/room', (req, res) => { - res.sendFile(path.join(__dirname, 'dist', 'views', 'room.html')); + res.sendFile(path.join(__dirname, 'dist', 'view', 'room.html')); }); app.use((req, res, next) => { - res.status(404).sendFile(path.join(__dirname, 'dist', 'views', '404.html')); + res.status(404).sendFile(path.join(__dirname, 'dist', 'view', '404.html')); }); app.listen(PORT, () => { diff --git a/webpack.config.ts b/webpack.config.ts index e171d048..6ec6001c 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -38,25 +38,25 @@ const config: CustomConfiguration = { }, plugins: [ new HtmlWebpackPlugin({ - filename: 'views/home.html', - template: './core/views/home.html', + template: './core/view/home.html', + filename: 'view/home.html', chunks: [], favicon: './assets/images/logo.svg', }), new HtmlWebpackPlugin({ - filename: 'views/room.html', - template: './core/views/room.html', + template: './core/view/room.html', + filename: 'view/room.html', chunks: ['room'], favicon: './assets/images/logo.svg', }), new HtmlWebpackPlugin({ - filename: 'views/404.html', - template: './core/views/404.html', + template: './core/view/404.html', + filename: 'view/404.html', chunks: [], favicon: './assets/images/logo.svg', }), new CopyWebpackPlugin({ - patterns: [{ from: './core/styles', to: 'styles' }], + patterns: [{ from: './core/view/styles', to: 'styles' }], }), ], devServer: { @@ -69,9 +69,9 @@ const config: CustomConfiguration = { }, historyApiFallback: { rewrites: [ - { from: /^\/(home)?$/, to: '/views/home.html' }, - { from: /^\/room$/, to: '/views/room.html' }, - { from: /./, to: '/views/404.html' }, + { from: /^\/(home)?$/, to: '/view/home.html' }, + { from: /^\/room$/, to: '/view/room.html' }, + { from: /./, to: '/view/404.html' }, ], }, }, From 7fb88b4d2c3eddabfe299f07b8d711c8db18e3b7 Mon Sep 17 00:00:00 2001 From: Ido-Barnea Date: Tue, 14 May 2024 18:49:29 +0300 Subject: [PATCH 4/5] reorganized file structure --- core/{ => view}/resources/svgTransform.ts | 0 jest.config.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename core/{ => view}/resources/svgTransform.ts (100%) diff --git a/core/resources/svgTransform.ts b/core/view/resources/svgTransform.ts similarity index 100% rename from core/resources/svgTransform.ts rename to core/view/resources/svgTransform.ts diff --git a/jest.config.ts b/jest.config.ts index 7366e9da..36a124d2 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -6,6 +6,6 @@ export default { testEnvironment: 'node', testMatch: ['/core/**/*.test.ts'], transform: { - '^.+\\.svg$': '/core/resources/svgTransform.ts', + '^.+\\.svg$': '/core/view/resources/svgTransform.ts', }, }; From ac8126e2fe4b13f2c91b0c91140759a57e31d500 Mon Sep 17 00:00:00 2001 From: Ido-Barnea Date: Tue, 14 May 2024 18:51:44 +0300 Subject: [PATCH 5/5] Renamed 'development' to 'controller' --- core/{development => controller}/Constants.ts | 0 core/{development => controller}/Game.ts | 0 core/{development => controller}/LogicAdapter.ts | 0 core/{development => controller}/logic/PieceLogic.ts | 0 core/{development => controller}/logic/Utilities.ts | 0 .../logic/actions/AttackPieceAction.test.ts | 0 .../logic/actions/AttackPieceAction.ts | 0 .../logic/actions/CastleAction.test.ts | 0 core/{development => controller}/logic/actions/CastleAction.ts | 0 .../logic/actions/KillPieceAction.test.ts | 0 .../logic/actions/KillPieceAction.ts | 0 .../logic/actions/KillPieceByEnvironmentAction.test.ts | 0 .../logic/actions/KillPieceByEnvironmentAction.ts | 0 .../logic/actions/KillPieceByFallingOffTheBoardAction.test.ts | 0 .../logic/actions/KillPieceByFallingOffTheBoardAction.ts | 0 .../logic/actions/KillPieceByPieceAction.test.ts | 0 .../logic/actions/KillPieceByPieceAction.ts | 0 .../logic/actions/MovePieceAction.test.ts | 0 .../logic/actions/MovePieceAction.ts | 0 .../logic/actions/PermanentlyKillPieceAction.test.ts | 0 .../logic/actions/PermanentlyKillPieceAction.ts | 0 .../logic/actions/RevertPieceMovementAction.test.ts | 0 .../logic/actions/RevertPieceMovementAction.ts | 0 .../logic/actions/SpawnPieceAction.ts | 0 .../logic/actions/SpawnPieceInHeavenAction.ts | 0 .../logic/actions/SpawnPieceInHellAction.ts | 0 .../logic/actions/TriggerPieceOnItemAction.test.ts | 0 .../logic/actions/TriggerPieceOnItemAction.ts | 0 .../logic/actions/TriggerPieceOnPiggyBankAction.test.ts | 0 .../logic/actions/TriggerPieceOnPiggyBankAction.ts | 0 .../logic/actions/TriggerPieceOnTrapAction.test.ts | 0 .../logic/actions/TriggerPieceOnTrapAction.ts | 0 .../logic/actions/abstract/GameAction.ts | 0 .../logic/actions/types/ActionResult.ts | 0 .../logic/inventory/PlayerInventory.test.ts | 0 .../logic/inventory/PlayerInventory.ts | 0 .../logic/inventory/abstract/ItemsHolder.ts | 0 .../logic/inventory/types/InventoryActionResult.ts | 0 core/{development => controller}/logic/items/PiggyBank.test.ts | 0 core/{development => controller}/logic/items/PiggyBank.ts | 0 core/{development => controller}/logic/items/Shield.test.ts | 0 core/{development => controller}/logic/items/Shield.ts | 0 core/{development => controller}/logic/items/Trap.test.ts | 0 core/{development => controller}/logic/items/Trap.ts | 0 core/{development => controller}/logic/items/abstract/Item.ts | 0 .../logic/items/types/ItemActionResult.ts | 0 core/{development => controller}/logic/pieces/Bishop.test.ts | 0 core/{development => controller}/logic/pieces/Bishop.ts | 0 .../logic/pieces/DoubleQueen.test.ts | 0 core/{development => controller}/logic/pieces/DoubleQueen.ts | 0 core/{development => controller}/logic/pieces/Golem.test.ts | 0 core/{development => controller}/logic/pieces/Golem.ts | 0 core/{development => controller}/logic/pieces/King.test.ts | 0 core/{development => controller}/logic/pieces/King.ts | 0 core/{development => controller}/logic/pieces/Knight.test.ts | 0 core/{development => controller}/logic/pieces/Knight.ts | 0 core/{development => controller}/logic/pieces/Pawn.test.ts | 0 core/{development => controller}/logic/pieces/Pawn.ts | 0 core/{development => controller}/logic/pieces/Queen.test.ts | 0 core/{development => controller}/logic/pieces/Queen.ts | 0 core/{development => controller}/logic/pieces/Rook.test.ts | 0 core/{development => controller}/logic/pieces/Rook.ts | 0 core/{development => controller}/logic/pieces/Unicorn.test.ts | 0 core/{development => controller}/logic/pieces/Unicorn.ts | 0 core/{development => controller}/logic/players/Player.ts | 0 .../logic/players/types/PlayerColor.ts | 0 core/{development => controller}/logic/rules/BountyRule.ts | 0 core/{development => controller}/logic/rules/CoupRule.ts | 0 .../{development => controller}/logic/rules/EmptyPocketsRule.ts | 0 .../logic/rules/ExperienceOnKillRule.test.ts | 0 .../logic/rules/ExperienceOnKillRule.ts | 0 core/{development => controller}/logic/rules/FirstBloodRule.ts | 0 .../logic/rules/FriendlyFireRule.test.ts | 0 .../{development => controller}/logic/rules/FriendlyFireRule.ts | 0 .../logic/rules/PiecesCanFallOffTheBoardRule.ts | 0 core/{development => controller}/logic/rules/RulesManager.ts | 0 .../logic/rules/WithAgeComesWisdomRule.ts | 0 .../logic/rules/abstract/BaseRule.ts | 0 core/{development => controller}/logic/rules/abstract/Rule.ts | 0 core/{development => controller}/logic/shop/ItemsShop.ts | 0 core/{development => controller}/logic/shop/abstract/Shop.ts | 0 .../logic/shop/types/ShopActionResult.ts | 0 .../logic/turn switcher/PlayersTurnSwitcher.ts | 0 .../logic/turn switcher/abstract/TurnSwitcher.ts | 0 .../logic/validators/PieceMovementSimulationValidator.ts | 0 .../logic/validators/PlayerMoveValidator.ts | 0 .../logic/validators/abstract/Validator.ts | 0 core/{development => controller}/pages/Room.ts | 0 core/{development => controller}/ui/Board.ts | 0 core/{development => controller}/ui/BoardManager.ts | 0 core/{development => controller}/ui/Events.ts | 0 core/{development => controller}/ui/InventoriesUI.ts | 0 core/{development => controller}/ui/Resources.ts | 0 core/{development => controller}/ui/Screen.ts | 0 core/{development => controller}/ui/ShopUI.ts | 0 core/{development => controller}/ui/UpgradeUI.ts | 0 core/{development => controller}/ui/logs/Log.ts | 0 core/{development => controller}/ui/logs/Logger.ts | 0 core/model/pieces/PieceModifiers.ts | 2 +- core/model/pieces/abstract/BasePiece.ts | 2 +- webpack.config.ts | 2 +- 101 files changed, 3 insertions(+), 3 deletions(-) rename core/{development => controller}/Constants.ts (100%) rename core/{development => controller}/Game.ts (100%) rename core/{development => controller}/LogicAdapter.ts (100%) rename core/{development => controller}/logic/PieceLogic.ts (100%) rename core/{development => controller}/logic/Utilities.ts (100%) rename core/{development => controller}/logic/actions/AttackPieceAction.test.ts (100%) rename core/{development => controller}/logic/actions/AttackPieceAction.ts (100%) rename core/{development => controller}/logic/actions/CastleAction.test.ts (100%) rename core/{development => controller}/logic/actions/CastleAction.ts (100%) rename core/{development => controller}/logic/actions/KillPieceAction.test.ts (100%) rename core/{development => controller}/logic/actions/KillPieceAction.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByEnvironmentAction.test.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByEnvironmentAction.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByFallingOffTheBoardAction.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByPieceAction.test.ts (100%) rename core/{development => controller}/logic/actions/KillPieceByPieceAction.ts (100%) rename core/{development => controller}/logic/actions/MovePieceAction.test.ts (100%) rename core/{development => controller}/logic/actions/MovePieceAction.ts (100%) rename core/{development => controller}/logic/actions/PermanentlyKillPieceAction.test.ts (100%) rename core/{development => controller}/logic/actions/PermanentlyKillPieceAction.ts (100%) rename core/{development => controller}/logic/actions/RevertPieceMovementAction.test.ts (100%) rename core/{development => controller}/logic/actions/RevertPieceMovementAction.ts (100%) rename core/{development => controller}/logic/actions/SpawnPieceAction.ts (100%) rename core/{development => controller}/logic/actions/SpawnPieceInHeavenAction.ts (100%) rename core/{development => controller}/logic/actions/SpawnPieceInHellAction.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnItemAction.test.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnItemAction.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnPiggyBankAction.test.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnPiggyBankAction.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnTrapAction.test.ts (100%) rename core/{development => controller}/logic/actions/TriggerPieceOnTrapAction.ts (100%) rename core/{development => controller}/logic/actions/abstract/GameAction.ts (100%) rename core/{development => controller}/logic/actions/types/ActionResult.ts (100%) rename core/{development => controller}/logic/inventory/PlayerInventory.test.ts (100%) rename core/{development => controller}/logic/inventory/PlayerInventory.ts (100%) rename core/{development => controller}/logic/inventory/abstract/ItemsHolder.ts (100%) rename core/{development => controller}/logic/inventory/types/InventoryActionResult.ts (100%) rename core/{development => controller}/logic/items/PiggyBank.test.ts (100%) rename core/{development => controller}/logic/items/PiggyBank.ts (100%) rename core/{development => controller}/logic/items/Shield.test.ts (100%) rename core/{development => controller}/logic/items/Shield.ts (100%) rename core/{development => controller}/logic/items/Trap.test.ts (100%) rename core/{development => controller}/logic/items/Trap.ts (100%) rename core/{development => controller}/logic/items/abstract/Item.ts (100%) rename core/{development => controller}/logic/items/types/ItemActionResult.ts (100%) rename core/{development => controller}/logic/pieces/Bishop.test.ts (100%) rename core/{development => controller}/logic/pieces/Bishop.ts (100%) rename core/{development => controller}/logic/pieces/DoubleQueen.test.ts (100%) rename core/{development => controller}/logic/pieces/DoubleQueen.ts (100%) rename core/{development => controller}/logic/pieces/Golem.test.ts (100%) rename core/{development => controller}/logic/pieces/Golem.ts (100%) rename core/{development => controller}/logic/pieces/King.test.ts (100%) rename core/{development => controller}/logic/pieces/King.ts (100%) rename core/{development => controller}/logic/pieces/Knight.test.ts (100%) rename core/{development => controller}/logic/pieces/Knight.ts (100%) rename core/{development => controller}/logic/pieces/Pawn.test.ts (100%) rename core/{development => controller}/logic/pieces/Pawn.ts (100%) rename core/{development => controller}/logic/pieces/Queen.test.ts (100%) rename core/{development => controller}/logic/pieces/Queen.ts (100%) rename core/{development => controller}/logic/pieces/Rook.test.ts (100%) rename core/{development => controller}/logic/pieces/Rook.ts (100%) rename core/{development => controller}/logic/pieces/Unicorn.test.ts (100%) rename core/{development => controller}/logic/pieces/Unicorn.ts (100%) rename core/{development => controller}/logic/players/Player.ts (100%) rename core/{development => controller}/logic/players/types/PlayerColor.ts (100%) rename core/{development => controller}/logic/rules/BountyRule.ts (100%) rename core/{development => controller}/logic/rules/CoupRule.ts (100%) rename core/{development => controller}/logic/rules/EmptyPocketsRule.ts (100%) rename core/{development => controller}/logic/rules/ExperienceOnKillRule.test.ts (100%) rename core/{development => controller}/logic/rules/ExperienceOnKillRule.ts (100%) rename core/{development => controller}/logic/rules/FirstBloodRule.ts (100%) rename core/{development => controller}/logic/rules/FriendlyFireRule.test.ts (100%) rename core/{development => controller}/logic/rules/FriendlyFireRule.ts (100%) rename core/{development => controller}/logic/rules/PiecesCanFallOffTheBoardRule.ts (100%) rename core/{development => controller}/logic/rules/RulesManager.ts (100%) rename core/{development => controller}/logic/rules/WithAgeComesWisdomRule.ts (100%) rename core/{development => controller}/logic/rules/abstract/BaseRule.ts (100%) rename core/{development => controller}/logic/rules/abstract/Rule.ts (100%) rename core/{development => controller}/logic/shop/ItemsShop.ts (100%) rename core/{development => controller}/logic/shop/abstract/Shop.ts (100%) rename core/{development => controller}/logic/shop/types/ShopActionResult.ts (100%) rename core/{development => controller}/logic/turn switcher/PlayersTurnSwitcher.ts (100%) rename core/{development => controller}/logic/turn switcher/abstract/TurnSwitcher.ts (100%) rename core/{development => controller}/logic/validators/PieceMovementSimulationValidator.ts (100%) rename core/{development => controller}/logic/validators/PlayerMoveValidator.ts (100%) rename core/{development => controller}/logic/validators/abstract/Validator.ts (100%) rename core/{development => controller}/pages/Room.ts (100%) rename core/{development => controller}/ui/Board.ts (100%) rename core/{development => controller}/ui/BoardManager.ts (100%) rename core/{development => controller}/ui/Events.ts (100%) rename core/{development => controller}/ui/InventoriesUI.ts (100%) rename core/{development => controller}/ui/Resources.ts (100%) rename core/{development => controller}/ui/Screen.ts (100%) rename core/{development => controller}/ui/ShopUI.ts (100%) rename core/{development => controller}/ui/UpgradeUI.ts (100%) rename core/{development => controller}/ui/logs/Log.ts (100%) rename core/{development => controller}/ui/logs/Logger.ts (100%) diff --git a/core/development/Constants.ts b/core/controller/Constants.ts similarity index 100% rename from core/development/Constants.ts rename to core/controller/Constants.ts diff --git a/core/development/Game.ts b/core/controller/Game.ts similarity index 100% rename from core/development/Game.ts rename to core/controller/Game.ts diff --git a/core/development/LogicAdapter.ts b/core/controller/LogicAdapter.ts similarity index 100% rename from core/development/LogicAdapter.ts rename to core/controller/LogicAdapter.ts diff --git a/core/development/logic/PieceLogic.ts b/core/controller/logic/PieceLogic.ts similarity index 100% rename from core/development/logic/PieceLogic.ts rename to core/controller/logic/PieceLogic.ts diff --git a/core/development/logic/Utilities.ts b/core/controller/logic/Utilities.ts similarity index 100% rename from core/development/logic/Utilities.ts rename to core/controller/logic/Utilities.ts diff --git a/core/development/logic/actions/AttackPieceAction.test.ts b/core/controller/logic/actions/AttackPieceAction.test.ts similarity index 100% rename from core/development/logic/actions/AttackPieceAction.test.ts rename to core/controller/logic/actions/AttackPieceAction.test.ts diff --git a/core/development/logic/actions/AttackPieceAction.ts b/core/controller/logic/actions/AttackPieceAction.ts similarity index 100% rename from core/development/logic/actions/AttackPieceAction.ts rename to core/controller/logic/actions/AttackPieceAction.ts diff --git a/core/development/logic/actions/CastleAction.test.ts b/core/controller/logic/actions/CastleAction.test.ts similarity index 100% rename from core/development/logic/actions/CastleAction.test.ts rename to core/controller/logic/actions/CastleAction.test.ts diff --git a/core/development/logic/actions/CastleAction.ts b/core/controller/logic/actions/CastleAction.ts similarity index 100% rename from core/development/logic/actions/CastleAction.ts rename to core/controller/logic/actions/CastleAction.ts diff --git a/core/development/logic/actions/KillPieceAction.test.ts b/core/controller/logic/actions/KillPieceAction.test.ts similarity index 100% rename from core/development/logic/actions/KillPieceAction.test.ts rename to core/controller/logic/actions/KillPieceAction.test.ts diff --git a/core/development/logic/actions/KillPieceAction.ts b/core/controller/logic/actions/KillPieceAction.ts similarity index 100% rename from core/development/logic/actions/KillPieceAction.ts rename to core/controller/logic/actions/KillPieceAction.ts diff --git a/core/development/logic/actions/KillPieceByEnvironmentAction.test.ts b/core/controller/logic/actions/KillPieceByEnvironmentAction.test.ts similarity index 100% rename from core/development/logic/actions/KillPieceByEnvironmentAction.test.ts rename to core/controller/logic/actions/KillPieceByEnvironmentAction.test.ts diff --git a/core/development/logic/actions/KillPieceByEnvironmentAction.ts b/core/controller/logic/actions/KillPieceByEnvironmentAction.ts similarity index 100% rename from core/development/logic/actions/KillPieceByEnvironmentAction.ts rename to core/controller/logic/actions/KillPieceByEnvironmentAction.ts diff --git a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts b/core/controller/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts similarity index 100% rename from core/development/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts rename to core/controller/logic/actions/KillPieceByFallingOffTheBoardAction.test.ts diff --git a/core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts b/core/controller/logic/actions/KillPieceByFallingOffTheBoardAction.ts similarity index 100% rename from core/development/logic/actions/KillPieceByFallingOffTheBoardAction.ts rename to core/controller/logic/actions/KillPieceByFallingOffTheBoardAction.ts diff --git a/core/development/logic/actions/KillPieceByPieceAction.test.ts b/core/controller/logic/actions/KillPieceByPieceAction.test.ts similarity index 100% rename from core/development/logic/actions/KillPieceByPieceAction.test.ts rename to core/controller/logic/actions/KillPieceByPieceAction.test.ts diff --git a/core/development/logic/actions/KillPieceByPieceAction.ts b/core/controller/logic/actions/KillPieceByPieceAction.ts similarity index 100% rename from core/development/logic/actions/KillPieceByPieceAction.ts rename to core/controller/logic/actions/KillPieceByPieceAction.ts diff --git a/core/development/logic/actions/MovePieceAction.test.ts b/core/controller/logic/actions/MovePieceAction.test.ts similarity index 100% rename from core/development/logic/actions/MovePieceAction.test.ts rename to core/controller/logic/actions/MovePieceAction.test.ts diff --git a/core/development/logic/actions/MovePieceAction.ts b/core/controller/logic/actions/MovePieceAction.ts similarity index 100% rename from core/development/logic/actions/MovePieceAction.ts rename to core/controller/logic/actions/MovePieceAction.ts diff --git a/core/development/logic/actions/PermanentlyKillPieceAction.test.ts b/core/controller/logic/actions/PermanentlyKillPieceAction.test.ts similarity index 100% rename from core/development/logic/actions/PermanentlyKillPieceAction.test.ts rename to core/controller/logic/actions/PermanentlyKillPieceAction.test.ts diff --git a/core/development/logic/actions/PermanentlyKillPieceAction.ts b/core/controller/logic/actions/PermanentlyKillPieceAction.ts similarity index 100% rename from core/development/logic/actions/PermanentlyKillPieceAction.ts rename to core/controller/logic/actions/PermanentlyKillPieceAction.ts diff --git a/core/development/logic/actions/RevertPieceMovementAction.test.ts b/core/controller/logic/actions/RevertPieceMovementAction.test.ts similarity index 100% rename from core/development/logic/actions/RevertPieceMovementAction.test.ts rename to core/controller/logic/actions/RevertPieceMovementAction.test.ts diff --git a/core/development/logic/actions/RevertPieceMovementAction.ts b/core/controller/logic/actions/RevertPieceMovementAction.ts similarity index 100% rename from core/development/logic/actions/RevertPieceMovementAction.ts rename to core/controller/logic/actions/RevertPieceMovementAction.ts diff --git a/core/development/logic/actions/SpawnPieceAction.ts b/core/controller/logic/actions/SpawnPieceAction.ts similarity index 100% rename from core/development/logic/actions/SpawnPieceAction.ts rename to core/controller/logic/actions/SpawnPieceAction.ts diff --git a/core/development/logic/actions/SpawnPieceInHeavenAction.ts b/core/controller/logic/actions/SpawnPieceInHeavenAction.ts similarity index 100% rename from core/development/logic/actions/SpawnPieceInHeavenAction.ts rename to core/controller/logic/actions/SpawnPieceInHeavenAction.ts diff --git a/core/development/logic/actions/SpawnPieceInHellAction.ts b/core/controller/logic/actions/SpawnPieceInHellAction.ts similarity index 100% rename from core/development/logic/actions/SpawnPieceInHellAction.ts rename to core/controller/logic/actions/SpawnPieceInHellAction.ts diff --git a/core/development/logic/actions/TriggerPieceOnItemAction.test.ts b/core/controller/logic/actions/TriggerPieceOnItemAction.test.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnItemAction.test.ts rename to core/controller/logic/actions/TriggerPieceOnItemAction.test.ts diff --git a/core/development/logic/actions/TriggerPieceOnItemAction.ts b/core/controller/logic/actions/TriggerPieceOnItemAction.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnItemAction.ts rename to core/controller/logic/actions/TriggerPieceOnItemAction.ts diff --git a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts b/core/controller/logic/actions/TriggerPieceOnPiggyBankAction.test.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnPiggyBankAction.test.ts rename to core/controller/logic/actions/TriggerPieceOnPiggyBankAction.test.ts diff --git a/core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts b/core/controller/logic/actions/TriggerPieceOnPiggyBankAction.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnPiggyBankAction.ts rename to core/controller/logic/actions/TriggerPieceOnPiggyBankAction.ts diff --git a/core/development/logic/actions/TriggerPieceOnTrapAction.test.ts b/core/controller/logic/actions/TriggerPieceOnTrapAction.test.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnTrapAction.test.ts rename to core/controller/logic/actions/TriggerPieceOnTrapAction.test.ts diff --git a/core/development/logic/actions/TriggerPieceOnTrapAction.ts b/core/controller/logic/actions/TriggerPieceOnTrapAction.ts similarity index 100% rename from core/development/logic/actions/TriggerPieceOnTrapAction.ts rename to core/controller/logic/actions/TriggerPieceOnTrapAction.ts diff --git a/core/development/logic/actions/abstract/GameAction.ts b/core/controller/logic/actions/abstract/GameAction.ts similarity index 100% rename from core/development/logic/actions/abstract/GameAction.ts rename to core/controller/logic/actions/abstract/GameAction.ts diff --git a/core/development/logic/actions/types/ActionResult.ts b/core/controller/logic/actions/types/ActionResult.ts similarity index 100% rename from core/development/logic/actions/types/ActionResult.ts rename to core/controller/logic/actions/types/ActionResult.ts diff --git a/core/development/logic/inventory/PlayerInventory.test.ts b/core/controller/logic/inventory/PlayerInventory.test.ts similarity index 100% rename from core/development/logic/inventory/PlayerInventory.test.ts rename to core/controller/logic/inventory/PlayerInventory.test.ts diff --git a/core/development/logic/inventory/PlayerInventory.ts b/core/controller/logic/inventory/PlayerInventory.ts similarity index 100% rename from core/development/logic/inventory/PlayerInventory.ts rename to core/controller/logic/inventory/PlayerInventory.ts diff --git a/core/development/logic/inventory/abstract/ItemsHolder.ts b/core/controller/logic/inventory/abstract/ItemsHolder.ts similarity index 100% rename from core/development/logic/inventory/abstract/ItemsHolder.ts rename to core/controller/logic/inventory/abstract/ItemsHolder.ts diff --git a/core/development/logic/inventory/types/InventoryActionResult.ts b/core/controller/logic/inventory/types/InventoryActionResult.ts similarity index 100% rename from core/development/logic/inventory/types/InventoryActionResult.ts rename to core/controller/logic/inventory/types/InventoryActionResult.ts diff --git a/core/development/logic/items/PiggyBank.test.ts b/core/controller/logic/items/PiggyBank.test.ts similarity index 100% rename from core/development/logic/items/PiggyBank.test.ts rename to core/controller/logic/items/PiggyBank.test.ts diff --git a/core/development/logic/items/PiggyBank.ts b/core/controller/logic/items/PiggyBank.ts similarity index 100% rename from core/development/logic/items/PiggyBank.ts rename to core/controller/logic/items/PiggyBank.ts diff --git a/core/development/logic/items/Shield.test.ts b/core/controller/logic/items/Shield.test.ts similarity index 100% rename from core/development/logic/items/Shield.test.ts rename to core/controller/logic/items/Shield.test.ts diff --git a/core/development/logic/items/Shield.ts b/core/controller/logic/items/Shield.ts similarity index 100% rename from core/development/logic/items/Shield.ts rename to core/controller/logic/items/Shield.ts diff --git a/core/development/logic/items/Trap.test.ts b/core/controller/logic/items/Trap.test.ts similarity index 100% rename from core/development/logic/items/Trap.test.ts rename to core/controller/logic/items/Trap.test.ts diff --git a/core/development/logic/items/Trap.ts b/core/controller/logic/items/Trap.ts similarity index 100% rename from core/development/logic/items/Trap.ts rename to core/controller/logic/items/Trap.ts diff --git a/core/development/logic/items/abstract/Item.ts b/core/controller/logic/items/abstract/Item.ts similarity index 100% rename from core/development/logic/items/abstract/Item.ts rename to core/controller/logic/items/abstract/Item.ts diff --git a/core/development/logic/items/types/ItemActionResult.ts b/core/controller/logic/items/types/ItemActionResult.ts similarity index 100% rename from core/development/logic/items/types/ItemActionResult.ts rename to core/controller/logic/items/types/ItemActionResult.ts diff --git a/core/development/logic/pieces/Bishop.test.ts b/core/controller/logic/pieces/Bishop.test.ts similarity index 100% rename from core/development/logic/pieces/Bishop.test.ts rename to core/controller/logic/pieces/Bishop.test.ts diff --git a/core/development/logic/pieces/Bishop.ts b/core/controller/logic/pieces/Bishop.ts similarity index 100% rename from core/development/logic/pieces/Bishop.ts rename to core/controller/logic/pieces/Bishop.ts diff --git a/core/development/logic/pieces/DoubleQueen.test.ts b/core/controller/logic/pieces/DoubleQueen.test.ts similarity index 100% rename from core/development/logic/pieces/DoubleQueen.test.ts rename to core/controller/logic/pieces/DoubleQueen.test.ts diff --git a/core/development/logic/pieces/DoubleQueen.ts b/core/controller/logic/pieces/DoubleQueen.ts similarity index 100% rename from core/development/logic/pieces/DoubleQueen.ts rename to core/controller/logic/pieces/DoubleQueen.ts diff --git a/core/development/logic/pieces/Golem.test.ts b/core/controller/logic/pieces/Golem.test.ts similarity index 100% rename from core/development/logic/pieces/Golem.test.ts rename to core/controller/logic/pieces/Golem.test.ts diff --git a/core/development/logic/pieces/Golem.ts b/core/controller/logic/pieces/Golem.ts similarity index 100% rename from core/development/logic/pieces/Golem.ts rename to core/controller/logic/pieces/Golem.ts diff --git a/core/development/logic/pieces/King.test.ts b/core/controller/logic/pieces/King.test.ts similarity index 100% rename from core/development/logic/pieces/King.test.ts rename to core/controller/logic/pieces/King.test.ts diff --git a/core/development/logic/pieces/King.ts b/core/controller/logic/pieces/King.ts similarity index 100% rename from core/development/logic/pieces/King.ts rename to core/controller/logic/pieces/King.ts diff --git a/core/development/logic/pieces/Knight.test.ts b/core/controller/logic/pieces/Knight.test.ts similarity index 100% rename from core/development/logic/pieces/Knight.test.ts rename to core/controller/logic/pieces/Knight.test.ts diff --git a/core/development/logic/pieces/Knight.ts b/core/controller/logic/pieces/Knight.ts similarity index 100% rename from core/development/logic/pieces/Knight.ts rename to core/controller/logic/pieces/Knight.ts diff --git a/core/development/logic/pieces/Pawn.test.ts b/core/controller/logic/pieces/Pawn.test.ts similarity index 100% rename from core/development/logic/pieces/Pawn.test.ts rename to core/controller/logic/pieces/Pawn.test.ts diff --git a/core/development/logic/pieces/Pawn.ts b/core/controller/logic/pieces/Pawn.ts similarity index 100% rename from core/development/logic/pieces/Pawn.ts rename to core/controller/logic/pieces/Pawn.ts diff --git a/core/development/logic/pieces/Queen.test.ts b/core/controller/logic/pieces/Queen.test.ts similarity index 100% rename from core/development/logic/pieces/Queen.test.ts rename to core/controller/logic/pieces/Queen.test.ts diff --git a/core/development/logic/pieces/Queen.ts b/core/controller/logic/pieces/Queen.ts similarity index 100% rename from core/development/logic/pieces/Queen.ts rename to core/controller/logic/pieces/Queen.ts diff --git a/core/development/logic/pieces/Rook.test.ts b/core/controller/logic/pieces/Rook.test.ts similarity index 100% rename from core/development/logic/pieces/Rook.test.ts rename to core/controller/logic/pieces/Rook.test.ts diff --git a/core/development/logic/pieces/Rook.ts b/core/controller/logic/pieces/Rook.ts similarity index 100% rename from core/development/logic/pieces/Rook.ts rename to core/controller/logic/pieces/Rook.ts diff --git a/core/development/logic/pieces/Unicorn.test.ts b/core/controller/logic/pieces/Unicorn.test.ts similarity index 100% rename from core/development/logic/pieces/Unicorn.test.ts rename to core/controller/logic/pieces/Unicorn.test.ts diff --git a/core/development/logic/pieces/Unicorn.ts b/core/controller/logic/pieces/Unicorn.ts similarity index 100% rename from core/development/logic/pieces/Unicorn.ts rename to core/controller/logic/pieces/Unicorn.ts diff --git a/core/development/logic/players/Player.ts b/core/controller/logic/players/Player.ts similarity index 100% rename from core/development/logic/players/Player.ts rename to core/controller/logic/players/Player.ts diff --git a/core/development/logic/players/types/PlayerColor.ts b/core/controller/logic/players/types/PlayerColor.ts similarity index 100% rename from core/development/logic/players/types/PlayerColor.ts rename to core/controller/logic/players/types/PlayerColor.ts diff --git a/core/development/logic/rules/BountyRule.ts b/core/controller/logic/rules/BountyRule.ts similarity index 100% rename from core/development/logic/rules/BountyRule.ts rename to core/controller/logic/rules/BountyRule.ts diff --git a/core/development/logic/rules/CoupRule.ts b/core/controller/logic/rules/CoupRule.ts similarity index 100% rename from core/development/logic/rules/CoupRule.ts rename to core/controller/logic/rules/CoupRule.ts diff --git a/core/development/logic/rules/EmptyPocketsRule.ts b/core/controller/logic/rules/EmptyPocketsRule.ts similarity index 100% rename from core/development/logic/rules/EmptyPocketsRule.ts rename to core/controller/logic/rules/EmptyPocketsRule.ts diff --git a/core/development/logic/rules/ExperienceOnKillRule.test.ts b/core/controller/logic/rules/ExperienceOnKillRule.test.ts similarity index 100% rename from core/development/logic/rules/ExperienceOnKillRule.test.ts rename to core/controller/logic/rules/ExperienceOnKillRule.test.ts diff --git a/core/development/logic/rules/ExperienceOnKillRule.ts b/core/controller/logic/rules/ExperienceOnKillRule.ts similarity index 100% rename from core/development/logic/rules/ExperienceOnKillRule.ts rename to core/controller/logic/rules/ExperienceOnKillRule.ts diff --git a/core/development/logic/rules/FirstBloodRule.ts b/core/controller/logic/rules/FirstBloodRule.ts similarity index 100% rename from core/development/logic/rules/FirstBloodRule.ts rename to core/controller/logic/rules/FirstBloodRule.ts diff --git a/core/development/logic/rules/FriendlyFireRule.test.ts b/core/controller/logic/rules/FriendlyFireRule.test.ts similarity index 100% rename from core/development/logic/rules/FriendlyFireRule.test.ts rename to core/controller/logic/rules/FriendlyFireRule.test.ts diff --git a/core/development/logic/rules/FriendlyFireRule.ts b/core/controller/logic/rules/FriendlyFireRule.ts similarity index 100% rename from core/development/logic/rules/FriendlyFireRule.ts rename to core/controller/logic/rules/FriendlyFireRule.ts diff --git a/core/development/logic/rules/PiecesCanFallOffTheBoardRule.ts b/core/controller/logic/rules/PiecesCanFallOffTheBoardRule.ts similarity index 100% rename from core/development/logic/rules/PiecesCanFallOffTheBoardRule.ts rename to core/controller/logic/rules/PiecesCanFallOffTheBoardRule.ts diff --git a/core/development/logic/rules/RulesManager.ts b/core/controller/logic/rules/RulesManager.ts similarity index 100% rename from core/development/logic/rules/RulesManager.ts rename to core/controller/logic/rules/RulesManager.ts diff --git a/core/development/logic/rules/WithAgeComesWisdomRule.ts b/core/controller/logic/rules/WithAgeComesWisdomRule.ts similarity index 100% rename from core/development/logic/rules/WithAgeComesWisdomRule.ts rename to core/controller/logic/rules/WithAgeComesWisdomRule.ts diff --git a/core/development/logic/rules/abstract/BaseRule.ts b/core/controller/logic/rules/abstract/BaseRule.ts similarity index 100% rename from core/development/logic/rules/abstract/BaseRule.ts rename to core/controller/logic/rules/abstract/BaseRule.ts diff --git a/core/development/logic/rules/abstract/Rule.ts b/core/controller/logic/rules/abstract/Rule.ts similarity index 100% rename from core/development/logic/rules/abstract/Rule.ts rename to core/controller/logic/rules/abstract/Rule.ts diff --git a/core/development/logic/shop/ItemsShop.ts b/core/controller/logic/shop/ItemsShop.ts similarity index 100% rename from core/development/logic/shop/ItemsShop.ts rename to core/controller/logic/shop/ItemsShop.ts diff --git a/core/development/logic/shop/abstract/Shop.ts b/core/controller/logic/shop/abstract/Shop.ts similarity index 100% rename from core/development/logic/shop/abstract/Shop.ts rename to core/controller/logic/shop/abstract/Shop.ts diff --git a/core/development/logic/shop/types/ShopActionResult.ts b/core/controller/logic/shop/types/ShopActionResult.ts similarity index 100% rename from core/development/logic/shop/types/ShopActionResult.ts rename to core/controller/logic/shop/types/ShopActionResult.ts diff --git a/core/development/logic/turn switcher/PlayersTurnSwitcher.ts b/core/controller/logic/turn switcher/PlayersTurnSwitcher.ts similarity index 100% rename from core/development/logic/turn switcher/PlayersTurnSwitcher.ts rename to core/controller/logic/turn switcher/PlayersTurnSwitcher.ts diff --git a/core/development/logic/turn switcher/abstract/TurnSwitcher.ts b/core/controller/logic/turn switcher/abstract/TurnSwitcher.ts similarity index 100% rename from core/development/logic/turn switcher/abstract/TurnSwitcher.ts rename to core/controller/logic/turn switcher/abstract/TurnSwitcher.ts diff --git a/core/development/logic/validators/PieceMovementSimulationValidator.ts b/core/controller/logic/validators/PieceMovementSimulationValidator.ts similarity index 100% rename from core/development/logic/validators/PieceMovementSimulationValidator.ts rename to core/controller/logic/validators/PieceMovementSimulationValidator.ts diff --git a/core/development/logic/validators/PlayerMoveValidator.ts b/core/controller/logic/validators/PlayerMoveValidator.ts similarity index 100% rename from core/development/logic/validators/PlayerMoveValidator.ts rename to core/controller/logic/validators/PlayerMoveValidator.ts diff --git a/core/development/logic/validators/abstract/Validator.ts b/core/controller/logic/validators/abstract/Validator.ts similarity index 100% rename from core/development/logic/validators/abstract/Validator.ts rename to core/controller/logic/validators/abstract/Validator.ts diff --git a/core/development/pages/Room.ts b/core/controller/pages/Room.ts similarity index 100% rename from core/development/pages/Room.ts rename to core/controller/pages/Room.ts diff --git a/core/development/ui/Board.ts b/core/controller/ui/Board.ts similarity index 100% rename from core/development/ui/Board.ts rename to core/controller/ui/Board.ts diff --git a/core/development/ui/BoardManager.ts b/core/controller/ui/BoardManager.ts similarity index 100% rename from core/development/ui/BoardManager.ts rename to core/controller/ui/BoardManager.ts diff --git a/core/development/ui/Events.ts b/core/controller/ui/Events.ts similarity index 100% rename from core/development/ui/Events.ts rename to core/controller/ui/Events.ts diff --git a/core/development/ui/InventoriesUI.ts b/core/controller/ui/InventoriesUI.ts similarity index 100% rename from core/development/ui/InventoriesUI.ts rename to core/controller/ui/InventoriesUI.ts diff --git a/core/development/ui/Resources.ts b/core/controller/ui/Resources.ts similarity index 100% rename from core/development/ui/Resources.ts rename to core/controller/ui/Resources.ts diff --git a/core/development/ui/Screen.ts b/core/controller/ui/Screen.ts similarity index 100% rename from core/development/ui/Screen.ts rename to core/controller/ui/Screen.ts diff --git a/core/development/ui/ShopUI.ts b/core/controller/ui/ShopUI.ts similarity index 100% rename from core/development/ui/ShopUI.ts rename to core/controller/ui/ShopUI.ts diff --git a/core/development/ui/UpgradeUI.ts b/core/controller/ui/UpgradeUI.ts similarity index 100% rename from core/development/ui/UpgradeUI.ts rename to core/controller/ui/UpgradeUI.ts diff --git a/core/development/ui/logs/Log.ts b/core/controller/ui/logs/Log.ts similarity index 100% rename from core/development/ui/logs/Log.ts rename to core/controller/ui/logs/Log.ts diff --git a/core/development/ui/logs/Logger.ts b/core/controller/ui/logs/Logger.ts similarity index 100% rename from core/development/ui/logs/Logger.ts rename to core/controller/ui/logs/Logger.ts diff --git a/core/model/pieces/PieceModifiers.ts b/core/model/pieces/PieceModifiers.ts index b78affa4..392d26e4 100644 --- a/core/model/pieces/PieceModifiers.ts +++ b/core/model/pieces/PieceModifiers.ts @@ -1,4 +1,4 @@ -import { Player } from '../../development/logic/players/Player'; +import { Player } from '../../controller/logic/players/Player'; import { Position } from '../types/Position'; import { BasePiece } from './abstract/BasePiece'; diff --git a/core/model/pieces/abstract/BasePiece.ts b/core/model/pieces/abstract/BasePiece.ts index 39bdac64..45d4857c 100644 --- a/core/model/pieces/abstract/BasePiece.ts +++ b/core/model/pieces/abstract/BasePiece.ts @@ -1,4 +1,4 @@ -import { Player } from '../../../development/logic/players/Player'; +import { Player } from '../../../controller/logic/players/Player'; import { Position } from '../../types/Position'; import { PieceModifiers } from '../PieceModifiers'; import { PieceResource } from '../PieceResource'; diff --git a/webpack.config.ts b/webpack.config.ts index 6ec6001c..735bed58 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -10,7 +10,7 @@ interface CustomConfiguration extends webpack.Configuration { const config: CustomConfiguration = { entry: { - room: './core/development/pages/Room.ts', + room: './core/controller/pages/Room.ts', }, output: { path: path.resolve(__dirname, 'dist'),