1111
1212public class OrdinaryThief extends Thief {
1313 private AssaultParty party ;
14- private boolean canIMove ;
15- private int position ;
1614 private int displacement ;
17- private int movesLeft ;
1815 private boolean hasCanvas ;
19- public void joinParty (int partyID ) {
20- this .party = assaultParties [partyID ];
21- }
22-
23- public AssaultParty getParty () {
24- return party ;
25- }
16+ private Museum .Room [] rooms ;
2617
27- public boolean canMove ( ) {
28- return canIMove ;
18+ public void setAssaultParty ( int partyID ) {
19+ party = assaultParties [ partyID ] ;
2920 }
3021
31- public void canMove (boolean canIMove ) {
32- this .canIMove = canIMove ;
33- }
34-
35- public int getPosition () {
36- return position ;
37- }
38-
39- public void setPosition (int position ) {
40- this .position = position ;
22+ public void setRoomOfParty (int roomID ) {
23+ party .setRoom (rooms [roomID ]);
4124 }
4225
4326 public int getDisplacement () {
4427 return displacement ;
4528 }
4629
47- public int getMovesLeft () {
48- return movesLeft ;
49- }
50-
51- public void setMovesLeft (int movesLeft ) {
52- this .movesLeft = movesLeft ;
53- }
54-
55- public void resetMovesLeft () {
56- movesLeft = max (displacement , MAX_SEPARATION_LIMIT );
30+ public void setDisplacement (int displacement ) {
31+ this .displacement = displacement ;
5732 }
5833
5934 public boolean hasCanvas () {
@@ -68,16 +43,16 @@ public OrdinaryThief(String threadName, int thiefID, Museum museum, Concentratio
6843 super (threadName , thiefID , museum , concentrationSite , collectionSite , assaultParties );
6944 thiefState = OrdinaryThiefStates .CONCENTRATION_SITE ;
7045 displacement = random (MIN_DISPLACEMENT , MAX_DISPLACEMENT );
71- resetMovesLeft () ;
72- canIMove = hasCanvas = false ;
46+ hasCanvas = false ;
47+ rooms = museum . getRooms () ;
7348 }
7449
7550 @ Override
7651 public void run () {
7752 while (concentrationSite .amINeeded ()) {
7853 concentrationSite .prepareExcursion ();
7954 party .crawlIn ();
80- museum .rollACanvas (party .getId ());
55+ museum .rollACanvas (party .getID ());
8156 party .reverseDirection ();
8257 party .crawlOut ();
8358 collectionSite .handACanvas ();
0 commit comments