Yatzy/Domain/Threes.java

33 lines
642 B
Java

package Domain;
public class Threes extends Category{
private Player player;
public Threes(Player player) {
super("Threes", "Score of all the threes rolled.");
this.player = player;
}
@Override
public boolean correctCategory(int[] values){
for(int i : values){
if(i == 3){
return true;
}
}
return false;
}
@Override
public int getScore(){
int score = 0;
for(int i : player.getDice().getValues()){
if( i == 3 ){
score += i;
}
}
return score;
}
}