source: lost-perception/main/Location.java

Last change on this file was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1package main;
2
3import java.util.TreeSet;
4
5public class Location
6{
7 private Tile ground;
8 private Tile base;
9 private TreeSet<Creature> creatures;
10 private TreeSet<Tile> objects;
11 private TreeSet<Item> items;
12 public boolean passable;
13 public int obstacles;
14
15 public Location(final Tile ground) {
16 this.ground = ground;
17 this.objects = new TreeSet<Tile>();
18 this.creatures = new TreeSet<Creature>();
19 this.items = new TreeSet<Item>();
20 this.passable = true;
21 this.obstacles = 0;
22 }
23
24 public Tile getGround() {
25 return this.ground;
26 }
27
28 public Tile getBase() {
29 return this.base;
30 }
31
32 public Tile getStructure() {
33 return this.base;
34 }
35
36 public void addObject(final Tile obj) {
37 this.objects.add(obj);
38 }
39
40 public TreeSet<Tile> getObjects() {
41 return this.objects;
42 }
43
44 public void addCreature(final Creature creature) {
45 this.creatures.add(creature);
46 }
47
48 public TreeSet<Creature> getCreatures() {
49 return this.creatures;
50 }
51
52 public void addItem(final Item item) {
53 this.items.add(item);
54 }
55
56 public TreeSet<Item> getItems() {
57 return this.items;
58 }
59
60 public void setGround(final Tile ground) {
61 if (ground.getImg().needsBase()) {
62 if (this.ground.getImg().needsBase()) {
63 this.ground = ground;
64 }
65 else {
66 this.base = this.ground;
67 this.ground = ground;
68 }
69 }
70 else {
71 this.base = null;
72 this.ground = ground;
73 }
74 }
75}
Note: See TracBrowser for help on using the repository browser.