diff options
author | Pacien TRAN-GIRARD | 2016-03-07 17:22:53 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-03-07 17:27:21 +0100 |
commit | 5309cf4c441571a94e6c0033765ec43a3dc67ec8 (patch) | |
tree | 39b568cb357df4f8229746164cad55dbf251e2a1 | |
parent | b19ea8deecbee9368204e07103605a7625976b11 (diff) | |
download | xblast-5309cf4c441571a94e6c0033765ec43a3dc67ec8.tar.gz |
Use this class reference03_players_bombs
-rw-r--r-- | src/ch/epfl/xblast/server/Board.java | 6 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Bomb.java | 12 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Player.java | 40 |
3 files changed, 29 insertions, 29 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java index 5e03671..18ee532 100644 --- a/src/ch/epfl/xblast/server/Board.java +++ b/src/ch/epfl/xblast/server/Board.java | |||
@@ -119,7 +119,7 @@ public final class Board { | |||
119 | for (List<Block> aHalfInnerBoard : halfInnerBoard) | 119 | for (List<Block> aHalfInnerBoard : halfInnerBoard) |
120 | rowsList.add(Lists.mirrored(aHalfInnerBoard)); | 120 | rowsList.add(Lists.mirrored(aHalfInnerBoard)); |
121 | 121 | ||
122 | return ofInnerBlocksWalled(rowsList); | 122 | return Board.ofInnerBlocksWalled(rowsList); |
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
@@ -129,7 +129,7 @@ public final class Board { | |||
129 | * @return the sequence of blocks related to the given cell. | 129 | * @return the sequence of blocks related to the given cell. |
130 | */ | 130 | */ |
131 | public Sq<Block> blocksAt(Cell c) { | 131 | public Sq<Block> blocksAt(Cell c) { |
132 | return blocks.get(c.rowMajorIndex()); | 132 | return this.blocks.get(c.rowMajorIndex()); |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
@@ -139,7 +139,7 @@ public final class Board { | |||
139 | * @return the first block of the sequence related to the given cell | 139 | * @return the first block of the sequence related to the given cell |
140 | */ | 140 | */ |
141 | public Block blockAt(Cell c) { | 141 | public Block blockAt(Cell c) { |
142 | return blocksAt(c).head(); | 142 | return this.blocksAt(c).head(); |
143 | } | 143 | } |
144 | 144 | ||
145 | } | 145 | } |
diff --git a/src/ch/epfl/xblast/server/Bomb.java b/src/ch/epfl/xblast/server/Bomb.java index 12e8888..3b1203b 100644 --- a/src/ch/epfl/xblast/server/Bomb.java +++ b/src/ch/epfl/xblast/server/Bomb.java | |||
@@ -71,35 +71,35 @@ public final class Bomb { | |||
71 | * @return the ID of the owner of the bomb | 71 | * @return the ID of the owner of the bomb |
72 | */ | 72 | */ |
73 | public PlayerID ownerId() { | 73 | public PlayerID ownerId() { |
74 | return ownerId; | 74 | return this.ownerId; |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * @return the position of the bomb | 78 | * @return the position of the bomb |
79 | */ | 79 | */ |
80 | public Cell position() { | 80 | public Cell position() { |
81 | return position; | 81 | return this.position; |
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * @return the length of the fuse | 85 | * @return the length of the fuse |
86 | */ | 86 | */ |
87 | public Sq<Integer> fuseLengths() { | 87 | public Sq<Integer> fuseLengths() { |
88 | return fuseLengths; | 88 | return this.fuseLengths; |
89 | } | 89 | } |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * @return the remaining time before the explosion | 92 | * @return the remaining time before the explosion |
93 | */ | 93 | */ |
94 | public int fuseLength() { | 94 | public int fuseLength() { |
95 | return fuseLengths.head(); | 95 | return this.fuseLengths.head(); |
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * @return the range of the Bomb | 99 | * @return the range of the Bomb |
100 | */ | 100 | */ |
101 | public int range() { | 101 | public int range() { |
102 | return range; | 102 | return this.range; |
103 | } | 103 | } |
104 | 104 | ||
105 | /** | 105 | /** |
@@ -108,7 +108,7 @@ public final class Bomb { | |||
108 | public List<Sq<Sq<Cell>>> explosion() { | 108 | public List<Sq<Sq<Cell>>> explosion() { |
109 | List<Sq<Sq<Cell>>> explosion = new ArrayList<>(); | 109 | List<Sq<Sq<Cell>>> explosion = new ArrayList<>(); |
110 | for (Direction dir : Direction.values()) { | 110 | for (Direction dir : Direction.values()) { |
111 | explosion.add(explosionArmTowards(dir)); | 111 | explosion.add(this.explosionArmTowards(dir)); |
112 | } | 112 | } |
113 | return explosion; | 113 | return explosion; |
114 | } | 114 | } |
diff --git a/src/ch/epfl/xblast/server/Player.java b/src/ch/epfl/xblast/server/Player.java index 7b5ac26..094d395 100644 --- a/src/ch/epfl/xblast/server/Player.java +++ b/src/ch/epfl/xblast/server/Player.java | |||
@@ -47,21 +47,21 @@ public final class Player { | |||
47 | * @return the number of lives | 47 | * @return the number of lives |
48 | */ | 48 | */ |
49 | public int lives() { | 49 | public int lives() { |
50 | return lives; | 50 | return this.lives; |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * @return the state | 54 | * @return the state |
55 | */ | 55 | */ |
56 | public State state() { | 56 | public State state() { |
57 | return state; | 57 | return this.state; |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * @return true if the actual state allow to move | 61 | * @return true if the actual state allow to move |
62 | */ | 62 | */ |
63 | public boolean canMove() { | 63 | public boolean canMove() { |
64 | return (state() == State.INVULNERABLE || state() == State.VULNERABLE); | 64 | return this.state() == State.INVULNERABLE || this.state() == State.VULNERABLE; |
65 | } | 65 | } |
66 | 66 | ||
67 | } | 67 | } |
@@ -104,28 +104,28 @@ public final class Player { | |||
104 | * @return the position | 104 | * @return the position |
105 | */ | 105 | */ |
106 | public SubCell position() { | 106 | public SubCell position() { |
107 | return position; | 107 | return this.position; |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * @return a new directed position with the given position and the previous direction | 111 | * @return a new directed position with the given position and the previous direction |
112 | */ | 112 | */ |
113 | public DirectedPosition withPosition(SubCell newPosition) { | 113 | public DirectedPosition withPosition(SubCell newPosition) { |
114 | return new DirectedPosition(newPosition, direction); | 114 | return new DirectedPosition(newPosition, this.direction()); |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * @return the direction | 118 | * @return the direction |
119 | */ | 119 | */ |
120 | public Direction direction() { | 120 | public Direction direction() { |
121 | return direction; | 121 | return this.direction; |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @return a new directed position with the previous position and the given direction | 125 | * @return a new directed position with the previous position and the given direction |
126 | */ | 126 | */ |
127 | public DirectedPosition withDirection(Direction newDirection) { | 127 | public DirectedPosition withDirection(Direction newDirection) { |
128 | return new DirectedPosition(position, newDirection); | 128 | return new DirectedPosition(this.position(), newDirection); |
129 | } | 129 | } |
130 | 130 | ||
131 | } | 131 | } |
@@ -219,14 +219,14 @@ public final class Player { | |||
219 | * @return the player's ID | 219 | * @return the player's ID |
220 | */ | 220 | */ |
221 | public PlayerID id() { | 221 | public PlayerID id() { |
222 | return id; | 222 | return this.id; |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * @return the player's life states | 226 | * @return the player's life states |
227 | */ | 227 | */ |
228 | public Sq<LifeState> lifeStates() { | 228 | public Sq<LifeState> lifeStates() { |
229 | return lifeStates; | 229 | return this.lifeStates; |
230 | } | 230 | } |
231 | 231 | ||
232 | /** | 232 | /** |
@@ -256,77 +256,77 @@ public final class Player { | |||
256 | * @return the current life state of the player | 256 | * @return the current life state of the player |
257 | */ | 257 | */ |
258 | public LifeState lifeState() { | 258 | public LifeState lifeState() { |
259 | return lifeStates.head(); | 259 | return this.lifeStates.head(); |
260 | } | 260 | } |
261 | 261 | ||
262 | /** | 262 | /** |
263 | * @return the current number of lives of the player | 263 | * @return the current number of lives of the player |
264 | */ | 264 | */ |
265 | public int lives() { | 265 | public int lives() { |
266 | return lifeStates.head().lives(); | 266 | return this.lifeStates.head().lives(); |
267 | } | 267 | } |
268 | 268 | ||
269 | /** | 269 | /** |
270 | * @return true is the player has more than 0 lives | 270 | * @return true is the player has more than 0 lives |
271 | */ | 271 | */ |
272 | public boolean isAlive() { | 272 | public boolean isAlive() { |
273 | return lives() >= 0; | 273 | return this.lives() >= 0; |
274 | } | 274 | } |