-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.pde
53 lines (45 loc) · 1.03 KB
/
Player.pde
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
/**
* Class whitch contains information about the player
* A player has a deck and a hand of cards
*
* The player can click on c ard and click on the location they want to place the card on
*/
public class Player extends Obj {
public Deck deck;
public Hand hand;
public int num = -1;
public String name = "!!GUH!!";
public Player(Snap app, int num) {
super(app);
deck = new Deck(app);
hand = new Hand(app);
this.num = num;
}
protected void _setup() {
deck.setup();
hand.setup();
}
protected void _update() {
deck.update();
hand.update();
}
public String toString() {
return "Hand: " + hand.toString() + "\nDeck: " + deck.toString();
}
public boolean hasCards() {
return (deck.cards.size() + hand.cards.size()) > 0;
}
public boolean hasSpecialCard() {
for (Card c : deck.cards) {
if (c.num >= Card.jack) {
return true;
}
}
for (Card c : hand.cards) {
if (c.num >= Card.jack) {
return true;
}
}
return false;
}
}