Browse Source

Test

master
Edi 5 years ago
parent
commit
54a5a77592
2 changed files with 124 additions and 0 deletions
  1. 55
    0
      src/java/Item.java
  2. 69
    0
      src/java/Room.java

+ 55
- 0
src/java/Item.java View File

public class Item
{
private int id;
private String name;
private boolean portableFlag;
private boolean hiddenFlag;
private String description;
public Item(String name)
{
this.name = name;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isPortableFlag() {
return portableFlag;
}
public void setPortableFlag(boolean portableFlag) {
this.portableFlag = portableFlag;
}
public boolean isHiddenFlag() {
return hiddenFlag;
}
public void setHiddenFlag(boolean hiddenFlag) {
this.hiddenFlag = hiddenFlag;
}
}

+ 69
- 0
src/java/Room.java View File

import java.util.ArrayList;
public class Room
{
private int id;
private String name;
private String description;
private boolean gameoverFlag;
ArrayList<Item> items = new ArrayList<>();
ArrayList<Puzzle> puzzles = new ArrayList<>();
public Room(String name)
{
this.name = name;
}
public Item getItem(String s)
{
for(Item i: items)
{
if(i.getName().equals(s))
return i;
}
return null;
}
public Puzzle getPuzzle(String s)
{
for(Puzzle p: puzzles)
{
if(p.getName().equals(s))
return p;
}
return null;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean getGameoverFlag() {
return gameoverFlag;
}
public void setGameoverFlag(boolean gameOverFlag) {
gameoverFlag = gameOverFlag;
}
public ArrayList<Item> getItems() {
return items;
}
public ArrayList<Puzzle> getPuzzles() {
return puzzles;
}
}

Loading…
Cancel
Save