diff options
Diffstat (limited to 'src/esieequest/model/entities/Player.java')
-rw-r--r-- | src/esieequest/model/entities/Player.java | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/src/esieequest/model/entities/Player.java b/src/esieequest/model/entities/Player.java deleted file mode 100644 index 841d6a6..0000000 --- a/src/esieequest/model/entities/Player.java +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | package esieequest.model.entities; | ||
2 | |||
3 | import java.util.Stack; | ||
4 | |||
5 | import esieequest.model.items.Inventory; | ||
6 | import esieequest.model.map.Room; | ||
7 | |||
8 | /** | ||
9 | * A player. | ||
10 | * | ||
11 | * @author Pacien TRAN-GIRARD | ||
12 | * @author BenoƮt LUBRANO DI SBARAGLIONE | ||
13 | */ | ||
14 | public class Player { | ||
15 | |||
16 | private Room currentRoom; | ||
17 | private final Stack<Room> previousRooms; | ||
18 | |||
19 | private final Inventory inventory; | ||
20 | private final int maxCarryWeight; | ||
21 | |||
22 | private int nbSteps; | ||
23 | private int maxNbSteps; | ||
24 | |||
25 | /** | ||
26 | * Creates a new player. | ||
27 | * | ||
28 | * @param maxCarryWeight | ||
29 | * the maximum total weight of the items that the player can | ||
30 | * carry | ||
31 | */ | ||
32 | public Player(final int maxCarryWeight) { | ||
33 | this.currentRoom = null; | ||
34 | this.previousRooms = new Stack<Room>(); | ||
35 | |||
36 | this.inventory = new Inventory(); | ||
37 | this.maxCarryWeight = maxCarryWeight; | ||
38 | |||
39 | this.nbSteps = 0; | ||
40 | this.maxNbSteps = 0; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Returns the current room. | ||
45 | * | ||
46 | * @return the current room | ||
47 | */ | ||
48 | public Room getCurrentRoom() { | ||
49 | return this.currentRoom; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * Sets the current room and stacks previous rooms. | ||
54 | * | ||
55 | * @param room | ||
56 | * the destination room | ||
57 | */ | ||
58 | public void goToRoom(final Room room) { | ||
59 | this.previousRooms.push(this.currentRoom); | ||
60 | this.currentRoom = room; | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * Sets the current room to the previous room. | ||
65 | */ | ||
66 | public void goToPreviousRoom() { | ||
67 | if (!this.previousRooms.empty()) { | ||
68 | this.currentRoom = this.previousRooms.pop(); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * Clears the previous rooms history. | ||
74 | */ | ||
75 | public void clearRoomHistory() { | ||
76 | this.previousRooms.clear(); | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * Gets the player's inventory. | ||
81 | * | ||
82 | * @return the player's inventory | ||
83 | */ | ||
84 | public Inventory getInventory() { | ||
85 | return this.inventory; | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * @return the maxCarryWeight | ||
90 | */ | ||
91 | public int getMaxCarryWeight() { | ||
92 | return this.maxCarryWeight; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * @return the nbSteps | ||
97 | */ | ||
98 | public int getNbSteps() { | ||
99 | return this.nbSteps; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * @param nbSteps | ||
104 | * the nbSteps to set | ||
105 | */ | ||
106 | public void setNbSteps(final int nbSteps) { | ||
107 | this.nbSteps = nbSteps; | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * @return the maxNbSteps | ||
112 | */ | ||
113 | public int getMaxNbSteps() { | ||
114 | return this.maxNbSteps; | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * @param maxNbSteps | ||
119 | * the maxNbSteps to set | ||
120 | */ | ||
121 | public void setMaxNbSteps(final int maxNbSteps) { | ||
122 | this.maxNbSteps = maxNbSteps; | ||
123 | } | ||
124 | |||
125 | } | ||