Class HouseKey

All Implemented Interfaces:
EquipListener, TurnListener, UseListener, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
MasterKey

public class HouseKey extends Item
A key that matches if the identifier and lock number are the right.
  • Constructor Details

    • HouseKey

      public HouseKey(String name, String clazz, String subclass, Map<String,​String> attributes)
    • HouseKey

      public HouseKey(HouseKey key)
      Copy constructor.
      Parameters:
      key - the key to be copied.
  • Method Details

    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class Item
      Returns:
      description from the players point of view
    • getName

      public String getName()
      Description copied from class: Item
      Gets the name of the item.
      Specified by:
      getName in interface Killer
      Overrides:
      getName in class Item
      Returns:
      The programmatic item name.
    • setup

      public void setup(String id, int lockNumber, String owner)
      Set the parameters of the key.
      Parameters:
      id - the portal identifier
      lockNumber - the number of the lock
      owner - the owner of the house
    • matches

      public boolean matches(String houseId, int number)
      Check if the key matches a portal.
      Parameters:
      houseId - identifier of the portal
      number - number of the lock
      Returns:
      true if the key fits the lock, false otherwise