-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
98 lines (96 loc) · 1.78 KB
/
Player.java
File metadata and controls
98 lines (96 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
import java.util.*;
public class Player {
private String name;
private int coordx, coordy;
private ArrayList<Card> hand;
private int tokens;
private boolean inGame, immunity;
private ArrayList<Card> discard;
public Player(String n/*, Card c, int x, int y*/) {
hand = new ArrayList<>();
name = n;
inGame = true;
tokens = 0;
discard = new ArrayList<>();
immunity = false;
//coordx = x;
//coordy=y;
}
/*public int getX() {
return coordx;
}
public int getY() {
return coordy;
}*/
public String getName() {
return name;
}
public void drawCard(Card c) {
hand.add(c);
//System.out.println(hand.get(0).getName() + hand.get(1).getName());
}
public void addToken() {
tokens++;
}
public void discardCard(int i) {
Card c = hand.remove(i);
if(c.getCardNumber() == 9) {
lose();
}
discard.add(c);
}
public boolean isInGame() {
return inGame;
}
public int getTokens() {
return tokens;
}
public void lose() {
inGame = false;
discard.add(hand.get(0));
immunityTrue();
}
public int getHandAmmount() {
return hand.size();
}
public Card getHandCard(int i) {
return hand.get(i);
}
public ArrayList<Card> getDiscard(){
return discard;
}
public void addDiscardCardDebug(Card c) {
discard.add(c);
}
public void immunityTrue() {
immunity = true;
}
public void immunityFalse() {
immunity = false;
}
public boolean immune() {
return immunity;
}
public void swapHand(Card c) {
hand.add(c);
hand.remove(0);
}
public int getSpyUsedCount() {
int count = 0;
for(int i = 0; i<discard.size();i++) {
if(discard.get(i).getCardNumber() == 0) {
count ++;
}
}
return count;
}
public void reset() {
hand.clear();
discard.clear();
inGame = true;
immunityFalse();
}
public void removeCard(int i) {
hand.remove(i);
}
}