package dev.llan.model.pieces.inanimates; import dev.llan.model.board.Grid; import dev.llan.model.board.Point; import dev.llan.model.board.Tile; import dev.llan.model.cards.CardCollection; import dev.llan.model.pieces.attributes.inventory.Inventory; import dev.llan.model.pieces.player.Player; public abstract class BaseTreasure implements Treasure { protected final Inventory playerInventory; protected final CardCollection playerCollection; protected final Player player; protected final Tile tile; protected final Point position; private boolean collected; public BaseTreasure(Point position, Player player, Grid grid) { this.position = position; this.playerInventory = player.getInventory(); this.playerCollection = player.getCollection(); this.tile = grid.tileAt(position); this.player = player; collected = false; } protected void collect() { collected = true; } protected boolean getCollected() { return collected; } @Override public Point getPosition() { return this.position; } @Override public String toString() { final StringBuilder sb = new StringBuilder("BaseTreasure{"); sb.append(", position=").append(position); sb.append(", collected=").append(collected); sb.append('}'); return sb.toString(); } }