Yatzy/Domain/Sixes.java

33 lines
638 B
Java
Raw Normal View History

2024-05-03 21:10:44 +02:00
package Domain;
public class Sixes extends Category{
private Player player;
public Sixes(Player player) {
super("Sixes", "Score of all the sixes rolled.");
this.player = player;
}
@Override
public boolean correctCategory(int[] values){
for(int i : values){
if(i == 6){
return true;
}
}
return false;
}
@Override
public int getScore(){
int score = 0;
for(int i : player.getDice().getValues()){
if( i == 6 ){
score += i;
}
}
return score;
}
}