Class Room


  • public class Room
    extends java.lang.Object
    Class Room - a room in an adventure game. This class is part of the "World of Zuul" application. "World of Zuul" is a very simple, text based adventure game. A "Room" represents one location in the scenery of the game. It is connected to other rooms via exits. For each existing exit, the room stores a reference to the neighboring room.
    Version:
    1.0 (February 2002) DBMOD:04/04/2008, 2019, AF edited (2021)
    Author:
    Michael Kolling and David J. Barnes and Alban FERRACANI
    • Constructor Summary

      Constructors 
      Constructor Description
      Room​(java.lang.String pNomRoom, java.lang.String pDescription, java.lang.String pImage, java.lang.String pEnigme)
      Create a room described "description" with a given image.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(java.lang.String pNomItem, Item pItem)
      Pour ajouter des items dans la pièce.
      java.lang.String getEnigme()
      Accesseur des énigmes
      Room getExit​(java.lang.String direction)
      Return the room that is reached if we go from this room in direction "direction".
      java.lang.String getImageName()  
      Item getItem​(java.lang.String pItem)
      getItem
      java.lang.String getItemWin()
      Accesseur de ItemWin
      java.lang.String getLongDescription()
      Return a long description of this room, in the form: You are in the kitchen.
      java.lang.String getNomRoom()
      Accesseur de aNomRoom
      java.lang.String getShortDescription()
      Return the description of the room (the one that was defined in the constructor).
      boolean getTrapDoor()
      Accesseur de trapdoor.
      void removeItem​(java.lang.String pNomItem, Item pItemRetire)
      Pour retirer des items dans la pièce.
      void setExit​(java.lang.String direction, Room neighbor, boolean pTrapDoor)
      Define an exit from this room.
      void setItem​(Item pItem)
      setItem
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Room

        public Room​(java.lang.String pNomRoom,
                    java.lang.String pDescription,
                    java.lang.String pImage,
                    java.lang.String pEnigme)
        Create a room described "description" with a given image. Initially, it has no exits. "description" is something like "in a kitchen" or "in an open court yard".
    • Method Detail

      • setExit

        public void setExit​(java.lang.String direction,
                            Room neighbor,
                            boolean pTrapDoor)
        Define an exit from this room.
      • getShortDescription

        public java.lang.String getShortDescription()
        Return the description of the room (the one that was defined in the constructor).
      • setItem

        public void setItem​(Item pItem)
        setItem
      • getLongDescription

        public java.lang.String getLongDescription()
        Return a long description of this room, in the form: You are in the kitchen. Exits: north west
      • getExit

        public Room getExit​(java.lang.String direction)
        Return the room that is reached if we go from this room in direction "direction". If there is no room in that direction, return null.
      • getImageName

        public java.lang.String getImageName()
      • addItem

        public void addItem​(java.lang.String pNomItem,
                            Item pItem)
        Pour ajouter des items dans la pièce.
      • removeItem

        public void removeItem​(java.lang.String pNomItem,
                               Item pItemRetire)
        Pour retirer des items dans la pièce.
      • getItem

        public Item getItem​(java.lang.String pItem)
        getItem
      • getTrapDoor

        public boolean getTrapDoor()
        Accesseur de trapdoor.
      • getEnigme

        public java.lang.String getEnigme()
        Accesseur des énigmes
      • getNomRoom

        public java.lang.String getNomRoom()
        Accesseur de aNomRoom
      • getItemWin

        public java.lang.String getItemWin()
        Accesseur de ItemWin