-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathPlayer.java
More file actions
174 lines (162 loc) · 3.37 KB
/
Player.java
File metadata and controls
174 lines (162 loc) · 3.37 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import java.util.List;
import java.util.ArrayList;
public class Player{
private int love = 0;
private int knowledge = 0;
private int rebelling = 0;
private int money = 0;
private int friendship = 0;
private int affection = 0;
private int basketball = 0;
private int game = 0;
private int drama = 0;
//add some initial data
private int water = 0;
private int chocolate = 0;
private int book = 0;
private int flower = 0;
private int rebellingCounter = 0;
private String personality;
private boolean ifGo;
private boolean ifMovie;
//type it
List<String> item = new ArrayList<String>();
private String name;
//set name
public Player(String n){
name = n;
}
public void setPersonality(String p){
personality = p;
}
public String getPersonality(){
return personality;
}
public void checkPersonality(){
if(personality.equals("a")){
basketball += 5;
}else if(personality.equals("c")){
love += 5;
}else if(personality.equals("s")){
knowledge += 5;
}
}
//all setter and getter
public void addLove(int num){
love += num;
}
public int getLove(){
return love;
}
public void addKnowledge(int num){
knowledge += num;
}
public int getKnowledge(){
return knowledge;
}
public void addRebelling(int num){
rebelling += num;
if(num > 0){
rebellingCounter +=1;
}else{
rebellingCounter = 0;
}
}
public int getRebelling(){
return rebelling;
}
public void addMoney(int num){
money += num;
}
public String printMoney(){
return "Now you have " + money + " bucks.";
}
public int getMoney(){
return money;
}
public void addFriendship(int num){
friendship += num;
}
public int getFriendship(){
return friendship;
}
public void addAffection(int num){
affection += num;
}
public int getAffection(){
return affection;
}
public void addBasketball(int num){
basketball += num;
}
public int getBasketball(){
return basketball;
}
public void addGame(int num){
game += num;
}
public int getGame(){
return game;
}
public void addDrama(int num){
drama += num;
}
public int getDrama(){
return drama;
}
//item
public void addItem(String newItem){
item.add(newItem);
}
public void checkItem(){
water = 0;
chocolate = 0;
book = 0;
flower = 0;
for(String i : item){
if(i.equals("water")){
water +=1;
}else if(i.equals("chocolate")){
chocolate +=1;
}else if(i.equals("book")){
book += 1;
}else if(i.equals("flower")){
flower +=1;
}
}
System.out.println("You have bottle water*" + water + ", chocolate*" + chocolate + ", book*" + book + ", and flower*" + flower);
}
public int getWater(){
return water;
}
public int getChocolate(){
return chocolate;
}
public int getBook(){
return book;
}
public int getFlower(){
return flower;
}
public void removeItem(String usedItem){
item.remove(usedItem);
}
public void setRebellingC(int c){
rebellingCounter = c;
}
public int getRebellingC(){
return rebellingCounter;
}
public void setIfGo(boolean ig){
ifGo = ig;
}
public boolean getIfGo(){
return ifGo;
}
public void setIfMovie(boolean im){
ifMovie = im;
}
public boolean getIfMovie(){
return ifMovie;
}
}