-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGameConfig.java
More file actions
194 lines (158 loc) · 5.46 KB
/
GameConfig.java
File metadata and controls
194 lines (158 loc) · 5.46 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package rookCore;
/**
* Created by ashton on 12/31/14.
*
* @TODO: Implement the checking of the error handling bits.
* @TODO: Need to implement the upperBidLimit();
* <p/>
* Created by ashton on 12/31/14.
* <p/>
* This class will store all the game settings;
* <p/>
*/
public class GameConfig {
int GameConfigError;
private Card.CARD_RANK blueRavenRank;
private boolean includeOnes;
private boolean includeTwosThruFours;
private boolean highTrumpOne;
private Card.CARD_COLOR highTrumpOneColor;
private boolean includeBlueRaven;
private boolean playBlueRavenAnytime;
private int minimumBid;
private String nestName;
private boolean revealNestAfterBidding;
private boolean winningBidderLeads;
private boolean forceTrumpCantFollowSuit;
private boolean lastTrickWinnerTakesNest;
private short bonusAllPoints, bonusAllTricks, bonusMostTricks;
private short winningScore;
private short numberOfRounds;
public GameConfig() {
includeOnes = true;
includeTwosThruFours = false;
highTrumpOne = false;
highTrumpOneColor = Card.CARD_COLOR.GREEN;
includeBlueRaven = true;
playBlueRavenAnytime = true;
blueRavenRank = Card.CARD_RANK.HIGHROOK;
this.minimumBid = 100;
nestName = "Widow";
revealNestAfterBidding = false;
winningBidderLeads = true;
forceTrumpCantFollowSuit = false;
lastTrickWinnerTakesNest = true;
bonusAllPoints = 0;
bonusAllTricks = 0;
bonusMostTricks = 0;
winningScore = 300;
}
public GameConfig(boolean includeOnes, boolean includeTwosThruFours, boolean highTrumpOne, Card.CARD_COLOR highTrumpOneColor, boolean includeBlueRaven, boolean playBlueRavenAnytime, Card.CARD_RANK blueRavenRank, short minimumBid, String nestName, boolean revealNestAfterBidding, boolean winningBidderLeads, boolean forceTrumpCantFollowSuit, boolean lastTrickWinnerTakesNest, short bonusAllPoints, short bonusAllTricks, short bonusMostTricks, short winningScore) {
this.GameConfigError = GAME_CONFIG_ERROR_BITS.NO_ERROR.bit;
this.includeOnes = includeOnes;
this.includeTwosThruFours = includeTwosThruFours;
if (this.includeOnes) {
if (highTrumpOne) {
this.highTrumpOne = highTrumpOne;
this.highTrumpOneColor = highTrumpOneColor;
}
}
this.includeBlueRaven = includeBlueRaven;
if (this.includeBlueRaven) {
this.playBlueRavenAnytime = playBlueRavenAnytime;
this.blueRavenRank = blueRavenRank;
}
this.nestName = nestName;
this.revealNestAfterBidding = revealNestAfterBidding;
this.winningBidderLeads = winningBidderLeads;
this.forceTrumpCantFollowSuit = forceTrumpCantFollowSuit;
this.lastTrickWinnerTakesNest = lastTrickWinnerTakesNest;
this.bonusAllPoints = bonusAllPoints;
this.bonusAllTricks = bonusAllTricks;
this.bonusMostTricks = bonusMostTricks;
this.setWinningScore(winningScore);
this.setMinimumBid(minimumBid);
}
public short getNumberOfRounds() {
return numberOfRounds;
}
public void setNumberOfRounds(short numberOfRounds) {
this.numberOfRounds = numberOfRounds;
}
public Card.CARD_RANK getBlueRavenRank() {
return blueRavenRank;
}
public boolean isIncludeOnes() {
return includeOnes;
}
public boolean isIncludeTwosThruFours() {
return includeTwosThruFours;
}
public boolean isHighTrumpOne() {
return highTrumpOne;
}
public Card.CARD_COLOR getHighTrumpOneColor() {
return highTrumpOneColor;
}
public boolean isIncludeBlueRaven() {
return includeBlueRaven;
}
public boolean isPlayBlueRavenAnytime() {
return playBlueRavenAnytime;
}
public int getMinimumBid() {
return this.minimumBid;
}
private void setMinimumBid(short minimumBid) {
if (this.minimumBid > minimumBid) {
this.GameConfigError += GAME_CONFIG_ERROR_BITS.MIN_BID_ERROR.bit;
this.minimumBid = minimumBid;
return;
}
this.minimumBid = minimumBid;
}
public String getNestName() {
return nestName;
}
public boolean isRevealNestAfterBidding() {
return revealNestAfterBidding;
}
public boolean isWinningBidderLeads() {
return winningBidderLeads;
}
public boolean isForceTrumpCantFollowSuit() {
return forceTrumpCantFollowSuit;
}
public boolean isLastTrickWinnerTakesNest() {
return lastTrickWinnerTakesNest;
}
public short getBonusAllPoints() {
return bonusAllPoints;
}
public short getBonusAllTricks() {
return bonusAllTricks;
}
public short getBonusMostTricks() {
return bonusMostTricks;
}
public int getWinningScore() {
return winningScore;
}
private void setWinningScore(short winningScore) {
if (winningScore < 0 || winningScore > 10000) {
this.GameConfigError += GAME_CONFIG_ERROR_BITS.WIN_SCORE_ERROR.bit;
this.winningScore = 300;
return;
}
this.winningScore = winningScore;
}
public enum GAME_CONFIG_ERROR_BITS {
NO_ERROR(0),
MIN_BID_ERROR(1),
WIN_SCORE_ERROR(2);
private final int bit;
GAME_CONFIG_ERROR_BITS(int bit) {
this.bit = bit;
}
}
}