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