diff --git a/development/src/logic/items/gold.ts b/development/src/logic/items/gold.ts new file mode 100644 index 00000000..c737be8f --- /dev/null +++ b/development/src/logic/items/gold.ts @@ -0,0 +1,19 @@ +import { Item } from './items'; +import { Player } from '../players'; +import { Piece, Position } from '../pieces'; +import { Logger } from '../../ui/logger'; +import { trapResource } from '../../ui/resources'; + + +export class Gold extends Item { + constructor(player: Player, position: Position) { + super('gold coin', trapResource, player, position); + } + + apply(piece: Piece) { + Logger.logGeneral(`${this.player.color} ${piece.name} + found a ${this.name} on ${piece.position.coordinates}.`); + + this.player.gold++; + } +} \ No newline at end of file diff --git a/development/src/logic/items.ts b/development/src/logic/items/items.ts similarity index 91% rename from development/src/logic/items.ts rename to development/src/logic/items/items.ts index 674a9e6f..8ee1cb0e 100644 --- a/development/src/logic/items.ts +++ b/development/src/logic/items/items.ts @@ -1,6 +1,6 @@ -import { Logger } from '../ui/logger'; -import { Piece, Position } from './pieces'; -import { Player } from './players'; +import { Logger } from '../../ui/logger'; +import { Piece, Position } from '../pieces'; +import { Player } from '../players'; export class Inventory { items: Array = []; diff --git a/development/src/logic/trap.ts b/development/src/logic/items/trap.ts similarity index 61% rename from development/src/logic/trap.ts rename to development/src/logic/items/trap.ts index 41c96581..134b8b74 100644 --- a/development/src/logic/trap.ts +++ b/development/src/logic/items/trap.ts @@ -1,10 +1,10 @@ import { Item } from './items'; -import { Player } from './players'; -import { Piece, Position } from './pieces'; -import { items } from './logic'; -import { Logger } from '../ui/logger'; -import { spawnItemOnBoard } from '../ui/boards'; -import { trapResource } from '../ui/resources'; +import { Player } from '../players'; +import { Piece, Position } from '../pieces'; +import { items } from '../logic'; +import { Logger } from '../../ui/logger'; +import { spawnItemOnBoard } from '../../ui/boards'; +import { trapResource } from '../../ui/resources'; export class Trap extends Item { diff --git a/development/src/logic/logic.ts b/development/src/logic/logic.ts index c9e9170b..818266aa 100644 --- a/development/src/logic/logic.ts +++ b/development/src/logic/logic.ts @@ -21,7 +21,7 @@ import { } from '../ui/boards'; import { activeRules } from './rules'; import { updatePlayersInformation } from '../game'; -import { Item } from './items'; +import { Item } from './items/items'; import { HEAVEN_BOARD_ID, HELL_BOARD_ID, OVERWORLD_BOARD_ID } from './constants'; const whitePlayer = new Player(PlayerColors.WHITE); diff --git a/development/src/logic/pieces.ts b/development/src/logic/pieces.ts index 2674a397..7883aa4f 100644 --- a/development/src/logic/pieces.ts +++ b/development/src/logic/pieces.ts @@ -14,7 +14,7 @@ import { items, comparePositions, } from './logic'; -import { Item } from './items'; +import { Item } from './items/items'; import { OVERWORLD_BOARD_ID } from './constants'; export type Position = { diff --git a/development/src/logic/players.ts b/development/src/logic/players.ts index cf74e317..8c00db00 100644 --- a/development/src/logic/players.ts +++ b/development/src/logic/players.ts @@ -1,4 +1,4 @@ -import { Inventory } from './items'; +import { Inventory } from './items/items'; type PlayerType = { color: string; diff --git a/development/src/ui/board.ts b/development/src/ui/board.ts index a225db6a..4911616b 100644 --- a/development/src/ui/board.ts +++ b/development/src/ui/board.ts @@ -1,5 +1,5 @@ import { BOARD_WIDTH } from '../logic/constants'; -import { Item } from '../logic/items'; +import { Item } from '../logic/items/items'; import { pieces } from '../logic/logic'; import { Piece, Square } from '../logic/pieces'; diff --git a/development/src/ui/boards.ts b/development/src/ui/boards.ts index 3dd9c3f8..709e9cad 100644 --- a/development/src/ui/boards.ts +++ b/development/src/ui/boards.ts @@ -19,7 +19,7 @@ import { OVERWORLD_BOARD_BUTTON_ID, OVERWORLD_BOARD_ID, } from '../logic/constants'; -import { Item } from '../logic/items'; +import { Item } from '../logic/items/items'; import { Piece, Square } from '../logic/pieces'; let overworld: ChessBoard;