Class TreasureChest


public class TreasureChest extends Object
TreasureChest is a class representing the treasure chests in the game. Unopened chests contain an item.
  • Constructor Details

    • TreasureChest

      public TreasureChest(Item reward, Point position)
      Create a new treasure chest at a position with a certain reward. Note that none of these should be null.
      reward - the reward for opening the chest.
      position - the in-room position of the chest.
  • Method Details

    • getPosition

      public Point getPosition()
      Gets the position of the treasure chest.
      the position of the chest.
    • open

      public Item open()
      If unopened, this will open the chest and return the reward.
      the reward of the chest.
    • isOpened

      public boolean isOpened()
      Gets if this chest has been opened.
      true if this chest has been opened, false otherwise.