-
Notifications
You must be signed in to change notification settings - Fork 1
/
WildDrawCard.java
88 lines (70 loc) · 2.51 KB
/
WildDrawCard.java
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
/**
* This class represent a Wild Draw card in UNO game.
* It extends from {@code Card} class
*
*
* @author Mohammad Mahdi Malmasi
* @version 0.1.1
*
* @see Card
*/
public class WildDrawCard extends Card
{
/* Constructor */
/**
* Creat a new Wild Draw card with given details
*
* @param cardCode : the code number of the card. an int in range [1, 108]
*/
public WildDrawCard(int cardCode)
{
super(20, Color.BLACK, cardCode);
}
/* Methods */
/**
* This method return the {@code String} of the each line of the visual card for print it
* in terminal. if the given number be less than 0, the super class toSetirng will be called.
*
*
* @param lineNumber : the number of the card line
* @return a {@code String} of the given card line
*
* @see cardsOutput.txt, (in project repository)
*/
@Override
public String toString(int lineNumber)
{
if (lineNumber < 0)
return super.toString((-1)*lineNumber);
switch (lineNumber)
{
// the top and bottom of the card
case 1:
case 7:
return Color.getColorCodeString(Color.WHITE) + "•~~~~~~~•" +
Color.getColorCodeString(Color.RESET);
case 2:
return Color.getColorCodeString(Color.WHITE) + "|+4 |" +
Color.getColorCodeString(Color.RESET);
case 3:
case 5:
return Color.getColorCodeString(Color.WHITE) + "| |" +
Color.getColorCodeString(Color.RESET);
case 4:
return Color.getColorCodeString(Color.WHITE) + "|" +
Color.getColorCodeString(Color.RED) + "W " +
Color.getColorCodeString(Color.YELLOW) + "i " +
Color.getColorCodeString(Color.GREEN) + "l " +
Color.getColorCodeString(Color.BLUE) + "d" +
Color.getColorCodeString(Color.WHITE) + "|" +
Color.getColorCodeString(Color.RESET);
case 6:
return Color.getColorCodeString(Color.WHITE) + "| +4|" +
Color.getColorCodeString(Color.RESET);
case 8:
return Color.getColorCodeString(Color.WHITE) + "code: " + super.getCardCode() +
Color.getColorCodeString(Color.RESET);
}
return null;
}
}