forked from cborder42/OverlakeMonopoly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
119 lines (78 loc) · 1.78 KB
/
Player.java
File metadata and controls
119 lines (78 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//Final Project
//Alec Zoe Felix Celina Gavin
//Overlake Monopoly
//Player class Creates players
import java.util.*;
public class Player{
private int bank;
private int pos;
private boolean inJail;
private int timeJail;
private String name;
private ArrayList<Place> owned = new ArrayList<Place>();
public Player(){
bank = 1500;
pos = 0;
inJail= false;
timeJail = 0;
}
public void give(int num){
bank += num;
}
public void take(int num){
bank -= num;
}
public void move(int num){
for(int i = num; i > 0; i--){
if(pos == 23){
pos = 0;
bank+= 200;
System.out.println("You passed go! ");
}
else{
pos++;
}
}
}
public void forceMove(int loc){
pos = loc;
}
public ArrayList<Place> ownPlace(){
return owned;
}
public Place ownPlacePosition(int num){
return owned.get(num);
}
public void addPlace(Place input){
owned.add(input);
}
public int getBank(){
return bank;
}
public int getPos(){
return pos;
}
public void goToJail(){
inJail = true;
forceMove(6);
}
public boolean isJail(){
return inJail;
}
public void outJail(){
inJail = false;
timeJail = 0;
}
public int getTimeJail(){
return timeJail;
}
public void jailNextTurn(){
this.timeJail ++;
}
public String getName(){
return name;
}
public void changeName(String newName){
name = newName;
}
}