diff options
Diffstat (limited to 'src/esieequest/model/characters/MovingCharacter.java')
-rw-r--r-- | src/esieequest/model/characters/MovingCharacter.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/esieequest/model/characters/MovingCharacter.java b/src/esieequest/model/characters/MovingCharacter.java index b12c4ce..94aeaf1 100644 --- a/src/esieequest/model/characters/MovingCharacter.java +++ b/src/esieequest/model/characters/MovingCharacter.java | |||
@@ -4,6 +4,7 @@ import java.util.ArrayList; | |||
4 | import java.util.List; | 4 | import java.util.List; |
5 | import java.util.Random; | 5 | import java.util.Random; |
6 | 6 | ||
7 | import lombok.Getter; | ||
7 | import lombok.Setter; | 8 | import lombok.Setter; |
8 | import net.pacien.util.CleanJSONObject; | 9 | import net.pacien.util.CleanJSONObject; |
9 | 10 | ||
@@ -40,9 +41,10 @@ public abstract class MovingCharacter extends SimpleCharacter { | |||
40 | private static final String CURRENT_DIRECTION_LABEL = "D"; | 41 | private static final String CURRENT_DIRECTION_LABEL = "D"; |
41 | private Direction currentDirection; | 42 | private Direction currentDirection; |
42 | 43 | ||
43 | private static final String CAN_MOVE_LABEL = "M"; | 44 | private static final String MOBILE_LABEL = "M"; |
45 | @Getter | ||
44 | @Setter | 46 | @Setter |
45 | private boolean canMove; | 47 | private boolean mobile; |
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Creates a MovingCharacter with a given name and location. | 50 | * Creates a MovingCharacter with a given name and location. |
@@ -60,7 +62,7 @@ public abstract class MovingCharacter extends SimpleCharacter { | |||
60 | 62 | ||
61 | this.currentRoom = room; | 63 | this.currentRoom = room; |
62 | this.currentDirection = direction; | 64 | this.currentDirection = direction; |
63 | this.canMove = false; | 65 | this.mobile = false; |
64 | } | 66 | } |
65 | 67 | ||
66 | /** | 68 | /** |
@@ -69,7 +71,7 @@ public abstract class MovingCharacter extends SimpleCharacter { | |||
69 | * Character. | 71 | * Character. |
70 | */ | 72 | */ |
71 | public void move() { | 73 | public void move() { |
72 | if (!this.canMove) { | 74 | if (!this.mobile) { |
73 | return; | 75 | return; |
74 | } | 76 | } |
75 | 77 | ||
@@ -106,7 +108,7 @@ public abstract class MovingCharacter extends SimpleCharacter { | |||
106 | if (this.currentDirection != null) { | 108 | if (this.currentDirection != null) { |
107 | o.put(MovingCharacter.CURRENT_DIRECTION_LABEL, this.currentDirection.name()); | 109 | o.put(MovingCharacter.CURRENT_DIRECTION_LABEL, this.currentDirection.name()); |
108 | } | 110 | } |
109 | o.put(MovingCharacter.CAN_MOVE_LABEL, this.canMove); | 111 | o.put(MovingCharacter.MOBILE_LABEL, this.mobile); |
110 | 112 | ||
111 | return o; | 113 | return o; |
112 | } | 114 | } |
@@ -116,7 +118,7 @@ public abstract class MovingCharacter extends SimpleCharacter { | |||
116 | this.currentRoom = Room.valueOf((String) o.get(MovingCharacter.CURRENT_ROOM_LABEL)); | 118 | this.currentRoom = Room.valueOf((String) o.get(MovingCharacter.CURRENT_ROOM_LABEL)); |
117 | this.currentDirection = Direction.valueOf((String) o | 119 | this.currentDirection = Direction.valueOf((String) o |
118 | .get(MovingCharacter.CURRENT_DIRECTION_LABEL)); | 120 | .get(MovingCharacter.CURRENT_DIRECTION_LABEL)); |
119 | this.canMove = (Boolean) o.get(MovingCharacter.CAN_MOVE_LABEL); | 121 | this.mobile = (Boolean) o.get(MovingCharacter.MOBILE_LABEL); |
120 | } | 122 | } |
121 | 123 | ||
122 | } | 124 | } |