34 lines
635 B
Java
34 lines
635 B
Java
|
package Domain;
|
||
|
|
||
|
public class Twos extends Category{
|
||
|
|
||
|
private Player player;
|
||
|
|
||
|
public Twos(Player player) {
|
||
|
super("Twos", "Score of all the twos rolled.");
|
||
|
this.player = player;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean correctCategory(int[] values){
|
||
|
for(int i : values){
|
||
|
if(i == 2){
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getScore(){
|
||
|
int score = 0;
|
||
|
for(int i : player.getDice().getValues()){
|
||
|
if( i == 2 ){
|
||
|
score += i;
|
||
|
}
|
||
|
}
|
||
|
return score;
|
||
|
}
|
||
|
|
||
|
}
|