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