diff options
Diffstat (limited to 'src/esieequest/model/entities/Player.java')
-rw-r--r-- | src/esieequest/model/entities/Player.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/esieequest/model/entities/Player.java b/src/esieequest/model/entities/Player.java index 91888eb..841d6a6 100644 --- a/src/esieequest/model/entities/Player.java +++ b/src/esieequest/model/entities/Player.java | |||
@@ -5,6 +5,12 @@ import java.util.Stack; | |||
5 | import esieequest.model.items.Inventory; | 5 | import esieequest.model.items.Inventory; |
6 | import esieequest.model.map.Room; | 6 | import esieequest.model.map.Room; |
7 | 7 | ||
8 | /** | ||
9 | * A player. | ||
10 | * | ||
11 | * @author Pacien TRAN-GIRARD | ||
12 | * @author BenoƮt LUBRANO DI SBARAGLIONE | ||
13 | */ | ||
8 | public class Player { | 14 | public class Player { |
9 | 15 | ||
10 | private Room currentRoom; | 16 | private Room currentRoom; |
@@ -13,12 +19,25 @@ public class Player { | |||
13 | private final Inventory inventory; | 19 | private final Inventory inventory; |
14 | private final int maxCarryWeight; | 20 | private final int maxCarryWeight; |
15 | 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 | */ | ||
16 | public Player(final int maxCarryWeight) { | 32 | public Player(final int maxCarryWeight) { |
17 | this.currentRoom = null; | 33 | this.currentRoom = null; |
18 | this.previousRooms = new Stack<Room>(); | 34 | this.previousRooms = new Stack<Room>(); |
19 | 35 | ||
20 | this.inventory = new Inventory(); | 36 | this.inventory = new Inventory(); |
21 | this.maxCarryWeight = maxCarryWeight; | 37 | this.maxCarryWeight = maxCarryWeight; |
38 | |||
39 | this.nbSteps = 0; | ||
40 | this.maxNbSteps = 0; | ||
22 | } | 41 | } |
23 | 42 | ||
24 | /** | 43 | /** |
@@ -51,6 +70,13 @@ public class Player { | |||
51 | } | 70 | } |
52 | 71 | ||
53 | /** | 72 | /** |
73 | * Clears the previous rooms history. | ||
74 | */ | ||
75 | public void clearRoomHistory() { | ||
76 | this.previousRooms.clear(); | ||
77 | } | ||
78 | |||
79 | /** | ||
54 | * Gets the player's inventory. | 80 | * Gets the player's inventory. |
55 | * | 81 | * |
56 | * @return the player's inventory | 82 | * @return the player's inventory |
@@ -66,4 +92,34 @@ public class Player { | |||
66 | return this.maxCarryWeight; | 92 | return this.maxCarryWeight; |
67 | } | 93 | } |
68 | 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 | |||
69 | } | 125 | } |