You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Room.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import java.util.ArrayList;
  2. public class Room
  3. {
  4. private String name;
  5. private String description;
  6. private boolean gameoverFlag;
  7. ArrayList<Item> items = new ArrayList<>();
  8. ArrayList<Puzzle> puzzles = new ArrayList<>();
  9. public Room(String name)
  10. {
  11. this.name = name;
  12. }
  13. public Item getItem(String s)
  14. {
  15. for(Item i: items)
  16. {
  17. if(i.getName().equalsIgnoreCase(s))
  18. return i;
  19. }
  20. return null;
  21. }
  22. public Puzzle getPuzzle(String s)
  23. {
  24. for(Puzzle p: puzzles)
  25. {
  26. if(p.getName().equalsIgnoreCase(s))
  27. return p;
  28. }
  29. return null;
  30. }
  31. public String getName() {
  32. return name;
  33. }
  34. public void setName(String name) {
  35. this.name = name;
  36. }
  37. public String getDescription() {
  38. return description;
  39. }
  40. public void setDescription(String description) {
  41. this.description = description;
  42. }
  43. public boolean getGameoverFlag() {
  44. return gameoverFlag;
  45. }
  46. public void setGameoverFlag(boolean gameOverFlag) {
  47. gameoverFlag = gameOverFlag;
  48. }
  49. public ArrayList<Item> getItems() {
  50. return items;
  51. }
  52. public ArrayList<Puzzle> getPuzzles() {
  53. return puzzles;
  54. }
  55. }