package eu.oschl.textadventure.objects; import java.util.Optional; /** * Represents an object in the game that can be picked up by the player. * This class serves as a base for all pickable objects, providing common properties and methods. * * @author Ondřej Schlaichert */ public abstract class PickableObject extends GameObject { private final String iconImagePath; public PickableObject(String name, String description, String iconImagePath) { super(name, description); this.iconImagePath = iconImagePath; } public PickableObject(String name, String description) { super(name, description); this.iconImagePath = null; } public Optional getIconImagePath() { return Optional.ofNullable(iconImagePath); } /** * Picks up the object and adds it to the player's inventory. * @return true if the object was successfully picked up, false otherwise */ public abstract boolean pickUp(); }